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

#include <fetch.h>

Inheritance diagram for cvmfs::TransactionSink:
Collaboration diagram for cvmfs::TransactionSink:

Public Member Functions

 TransactionSink (CacheManager *cache_mgr, void *open_txn)
 
virtual ~TransactionSink ()
 
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 ()
 
- Public Member Functions inherited from cvmfs::Sink
virtual ~Sink ()
 
void Release ()
 

Private Attributes

CacheManagercache_mgr_
 
void * open_txn_
 

Additional Inherited Members

- Protected Member Functions inherited from cvmfs::Sink
 Sink (bool is_owner)
 
- Protected Attributes inherited from cvmfs::Sink
bool is_owner_
 

Detailed Description

TransacionSink uses an open transaction in a cache manager as a sink. It allows the download manager to write data without knowing about the cache manager.

Definition at line 33 of file fetch.h.

Constructor & Destructor Documentation

cvmfs::TransactionSink::TransactionSink ( CacheManager cache_mgr,
void *  open_txn 
)
inline

Definition at line 35 of file fetch.h.

virtual cvmfs::TransactionSink::~TransactionSink ( )
inlinevirtual

Definition at line 39 of file fetch.h.

Member Function Documentation

virtual std::string cvmfs::TransactionSink::Describe ( )
inlinevirtual

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

Implements cvmfs::Sink.

Definition at line 86 of file fetch.h.

Here is the call graph for this function:

virtual int cvmfs::TransactionSink::Flush ( )
inlinevirtual

Commit data to the sink

Returns
Success = 0 Failure = -errno

Implements cvmfs::Sink.

Definition at line 79 of file fetch.h.

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

Implements cvmfs::Sink.

Definition at line 75 of file fetch.h.

Referenced by Describe().

Here is the caller graph for this function:

virtual int cvmfs::TransactionSink::Purge ( )
inlinevirtual

Purges all resources leaving the sink in an invalid state. More aggressive version of Reset(). For some sinks it might do the same as Reset().

Returns
Success = 0 Failure = -errno

Implements cvmfs::Sink.

Definition at line 69 of file fetch.h.

Here is the call graph for this function:

virtual bool cvmfs::TransactionSink::RequiresReserve ( )
inlinevirtual

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

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

Implements cvmfs::Sink.

Definition at line 81 of file fetch.h.

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

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

Implements cvmfs::Sink.

Definition at line 80 of file fetch.h.

virtual int cvmfs::TransactionSink::Reset ( )
inlinevirtual

Truncate all written data and start over at position zero.

Returns
Success = 0 Failure = -errno

Implements cvmfs::Sink.

Definition at line 57 of file fetch.h.

Referenced by Purge().

Here is the call graph for this function:

Here is the caller graph for this function:

virtual int64_t cvmfs::TransactionSink::Write ( const void *  buf,
uint64_t  sz 
)
inlinevirtual

Appends data to the sink

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

Implements cvmfs::Sink.

Definition at line 47 of file fetch.h.

Here is the call graph for this function:

Member Data Documentation

CacheManager* cvmfs::TransactionSink::cache_mgr_
private

Definition at line 93 of file fetch.h.

Referenced by IsValid(), Reset(), and Write().

void* cvmfs::TransactionSink::open_txn_
private

Definition at line 94 of file fetch.h.

Referenced by IsValid(), Reset(), and Write().


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