Simplepq v0.2.1 Simplepq View Source
Simple queue that’s store on the disc.
Warning! At this moment all functions don’t handle case when the file don’t exist. Errors can be raised.
Link to this section Summary
Functions
Rejects first elemet from the the queue. This method don’t return element and don’t have special return for the case when queue is empty. It’s just return this queue
Adds elemet to the end of queue
Creates file on the filesystem and create Simplepq.Queue associated with this file
Reads first element from queue without removing
Return count elements in the queue
Opens queue from file file_path
Take first element from the queue and place it in to the end of the queue
Link to this section Functions
ack(Simplepq.Queue) :: {:ok, queue :: Simplepq.Queue} | {:error, :file.posix()}
Rejects first elemet from the the queue. This method don’t return element and don’t have special return for the case when queue is empty. It’s just return this queue.
Returns {:ok, queue}
if element successfully rejected or queue is empty.
Else {:error, reason} when caused problem on writing the file
add(Simplepq.Queue, String.t()) :: {:ok, queue :: Simplepq.Queue} | {:error, :file.posix()}
Adds elemet to the end of queue.
Returns {:ok, queue}
if element added, else {:error, :file.posix()}.
create(String.t()) :: {:ok, queue :: Simplepq.Queue} | {:error, :file.posix()}
Creates file on the filesystem and create Simplepq.Queue associated with this file.
Returns {:ok, queue}
in case of success, else {:error, :file.posix()}.
get(Simplepq.Queue) :: {:ok, message :: String.t()} | {:error, :empty}
Reads first element from queue without removing.
Returns {:ok, message}
if element exists, or {:error, :empty} when queue is empty
.
Return count elements in the queue.
Opens queue from file file_path
.
Returns {:ok, queue}
in case of success, or {:error, :bad_file}
when file
can not be converted to term or term is not .
reject(Simplepq.Queue) :: {:ok, queue :: Simplepq.Queue} | {:error, :file.posix()}
Take first element from the queue and place it in to the end of the queue.
Returns {:ok, queue}
if element successfully moved or queue is empty.
Else {:error, reason} when caused problem on writing the file