CernVM-FS  2.12.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ObjectPackProducer Class Reference

#include <pack.h>

Collaboration diagram for ObjectPackProducer:

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

ObjectPackpack_
 
FILE * big_file_
 
uint64_t pos_
 
size_t idx_
 
size_t pos_in_bucket_
 
std::string header_
 

Detailed Description

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:

  1. object type identifier ('N' for named files, 'C' for CAS blobs)
  2. hash digest (hex)
  3. object size (decimal)
  4. object name - base64 encoding of the object name (optional - only if the object type is 'N')

Definition at line 182 of file pack.h.

Constructor & Destructor Documentation

ObjectPackProducer::ObjectPackProducer ( ObjectPack pack)
explicit

Definition at line 181 of file pack.cc.

Here is the call graph for this function:

ObjectPackProducer::ObjectPackProducer ( const shash::Any id,
FILE *  big_file,
const std::string &  file_name = "" 
)

Definition at line 195 of file pack.cc.

Here is the call graph for this function:

Member Function Documentation

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().

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned ObjectPackProducer::GetHeaderSize ( )
inline

Definition at line 189 of file pack.h.

Referenced by upload::SessionContext::DoUpload().

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

FILE* ObjectPackProducer::big_file_
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().

std::string ObjectPackProducer::header_
private

The header is created in the constructor.

Definition at line 220 of file pack.h.

Referenced by GetDigest(), GetHeaderSize(), ObjectPackProducer(), and ProduceNext().

size_t ObjectPackProducer::idx_
private

Keeps track of the current index in pack_->buckets_

Definition at line 210 of file pack.h.

Referenced by ProduceNext().

ObjectPack* ObjectPackProducer::pack_
private

Unused if big_file_ is used.

Definition at line 195 of file pack.h.

Referenced by ProduceNext().

uint64_t ObjectPackProducer::pos_
private

Keeps track of how many bytes have been produced.

Definition at line 205 of file pack.h.

Referenced by ProduceNext().

size_t ObjectPackProducer::pos_in_bucket_
private

Keeps track of the current position in pack_->buckets_[idx_]

Definition at line 215 of file pack.h.

Referenced by ProduceNext().


The documentation for this class was generated from the following files: