proio
Classes | Public Member Functions | List of all members
proio::Writer Class Reference

#include <writer.h>

Inheritance diagram for proio::Writer:

Public Member Functions

 Writer (int fd)
 
 Writer (std::string filename)
 
void Flush ()
 
void Push (Event *event)
 
void PushMetadata (std::string name, const std::string &data)
 
void PushMetadata (std::string name, const char *data)
 
void SetCompression (Compression alg=GZIP, int level=-1)
 
void SetBucketDumpThreshold (uint64_t thres=0x1000000)
 

Detailed Description

Writer for proio files

Definition at line 48 of file writer.h.

Constructor & Destructor Documentation

Writer::Writer ( int  fd)

Constructor for providing a file descriptor

Definition at line 12 of file writer.cc.

Writer::Writer ( std::string  filename)

Constructor that creates a file descriptor from a file path, overwriting any existing file

Definition at line 19 of file writer.cc.

Member Function Documentation

void Writer::Flush ( )

Flush compresses and flushes all buffered (bucket) data to the output stream. This is automatically called upon destruction of the Writer object, and when the bucket dump threshold is reached. This function is asynchronous, meaning that it will return before the flush to the output stream is actually complete. Synchronization is forced on destruction.

Definition at line 46 of file writer.cc.

void Writer::Push ( Event event)

Push takes an Event and serializes it into the output bucket.

Definition at line 96 of file writer.cc.

void Writer::PushMetadata ( std::string  name,
const std::string &  data 
)

PushMetadata takes a string key and string data set and pushes it into the stream. If Events exist in the current bucket, the bucket is flushed first.

Definition at line 140 of file writer.cc.

void Writer::PushMetadata ( std::string  name,
const char *  data 
)

PushMetadata takes a string key and null-terminated const char array by pointer and pushes it into the stream. If Events exist in the current bucket, the bucket is flushed first.

Definition at line 145 of file writer.cc.

void proio::Writer::SetBucketDumpThreshold ( uint64_t  thres = 0x1000000)
inline

SetBucketDumpThreshold sets the threshold uncompressed bucket size for automatic compression and output (dump). I.e., once the size of the uncompressed bucket in memory reaches this threshold, Flush() will be called. Flush() can also be manually called at any time.

Definition at line 92 of file writer.h.

void proio::Writer::SetCompression ( Compression  alg = GZIP,
int  level = -1 
)
inline

SetCompression sets the compression algorithm and compression level (-1 for default) to use for future output buckets. Algorithm is one of: LZ4, GZIP, or UNCOMPRESSED.

Definition at line 83 of file writer.h.


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