![]() |
CernVM-FS
2.11.0
|
#include <tube.h>
Classes | |
class | Link |
Public Member Functions | |
Tube () | |
Tube (uint64_t limit) | |
~Tube () | |
Link * | EnqueueBack (ItemT *item) |
Link * | EnqueueFront (ItemT *item) |
ItemT * | Slice (Link *link) |
ItemT * | PopFront () |
ItemT * | PopBack () |
void | Wait () |
bool | IsEmpty () |
uint64_t | size () |
Private Member Functions | |
void | Init () |
ItemT * | SliceUnlocked (Link *link) |
![]() | |
SingleCopy () | |
Private Attributes | |
uint64_t | limit_ |
uint64_t | size_ |
Link * | head_ |
pthread_mutex_t | lock_ |
pthread_cond_t | cond_populated_ |
pthread_cond_t | cond_capacious_ |
pthread_cond_t | cond_empty_ |
This file is part of the CernVM File System. A thread-safe, doubly linked list of links containing pointers to ItemT. The ItemT elements are not owned by the Tube. FIFO or LIFO semantics. Using Slice(), items at arbitrary locations in the tube can be removed, too.
The layout of the linked list is as follows:
| | –> I$n$ (back) <–> I2 <–> ... <–> I1 (front) <–> HEAD <–
The tube links the steps in the file processing pipeline. It connects multiple producers to multiple consumers and can throttle the producers if a limit for the tube size is set.
Internally, uses conditional variables to block when threads try to pop from the empty tube or insert into the full tube.
Push an item to the back of the queue. Block if queue is currently full.
Definition at line 73 of file tube.h.
Referenced by IngestionPipeline::Process(), and ScrubbingPipeline::Process().
|
inlineprivate |
Definition at line 161 of file tube.h.
Referenced by Tube< FileItem >::Tube().
|
inline |
|
inline |
Remove and return the first element from the queue. Block if tube is empty.
Definition at line 123 of file tube.h.
Referenced by TaskRegister::Process(), and TaskScrubbingCallback::Process().
|
inline |
Definition at line 176 of file tube.h.
Referenced by Tube< FileItem >::PopBack(), Tube< FileItem >::PopFront(), and Tube< FileItem >::Slice().
|
inline |
Blocks until the tube is empty
Definition at line 144 of file tube.h.
Referenced by IngestionPipeline::WaitFor(), and ScrubbingPipeline::WaitFor().
|
private |
Signals if there is space to enqueue more items
Definition at line 217 of file tube.h.
Referenced by Tube< FileItem >::EnqueueBack(), Tube< FileItem >::EnqueueFront(), Tube< FileItem >::Init(), Tube< FileItem >::SliceUnlocked(), and Tube< FileItem >::~Tube().
|
private |
Signals if the queue runs empty
Definition at line 221 of file tube.h.
Referenced by Tube< FileItem >::Init(), Tube< FileItem >::SliceUnlocked(), Tube< FileItem >::Wait(), and Tube< FileItem >::~Tube().
|
private |
Signals if there are items enqueued
Definition at line 213 of file tube.h.
Referenced by Tube< FileItem >::EnqueueBack(), Tube< FileItem >::EnqueueFront(), Tube< FileItem >::Init(), Tube< FileItem >::PopBack(), Tube< FileItem >::PopFront(), and Tube< FileItem >::~Tube().
Sentinel element in front of the first (front) element
Definition at line 205 of file tube.h.
Referenced by Tube< FileItem >::EnqueueBack(), Tube< FileItem >::EnqueueFront(), Tube< FileItem >::Init(), Tube< FileItem >::PopBack(), Tube< FileItem >::PopFront(), Tube< FileItem >::SliceUnlocked(), and Tube< FileItem >::~Tube().
|
private |
Adding new item blocks as long as limit_ == size_
Definition at line 197 of file tube.h.
Referenced by Tube< FileItem >::EnqueueBack(), and Tube< FileItem >::EnqueueFront().
|
private |
Protects all internal state
Definition at line 209 of file tube.h.
Referenced by Tube< FileItem >::EnqueueBack(), Tube< FileItem >::EnqueueFront(), Tube< FileItem >::Init(), Tube< FileItem >::IsEmpty(), Tube< FileItem >::PopBack(), Tube< FileItem >::PopFront(), Tube< FileItem >::size(), Tube< FileItem >::Slice(), Tube< FileItem >::Wait(), and Tube< FileItem >::~Tube().
|
private |
The current number of links in the list
Definition at line 201 of file tube.h.
Referenced by Tube< FileItem >::EnqueueBack(), Tube< FileItem >::EnqueueFront(), Tube< FileItem >::IsEmpty(), Tube< FileItem >::PopBack(), Tube< FileItem >::PopFront(), Tube< FileItem >::size(), Tube< FileItem >::SliceUnlocked(), and Tube< FileItem >::Wait().