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

#include <quota.h>

Inheritance diagram for QuotaManager:
Collaboration diagram for QuotaManager:

Public Types

enum  Capabilities {
  kCapIntrospectSize = 0, kCapIntrospectCleanupRate, kCapList, kCapShrink,
  kCapListeners
}
 

Public Member Functions

 QuotaManager ()
 
virtual ~QuotaManager ()
 
virtual bool HasCapability (Capabilities capability)=0
 
virtual void Insert (const shash::Any &hash, const uint64_t size, const std::string &description)=0
 
virtual void InsertVolatile (const shash::Any &hash, const uint64_t size, const std::string &description)=0
 
virtual bool Pin (const shash::Any &hash, const uint64_t size, const std::string &description, const bool is_catalog)=0
 
virtual void Unpin (const shash::Any &hash)=0
 
virtual void Touch (const shash::Any &hash)=0
 
virtual void Remove (const shash::Any &file)=0
 
virtual bool Cleanup (const uint64_t leave_size)=0
 
virtual std::vector< std::string > List ()=0
 
virtual std::vector< std::string > ListPinned ()=0
 
virtual std::vector< std::string > ListCatalogs ()=0
 
virtual std::vector< std::string > ListVolatile ()=0
 
virtual uint64_t GetMaxFileSize ()=0
 
virtual uint64_t GetCapacity ()=0
 
virtual uint64_t GetSize ()=0
 
virtual uint64_t GetSizePinned ()=0
 
virtual uint64_t GetCleanupRate (uint64_t period_s)=0
 
virtual void Spawn ()=0
 
virtual pid_t GetPid ()=0
 
virtual uint32_t GetProtocolRevision ()=0
 
virtual void RegisterBackChannel (int back_channel[2], const std::string &channel_id)=0
 
virtual void UnregisterBackChannel (int back_channel[2], const std::string &channel_id)=0
 
void BroadcastBackchannels (const std::string &message)
 

Static Public Attributes

static const uint32_t kProtocolRevision = 2
 

Protected Member Functions

void LockBackChannels ()
 
void UnlockBackChannels ()
 

Protected Attributes

std::map< shash::Md5, int > back_channels_
 
pthread_mutex_t * lock_back_channels_
 
uint32_t protocol_revision_
 

Additional Inherited Members

- Private Member Functions inherited from SingleCopy
 SingleCopy ()
 

Detailed Description

This file is part of the CernVM File System. The QuotaManager keeps track of the cache contents. It is informed by the cache manager about opens and inserts. The cache manager picks a quota manager that fits to the backend storage (e.g. POSIX, key-value store). File catalogs are "pinned" in the quota manager. Since they remain loaded (virtual file descriptor stays open), it does not make sense to remove them. Regular files might get pinned occasionally as well, for instance for the CernVM "core files".

Multiple cache managers can share a single quota manager instance, as it is done for the local shared hard disk cache.

Sometimes it is necessary that a quota manager instance gives feedback to its users. This is where back channels are used. Users can register a back channel, which gets informed for instance if the number of pinned catalogs get large and should be released.

Definition at line 36 of file quota.h.

Member Enumeration Documentation

Enumerator
kCapIntrospectSize 
kCapIntrospectCleanupRate 
kCapList 
kCapShrink 
kCapListeners 

Definition at line 47 of file quota.h.

Constructor & Destructor Documentation

QuotaManager::QuotaManager ( )

Definition at line 54 of file quota.cc.

Here is the call graph for this function:

QuotaManager::~QuotaManager ( )
virtual

Definition at line 62 of file quota.cc.

Member Function Documentation

void QuotaManager::BroadcastBackchannels ( const std::string &  message)

Definition at line 21 of file quota.cc.

Referenced by ExternalCacheManager::MainRead().

Here is the call graph for this function:

Here is the caller graph for this function:

virtual bool QuotaManager::Cleanup ( const uint64_t  leave_size)
pure virtual

Implemented in ExternalQuotaManager, NoopQuotaManager, and PosixQuotaManager.

Referenced by TalkManager::MainResponder().

Here is the caller graph for this function:

virtual uint64_t QuotaManager::GetCapacity ( )
pure virtual

Implemented in ExternalQuotaManager, NoopQuotaManager, and PosixQuotaManager.

Referenced by cvmfs::cvmfs_statfs().

Here is the caller graph for this function:

virtual uint64_t QuotaManager::GetCleanupRate ( uint64_t  period_s)
pure virtual

Implemented in ExternalQuotaManager, NoopQuotaManager, and PosixQuotaManager.

Referenced by NCleanup24MagicXattr::FinalizeValue(), and TalkManager::MainResponder().

Here is the caller graph for this function:

virtual uint64_t QuotaManager::GetMaxFileSize ( )
pure virtual
virtual pid_t QuotaManager::GetPid ( )
pure virtual

Implemented in ExternalQuotaManager, NoopQuotaManager, and PosixQuotaManager.

Referenced by TalkManager::MainResponder().

Here is the caller graph for this function:

virtual uint32_t QuotaManager::GetProtocolRevision ( )
pure virtual
virtual uint64_t QuotaManager::GetSize ( )
pure virtual

Implemented in ExternalQuotaManager, NoopQuotaManager, and PosixQuotaManager.

Referenced by cvmfs::cvmfs_statfs(), and TalkManager::MainResponder().

Here is the caller graph for this function:

virtual uint64_t QuotaManager::GetSizePinned ( )
pure virtual

Implemented in ExternalQuotaManager, NoopQuotaManager, and PosixQuotaManager.

Referenced by TalkManager::MainResponder().

Here is the caller graph for this function:

virtual bool QuotaManager::HasCapability ( Capabilities  capability)
pure virtual
virtual void QuotaManager::Insert ( const shash::Any hash,
const uint64_t  size,
const std::string &  description 
)
pure virtual
virtual void QuotaManager::InsertVolatile ( const shash::Any hash,
const uint64_t  size,
const std::string &  description 
)
pure virtual
virtual std::vector<std::string> QuotaManager::List ( )
pure virtual

Implemented in ExternalQuotaManager, NoopQuotaManager, and PosixQuotaManager.

Referenced by TalkManager::MainResponder().

Here is the caller graph for this function:

virtual std::vector<std::string> QuotaManager::ListCatalogs ( )
pure virtual

Implemented in ExternalQuotaManager, NoopQuotaManager, and PosixQuotaManager.

Referenced by TalkManager::MainResponder().

Here is the caller graph for this function:

virtual std::vector<std::string> QuotaManager::ListPinned ( )
pure virtual

Implemented in ExternalQuotaManager, NoopQuotaManager, and PosixQuotaManager.

Referenced by TalkManager::MainResponder().

Here is the caller graph for this function:

virtual std::vector<std::string> QuotaManager::ListVolatile ( )
pure virtual
void QuotaManager::LockBackChannels ( )
inlineprotected

Definition at line 96 of file quota.h.

Referenced by PosixQuotaManager::MainCommandServer(), ExternalQuotaManager::RegisterBackChannel(), and ExternalQuotaManager::UnregisterBackChannel().

Here is the call graph for this function:

Here is the caller graph for this function:

virtual bool QuotaManager::Pin ( const shash::Any hash,
const uint64_t  size,
const std::string &  description,
const bool  is_catalog 
)
pure virtual

Implemented in ExternalQuotaManager, NoopQuotaManager, and PosixQuotaManager.

Referenced by CacheManager::OpenPinned(), and cvmfs::Pin().

Here is the caller graph for this function:

virtual void QuotaManager::RegisterBackChannel ( int  back_channel[2],
const std::string &  channel_id 
)
pure virtual

Implemented in ExternalQuotaManager, NoopQuotaManager, and PosixQuotaManager.

Referenced by quota::RegisterUnpinListener(), and quota::RegisterWatchdogListener().

Here is the caller graph for this function:

virtual void QuotaManager::Remove ( const shash::Any file)
pure virtual

Implemented in ExternalQuotaManager, NoopQuotaManager, and PosixQuotaManager.

Referenced by cvmfs::Evict().

Here is the caller graph for this function:

virtual void QuotaManager::Spawn ( )
pure virtual

Implemented in ExternalQuotaManager, NoopQuotaManager, and PosixQuotaManager.

Referenced by Spawn().

Here is the caller graph for this function:

virtual void QuotaManager::Touch ( const shash::Any hash)
pure virtual
void QuotaManager::UnlockBackChannels ( )
inlineprotected

Definition at line 100 of file quota.h.

Referenced by PosixQuotaManager::MainCommandServer(), ExternalQuotaManager::RegisterBackChannel(), and ExternalQuotaManager::UnregisterBackChannel().

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void QuotaManager::Unpin ( const shash::Any hash)
pure virtual
virtual void QuotaManager::UnregisterBackChannel ( int  back_channel[2],
const std::string &  channel_id 
)
pure virtual

Implemented in ExternalQuotaManager, NoopQuotaManager, and PosixQuotaManager.

Referenced by quota::UnregisterListener().

Here is the caller graph for this function:

Member Data Documentation

std::map<shash::Md5, int> QuotaManager::back_channels_
protected

Hashes over the channel identifier mapped to writing ends of pipes.

Definition at line 94 of file quota.h.

Referenced by PosixQuotaManager::MainCommandServer(), ExternalQuotaManager::RegisterBackChannel(), ExternalQuotaManager::UnregisterBackChannel(), and ~QuotaManager().

const uint32_t QuotaManager::kProtocolRevision = 2
static

Quota manager protocol revision. Revision 1:

  • backchannel command 'R': release pinned files if possible Revision 2:
  • add kCleanupRate command

Definition at line 45 of file quota.h.

Referenced by PosixQuotaManager::MainCommandServer().

pthread_mutex_t* QuotaManager::lock_back_channels_
protected

Definition at line 95 of file quota.h.

Referenced by LockBackChannels(), QuotaManager(), UnlockBackChannels(), and ~QuotaManager().

uint32_t QuotaManager::protocol_revision_
protected

Protocol of the running cache manager instance. Needs to be figured out and set during initialization of concrete instances.

Definition at line 109 of file quota.h.

Referenced by PosixQuotaManager::Create(), PosixQuotaManager::CreateShared(), PosixQuotaManager::RegisterBackChannel(), and PosixQuotaManager::UnregisterBackChannel().


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