CernVM-FS
2.12.0
|
#include <sink_mem.h>
Public Member Functions | |
MemSink () | |
MemSink (size_t size) | |
virtual | ~MemSink () |
virtual int64_t | Write (const void *buf, uint64_t sz) |
virtual int | Reset () |
virtual int | Purge () |
virtual bool | IsValid () |
virtual int | Flush () |
virtual bool | Reserve (size_t size) |
virtual bool | RequiresReserve () |
virtual std::string | Describe () |
void | Adopt (size_t size, size_t pos, unsigned char *data, bool is_owner=true) |
size_t | size () |
size_t | pos () |
unsigned char * | data () |
Public Member Functions inherited from cvmfs::Sink | |
virtual | ~Sink () |
void | Release () |
Static Public Attributes | |
static const size_t | kMaxMemSize = 1024ul * 1024ul |
Private Member Functions | |
void | FreeData () |
Private Attributes | |
size_t | size_ |
size_t | pos_ |
unsigned char * | data_ |
const size_t | max_size_ |
Additional Inherited Members | |
Protected Member Functions inherited from cvmfs::Sink | |
Sink (bool is_owner) | |
Protected Attributes inherited from cvmfs::Sink | |
bool | is_owner_ |
MemSink is a data sink that writes to a unsigned char* buffer. The buffer has a fixed size, as such reservation of space is necessary. It can use Adopt() to write to a different buffer.
By default, MemSink is the owner of the buffer and takes care of its creation and deletion.
Definition at line 27 of file sink_mem.h.
|
inline |
Definition at line 29 of file sink_mem.h.
|
explicit |
Definition at line 16 of file sink_mem.cc.
|
inlinevirtual |
void cvmfs::MemSink::Adopt | ( | size_t | size, |
size_t | pos, | ||
unsigned char * | data, | ||
bool | is_owner = true |
||
) |
Allows the sink to adopt data that was initialized outside this class. The sink can become the new owner of the data, or not.
Definition at line 123 of file sink_mem.cc.
|
inline |
Definition at line 122 of file sink_mem.h.
Referenced by Adopt(), download::AutoProxy(), manifest::DoFetch(), notify::DoPublish(), manifest::DoVerify(), publish::DownloadRootObjects(), whitelist::Whitelist::LoadUrl(), swissknife::CommandInfo::Main(), and swissknife::CommandPull::Main().
|
virtual |
Return a string representation describing the type of sink and its status
Implements cvmfs::Sink.
Definition at line 112 of file sink_mem.cc.
|
inlinevirtual |
Commit data to the sink
Implements cvmfs::Sink.
Definition at line 76 of file sink_mem.h.
|
inlineprivate |
Definition at line 130 of file sink_mem.h.
Referenced by Adopt(), Reserve(), and ~MemSink().
|
virtual |
Implements cvmfs::Sink.
Definition at line 67 of file sink_mem.cc.
|
inline |
Definition at line 121 of file sink_mem.h.
Referenced by Adopt(), download::AutoProxy(), manifest::DoFetch(), notify::DoPublish(), manifest::DoVerify(), publish::DownloadRootObjects(), whitelist::Whitelist::LoadUrl(), swissknife::CommandInfo::Main(), and swissknife::CommandPull::Main().
|
inlinevirtual |
Purges all resources leaving the sink in an invalid state. More aggressive version of Reset(). For some sinks and depending on owner status it might do the same as Reset().
Implements cvmfs::Sink.
Definition at line 62 of file sink_mem.h.
|
inlinevirtual |
Returns if the specific sink type needs reservation of (data) space
Implements cvmfs::Sink.
Definition at line 104 of file sink_mem.h.
|
virtual |
Reserves new space in sinks that require reservation (see RequiresReserve)
Successful if the requested size is smaller than already space reserved, or if the sink is the owner of the data and can allocate enough new space.
Fails if 1) sink is not the owner of the data and more than the current size is requested 2) more space is requested than allowed (max_size_)
Implements cvmfs::Sink.
Definition at line 88 of file sink_mem.cc.
|
virtual |
Truncate all written data and start over at position zero.
Implements cvmfs::Sink.
Definition at line 52 of file sink_mem.cc.
Referenced by download::DownloadManager::ProbeHosts(), and Purge().
|
inline |
Definition at line 120 of file sink_mem.h.
Referenced by Adopt(), and Reserve().
|
virtual |
Appends data to the sink If the sink is too small and
Appends data to the sink If the sink is too small and
Implements cvmfs::Sink.
Definition at line 30 of file sink_mem.cc.
|
private |
Definition at line 138 of file sink_mem.h.
Referenced by Adopt(), data(), FreeData(), IsValid(), MemSink(), Reserve(), Reset(), and Write().
|
static |
Do not download files larger than 1M into memory.
Definition at line 127 of file sink_mem.h.
|
private |
Definition at line 139 of file sink_mem.h.
Referenced by Reserve().
|
private |
Definition at line 137 of file sink_mem.h.
Referenced by Adopt(), Describe(), IsValid(), pos(), Reserve(), Reset(), and Write().
|
private |
Definition at line 136 of file sink_mem.h.
Referenced by Adopt(), Describe(), IsValid(), Reserve(), Reset(), size(), and Write().