![]() |
CernVM-FS
2.13.0
|
#include <pack.h>
Classes | |
struct | IndexEntry |
Public Member Functions | |
ObjectPackConsumer (const shash::Any &expected_digest, const unsigned expected_header_size) | |
ObjectPackBuild::State | ConsumeNext (const unsigned buf_size, const unsigned char *buf) |
![]() | |
virtual | ~Observable () |
CallbackPtr | RegisterListener (typename BoundClosure< ObjectPackBuild::Event, DelegateT, ClosureDataT >::CallbackMethod method, DelegateT *delegate, ClosureDataT data) |
CallbackPtr | RegisterListener (typename BoundCallback< ObjectPackBuild::Event, DelegateT >::CallbackMethod method, DelegateT *delegate) |
CallbackPtr | RegisterListener (typename Callback< ObjectPackBuild::Event >::CallbackFunction fn) |
void | UnregisterListener (CallbackPtr callback_object) |
void | UnregisterListeners () |
Private Member Functions | |
bool | ParseHeader () |
bool | ParseItem (const std::string &line, IndexEntry *entry, uint64_t *sum_size) |
ObjectPackBuild::State | ConsumePayload (const unsigned buf_size, const unsigned char *buf) |
Private Attributes | |
shash::Any | expected_digest_ |
unsigned | expected_header_size_ |
uint64_t | pos_ |
unsigned | idx_ |
unsigned | pos_in_object_ |
unsigned char | accumulator_ [kAccuSize] |
unsigned | pos_in_accu_ |
ObjectPackBuild::State | state_ |
std::string | raw_header_ |
uint64_t | size_ |
std::vector< IndexEntry > | index_ |
Static Private Attributes | |
static const unsigned | kAccuSize = 128 * 1024 |
Additional Inherited Members | |
![]() | |
typedef Callbackable < ObjectPackBuild::Event > ::CallbackTN * | CallbackPtr |
![]() | |
typedef CallbackBase < ObjectPackBuild::Event > | CallbackTN |
![]() | |
static CallbackTN * | MakeClosure (typename BoundClosure< ObjectPackBuild::Event, DelegateT, ClosureDataT >::CallbackMethod method, DelegateT *delegate, const ClosureDataT &closure_data) |
static CallbackTN * | MakeCallback (typename BoundCallback< ObjectPackBuild::Event, DelegateT >::CallbackMethod method, DelegateT *delegate) |
static CallbackTN * | MakeCallback (typename Callback< ObjectPackBuild::Event >::CallbackFunction function) |
![]() | |
typedef std::set< CallbackPtr > | Callbacks |
![]() | |
void | RegisterListener (CallbackPtr callback_object) |
Observable () | |
void | NotifyListeners (const ObjectPackBuild::Event ¶meter) |
Deserializes an ObjectPack created by ObjectPackProducer. For every object it calls all listeners with a Event parameter at least once for every object. For large objects, it calls the listeners multiple times. It won't verify the incoming data, this is up to the listeners handling the data. The ObjectPackConsumer will verify the header digest, however.
|
explicit |
ObjectPackBuild::State ObjectPackConsumer::ConsumeNext | ( | const unsigned | buf_size, |
const unsigned char * | buf | ||
) |
At the end of the function, pos_ will have progressed by buf_size (unless the buffer contains trailing garbage bytes.
Definition at line 288 of file pack.cc.
Referenced by receiver::PayloadProcessor::Process().
|
private |
Informs listeners for small complete objects. For large objects, buffers the input into reasonably sized chunks. buf can contain both a chunk of data that needs to be added to the consumer's accumulator and a bunch of complete small objects. We use the accumulator only if necessary to avoid unnecessary memory copies.
Definition at line 349 of file pack.cc.
Referenced by ConsumeNext().
|
private |
Definition at line 399 of file pack.cc.
Referenced by ConsumeNext().
|
private |
Definition at line 442 of file pack.cc.
Referenced by ParseHeader().
|
private |
Collects data for large objects so that the number of callbacks to the listeners is reduced.
Definition at line 287 of file pack.h.
Referenced by ConsumePayload().
|
private |
Definition at line 265 of file pack.h.
Referenced by ConsumeNext().
|
private |
Definition at line 266 of file pack.h.
Referenced by ConsumeNext().
|
private |
Keeps track of the current index in the array of objects (index_)
Definition at line 276 of file pack.h.
Referenced by ConsumePayload().
|
private |
Hash id and size of the individual objects in order.
Definition at line 314 of file pack.h.
Referenced by ConsumeNext(), ConsumePayload(), and ParseHeader().
|
staticprivate |
For large objects, notify listeners in chunks of 128kB.
Definition at line 245 of file pack.h.
Referenced by ConsumePayload().
|
private |
Keeps track of how many bytes have been consumed from the payload.
Definition at line 271 of file pack.h.
Referenced by ConsumeNext(), and ConsumePayload().
|
private |
Keeps track of how many live bytes are stored in the accumulator_.
Definition at line 292 of file pack.h.
Referenced by ConsumePayload().
|
private |
Keeps track of how many bytes have been processed from the current object.
Definition at line 281 of file pack.h.
Referenced by ConsumePayload().
|
private |
Temporary store for the incomplete header. Once completely consumed, the header is interpreted into global_header_ and object_index_.
Definition at line 304 of file pack.h.
Referenced by ConsumeNext(), ObjectPackConsumer(), and ParseHeader().
|
private |
Total size of all the objects in the pack (header not included).
Definition at line 309 of file pack.h.
Referenced by ParseHeader().
|
private |
The state starts in kStateContinue and makes exactly one transition into one of the other states as more bytes are consumed.
Definition at line 298 of file pack.h.
Referenced by ConsumeNext(), ConsumePayload(), and ObjectPackConsumer().