CernVM-FS  2.12.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
cvmfs::Sink Class Referenceabstract

#include <sink.h>

Inheritance diagram for cvmfs::Sink:

Public Member Functions

virtual ~Sink ()
 
virtual int64_t Write (const void *buf, uint64_t sz)=0
 
virtual int Reset ()=0
 
virtual int Purge ()=0
 
virtual bool IsValid ()=0
 
void Release ()
 
virtual int Flush ()=0
 
virtual bool Reserve (size_t size)=0
 
virtual bool RequiresReserve ()=0
 
virtual std::string Describe ()=0
 

Protected Member Functions

 Sink (bool is_owner)
 

Protected Attributes

bool is_owner_
 

Detailed Description

A data sink that behaves like a writable file descriptor with a custom implementation.

Definition at line 17 of file sink.h.

Constructor & Destructor Documentation

cvmfs::Sink::Sink ( bool  is_owner)
inlineexplicitprotected

Definition at line 19 of file sink.h.

virtual cvmfs::Sink::~Sink ( )
inlinevirtual

Definition at line 22 of file sink.h.

Member Function Documentation

virtual std::string cvmfs::Sink::Describe ( )
pure virtual

Return a string representation describing the type of sink and its status

Implemented in cvmfs::MemSink, cvmfs::PathSink, cvmfs::FileSink, cvmfs::TransactionSink, and anonymous_namespace{cache_stream.cc}::StreamingSink.

Referenced by download::CallbackCurlData(), and download::PrepareDownloadDestination().

Here is the caller graph for this function:

virtual int cvmfs::Sink::Flush ( )
pure virtual

Commit data to the sink

Returns
Success = 0 Failure = -errno

Implemented in cvmfs::TransactionSink, cvmfs::MemSink, cvmfs::PathSink, anonymous_namespace{cache_stream.cc}::StreamingSink, and cvmfs::FileSink.

Referenced by download::DownloadManager::VerifyAndFinalize().

Here is the caller graph for this function:

virtual bool cvmfs::Sink::IsValid ( )
pure virtual
Returns
true if the object is correctly initialized.

Implemented in cvmfs::TransactionSink, cvmfs::MemSink, anonymous_namespace{cache_stream.cc}::StreamingSink, cvmfs::PathSink, and cvmfs::FileSink.

Referenced by download::PrepareDownloadDestination().

Here is the caller graph for this function:

virtual int cvmfs::Sink::Purge ( )
pure 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().

Returns
Success = 0 Failure = -errno

Implemented in cvmfs::TransactionSink, anonymous_namespace{cache_stream.cc}::StreamingSink, cvmfs::MemSink, cvmfs::PathSink, and cvmfs::FileSink.

Referenced by download::DownloadManager::Fetch().

Here is the caller graph for this function:

void cvmfs::Sink::Release ( )
inline

Release ownership of the sink's resource

Definition at line 58 of file sink.h.

Referenced by manifest::DoFetch(), manifest::DoVerify(), and whitelist::Whitelist::LoadUrl().

Here is the caller graph for this function:

virtual bool cvmfs::Sink::RequiresReserve ( )
pure virtual

Returns if the specific sink type needs reservation of (data) space

Returns
true - reservation is needed false - no reservation is needed

Implemented in cvmfs::MemSink, cvmfs::PathSink, cvmfs::FileSink, cvmfs::TransactionSink, and anonymous_namespace{cache_stream.cc}::StreamingSink.

Referenced by download::CallbackCurlHeader(), and download::DownloadManager::SetUrlOptions().

Here is the caller graph for this function:

virtual bool cvmfs::Sink::Reserve ( size_t  size)
pure 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.

Note
If successful, always resets the current position to 0.

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_)

Returns
success = true failure = false

Implemented in cvmfs::MemSink, cvmfs::PathSink, cvmfs::FileSink, cvmfs::TransactionSink, and anonymous_namespace{cache_stream.cc}::StreamingSink.

Referenced by download::CallbackCurlHeader(), and download::DownloadManager::SetUrlOptions().

Here is the caller graph for this function:

virtual int cvmfs::Sink::Reset ( )
pure virtual

Truncate all written data and start over at position zero.

Returns
Success = 0 Failure = -errno

Implemented in anonymous_namespace{cache_stream.cc}::StreamingSink, cvmfs::TransactionSink, cvmfs::PathSink, cvmfs::MemSink, and cvmfs::FileSink.

Referenced by download::DownloadManager::VerifyAndFinalize().

Here is the caller graph for this function:

virtual int64_t cvmfs::Sink::Write ( const void *  buf,
uint64_t  sz 
)
pure virtual

Appends data to the sink

Returns
on success: number of bytes written (can be less than requested) on failure: -errno.

Implemented in cvmfs::TransactionSink, cvmfs::MemSink, cvmfs::PathSink, cvmfs::FileSink, and anonymous_namespace{cache_stream.cc}::StreamingSink.

Referenced by download::CallbackCurlData(), and zlib::DecompressZStream2Sink().

Here is the caller graph for this function:

Member Data Documentation


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