CernVM-FS
2.12.0
|
#include <pack.h>
Public Member Functions | |
ObjectPackProducer (ObjectPack *pack) | |
ObjectPackProducer (const shash::Any &id, FILE *big_file, const std::string &file_name="") | |
unsigned | ProduceNext (const unsigned buf_size, unsigned char *buf) |
void | GetDigest (shash::Any *hash) |
unsigned | GetHeaderSize () |
Private Attributes | |
ObjectPack * | pack_ |
FILE * | big_file_ |
uint64_t | pos_ |
size_t | idx_ |
size_t | pos_in_bucket_ |
std::string | header_ |
Serializes ObjectPacks. It can also serialize a single large file as an "object pack", which otherwise would need special treatment.
The serialized format has a global, human readable header which has lines of character keys and string values (like the cvmfs manifest) followed by a "--" separator line followed by the index of objects. The index contains one line for each item in the pack. Each line contains the following space-separated tokens:
|
explicit |
ObjectPackProducer::ObjectPackProducer | ( | const shash::Any & | id, |
FILE * | big_file, | ||
const std::string & | file_name = "" |
||
) |
void ObjectPackProducer::GetDigest | ( | shash::Any * | hash | ) |
Hash over the header. The hash algorithm needs to be provided by hash.
Definition at line 176 of file pack.cc.
Referenced by upload::SessionContext::DoUpload().
|
inline |
Definition at line 189 of file pack.h.
Referenced by upload::SessionContext::DoUpload().
unsigned ObjectPackProducer::ProduceNext | ( | const unsigned | buf_size, |
unsigned char * | buf | ||
) |
Copies as many bytes as possible into buf. If the returned number of bytes is shorter than buf_size, everything has been produced.
Definition at line 216 of file pack.cc.
Referenced by upload::SendCB().
|
private |
Unused if object pack is used. Rewind before giving to ObjectPackProducer.
Definition at line 200 of file pack.h.
Referenced by ObjectPackProducer(), and ProduceNext().
|
private |
The header is created in the constructor.
Definition at line 220 of file pack.h.
Referenced by GetDigest(), GetHeaderSize(), ObjectPackProducer(), and ProduceNext().
|
private |
Keeps track of the current index in pack_->buckets_
Definition at line 210 of file pack.h.
Referenced by ProduceNext().
|
private |
|
private |
Keeps track of how many bytes have been produced.
Definition at line 205 of file pack.h.
Referenced by ProduceNext().
|
private |
Keeps track of the current position in pack_->buckets_[idx_]
Definition at line 215 of file pack.h.
Referenced by ProduceNext().