CernVM-FS
2.12.0
|
#include <sink_file.h>
Public Member Functions | |
FileSink (FILE *destination_file) | |
FileSink (FILE *destination_file, bool is_owner) | |
virtual | ~FileSink () |
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) |
virtual bool | RequiresReserve () |
virtual std::string | Describe () |
void | Adopt (FILE *file, bool is_owner=true) |
FILE * | file () |
Public Member Functions inherited from cvmfs::Sink | |
virtual | ~Sink () |
void | Release () |
Private Attributes | |
FILE * | file_ |
Additional Inherited Members | |
Protected Member Functions inherited from cvmfs::Sink | |
Sink (bool is_owner) | |
Protected Attributes inherited from cvmfs::Sink | |
bool | is_owner_ |
FileSink is a data sink that write to a given FILE. It does not require any space reservation. It can change to which file to write to using Adopt().
By default FileSink is not the owner of FILE, so the outside entity has to take care of opening and closing the FILE.
Definition at line 25 of file sink_file.h.
|
inlineexplicit |
Definition at line 27 of file sink_file.h.
|
inline |
Definition at line 29 of file sink_file.h.
|
inlinevirtual |
Definition at line 32 of file sink_file.h.
void cvmfs::FileSink::Adopt | ( | FILE * | file, |
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 75 of file sink_file.cc.
|
virtual |
Return a string representation describing the type of sink and its status
Implements cvmfs::Sink.
Definition at line 70 of file sink_file.cc.
|
inline |
Definition at line 109 of file sink_file.h.
Referenced by Adopt().
|
inlinevirtual |
Commit data to the sink
Implements cvmfs::Sink.
Definition at line 64 of file sink_file.h.
|
inlinevirtual |
Implements cvmfs::Sink.
Definition at line 55 of file sink_file.h.
Referenced by Describe().
|
virtual |
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 53 of file sink_file.cc.
|
inlinevirtual |
Returns if the specific sink type needs reservation of (data) space
Implements cvmfs::Sink.
Definition at line 94 of file sink_file.h.
|
inlinevirtual |
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 84 of file sink_file.h.
|
virtual |
Truncate all written data and start over at position zero.
Implements cvmfs::Sink.
Definition at line 38 of file sink_file.cc.
Referenced by Purge().
|
virtual |
Appends data to the sink
Appends data to the sink
Implements cvmfs::Sink.
Definition at line 19 of file sink_file.cc.
|
private |
Definition at line 114 of file sink_file.h.
Referenced by Adopt(), file(), Flush(), IsValid(), Purge(), Reset(), Write(), and ~FileSink().