CernVM-FS  2.9.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
StatisticsDatabase Class Reference

#include <statistics_database.h>

Inheritance diagram for StatisticsDatabase:
Collaboration diagram for StatisticsDatabase:

Public Member Functions

bool CreateEmptyDatabase ()
 
bool CheckSchemaCompatibility ()
 
bool LiveSchemaUpgradeIfNecessary ()
 
bool CompactDatabase () const
 
 ~StatisticsDatabase ()
 
bool StorePublishStatistics (const perf::Statistics *statistics, const std::string &start_time, const bool success)
 
bool StoreGCStatistics (const perf::Statistics *statistics, const std::string &start_time, const bool success)
 
bool UploadStatistics (upload::Spooler *spooler, std::string local_path="")
 
bool UploadStatistics (upload::AbstractUploader *uploader, std::string local_path="")
 
- Public Member Functions inherited from sqlite::Database< StatisticsDatabase >
bool IsEqualSchema (const float value, const float compare) const
 
bool BeginTransaction () const
 
bool CommitTransaction () const
 
GetProperty (const std::string &key) const
 
GetPropertyDefault (const std::string &key, const T default_value) const
 
bool SetProperty (const std::string &key, const T value)
 
bool HasProperty (const std::string &key) const
 
sqlite3 * sqlite_db () const
 
const std::string & filename () const
 
float schema_version () const
 
unsigned schema_revision () const
 
bool read_write () const
 
unsigned GetModifiedRowCount () const
 
double GetFreePageRatio () const
 
void GetMemStatistics (MemStatistics *stats) const
 
bool Vacuum () const
 
void PrintSqlError (const std::string &error_msg)
 
std::string GetLastErrorMsg () const
 
void TakeFileOwnership ()
 
void DropFileOwnership ()
 
bool OwnsFile () const
 
void EnforceSchema (float version, unsigned revision)
 

Static Public Member Functions

static StatisticsDatabaseOpenStandardDB (const std::string repo_name)
 
static void GetDBParams (const std::string &repo_name, std::string *path, uint32_t *days_to_keep)
 
static bool GcExtendedStats (const std::string &repo_name)
 
- Static Public Member Functions inherited from sqlite::Database< StatisticsDatabase >
static StatisticsDatabaseCreate (const std::string &filename)
 
static StatisticsDatabaseOpen (const std::string &filename, const OpenMode open_mode)
 

Public Attributes

unsigned int create_empty_db_calls
 
unsigned int check_compatibility_calls
 
unsigned int live_upgrade_calls
 
unsigned int compact_calls
 

Static Public Attributes

static float kLatestSchema = 1.0f
 
static unsigned kLatestSchemaRevision = 3
 
static const float kLatestCompatibleSchema = 1.0f
 
static bool compacting_fails = false
 
static unsigned int instances = 0
 
- Static Public Attributes inherited from sqlite::Database< StatisticsDatabase >
static const float kSchemaEpsilon
 

Protected Member Functions

 StatisticsDatabase (const std::string &filename, const OpenMode open_mode)
 
bool StoreEntry (const std::string &insert_statement)
 
bool Prune (uint32_t days)
 
- Protected Member Functions inherited from sqlite::Database< StatisticsDatabase >
 Database (const std::string &filename, const OpenMode open_mode)
 
bool Initialize ()
 
bool CreatePropertiesTable ()
 
bool PrepareCommonQueries ()
 
bool OpenDatabase (const int sqlite_open_flags)
 
bool Configure ()
 
bool FileReadAhead ()
 
void ReadSchemaRevision ()
 
bool StoreSchemaRevision ()
 
void set_schema_version (const float ver)
 
void set_schema_revision (const unsigned rev)
 

Protected Attributes

std::string repo_name_
 

Static Private Attributes

static const uint32_t kDefaultDaysToKeep = 365
 

Friends

class sqlite::Database< StatisticsDatabase >
 

Additional Inherited Members

- Public Types inherited from sqlite::Database< StatisticsDatabase >
enum  OpenMode
 

Detailed Description

Definition at line 20 of file statistics_database.h.

Constructor & Destructor Documentation

StatisticsDatabase::StatisticsDatabase ( const std::string &  filename,
const OpenMode  open_mode 
)
protected

Definition at line 616 of file statistics_database.cc.

StatisticsDatabase::~StatisticsDatabase ( )

Definition at line 375 of file statistics_database.cc.

Member Function Documentation

bool StatisticsDatabase::CheckSchemaCompatibility ( )

Definition at line 272 of file statistics_database.cc.

Here is the call graph for this function:

bool StatisticsDatabase::CompactDatabase ( ) const

Definition at line 369 of file statistics_database.cc.

bool StatisticsDatabase::CreateEmptyDatabase ( )

Definition at line 233 of file statistics_database.cc.

Here is the call graph for this function:

bool StatisticsDatabase::GcExtendedStats ( const std::string &  repo_name)
static

Check if the CVMFS_EXTENDED_GC_STATS is ON or not

Parameters
repo_namefully qualified name of the repository
Returns
true if CVMFS_EXTENDED_GC_STATS is ON, false otherwise

Check if the CVMFS_EXTENDED_GC_STATS is ON or not

Parameters
repo_namefully qualified name of the repository
Returns
true if CVMFS_EXTENDED_GC_STATS is ON

Definition at line 592 of file statistics_database.cc.

Referenced by swissknife::CommandGc::Main(), and anonymous_namespace{statistics_database.cc}::PrepareStatementIntoGc().

Here is the call graph for this function:

Here is the caller graph for this function:

void StatisticsDatabase::GetDBParams ( const std::string &  repo_name,
std::string *  path,
uint32_t *  days_to_keep 
)
static

Get the parameters for the database file user can specify them in the server.conf DB file path: key: CVMFS_STATISTICS_DB default: /var/spool/cvmfs/$repo_name/stats.db maximum age (in days) of records to keep when pruning (zero means keep forever) key: CVMFS_STATS_DB_DAYS_TO_KEEP deafult: 365

Parameters
repo_nameFully qualified name of the repository
pathpointer to save the db path in
days_to_keeppointer to save the number of days

Definition at line 531 of file statistics_database.cc.

Referenced by OpenStandardDB().

Here is the call graph for this function:

Here is the caller graph for this function:

bool StatisticsDatabase::LiveSchemaUpgradeIfNecessary ( )

Definition at line 279 of file statistics_database.cc.

Here is the call graph for this function:

StatisticsDatabase * StatisticsDatabase::OpenStandardDB ( const std::string  repo_name)
static

Opens or creates a statistics DB in standard path for repo_name repository

Returns
StatisticsDatabase pointer on success, NULL otherwise

Definition at line 380 of file statistics_database.cc.

Referenced by swissknife::CommandGc::Main(), swissknife::Ingest::Main(), swissknife::CommandSync::Main(), and receiver::CommitProcessor::Process().

Here is the call graph for this function:

Here is the caller graph for this function:

bool StatisticsDatabase::Prune ( uint32_t  days)
protected

Prune the statistics DB (delete records older than certain threshhold)

Parameters
daysnumber of days of records to keep, 0 means no pruning
Returns
true on success, false otherwise

Definition at line 454 of file statistics_database.cc.

Referenced by OpenStandardDB().

Here is the call graph for this function:

Here is the caller graph for this function:

bool StatisticsDatabase::StoreEntry ( const std::string &  insert_statement)
protected

Definition at line 438 of file statistics_database.cc.

Referenced by StoreGCStatistics(), and StorePublishStatistics().

Here is the call graph for this function:

Here is the caller graph for this function:

bool StatisticsDatabase::StoreGCStatistics ( const perf::Statistics statistics,
const std::string &  start_time,
const bool  success 
)

Store a publish entry into the database

Returns
true on success, false otherwise

Definition at line 425 of file statistics_database.cc.

Referenced by swissknife::CommandGc::Main().

Here is the call graph for this function:

Here is the caller graph for this function:

bool StatisticsDatabase::StorePublishStatistics ( const perf::Statistics statistics,
const std::string &  start_time,
const bool  success 
)

Store a publish entry into the database

Returns
true on success, false otherwise

Definition at line 413 of file statistics_database.cc.

Referenced by swissknife::Ingest::Main(), swissknife::CommandSync::Main(), and receiver::CommitProcessor::Process().

Here is the call graph for this function:

Here is the caller graph for this function:

bool StatisticsDatabase::UploadStatistics ( upload::Spooler *  spooler,
std::string  local_path = "" 
)

Upload the statistics database into the storage backend configured in spooler. This is a convenience method useful when only the spooler (and not the underlying) uploader) is available to the developer.

Returns
true on success, false otherwise

Definition at line 486 of file statistics_database.cc.

Referenced by swissknife::CommandGc::Main(), swissknife::Ingest::Main(), swissknife::CommandSync::Main(), and receiver::CommitProcessor::Process().

Here is the call graph for this function:

Here is the caller graph for this function:

bool StatisticsDatabase::UploadStatistics ( upload::AbstractUploader uploader,
std::string  local_path = "" 
)

Upload the statistics database into the storage backend configured in uploader.

Returns
true on success, false otherwise

Definition at line 511 of file statistics_database.cc.

Here is the call graph for this function:

Friends And Related Function Documentation

friend class sqlite::Database< StatisticsDatabase >
friend

Definition at line 22 of file statistics_database.h.

Member Data Documentation

unsigned int StatisticsDatabase::check_compatibility_calls

Definition at line 46 of file statistics_database.h.

Referenced by CheckSchemaCompatibility().

unsigned int StatisticsDatabase::compact_calls
mutable

Definition at line 48 of file statistics_database.h.

Referenced by CompactDatabase().

bool StatisticsDatabase::compacting_fails = false
static

Definition at line 43 of file statistics_database.h.

Referenced by CompactDatabase().

unsigned int StatisticsDatabase::create_empty_db_calls

Definition at line 45 of file statistics_database.h.

Referenced by CreateEmptyDatabase().

unsigned int StatisticsDatabase::instances = 0
static

Definition at line 44 of file statistics_database.h.

Referenced by StatisticsDatabase(), and ~StatisticsDatabase().

const uint32_t StatisticsDatabase::kDefaultDaysToKeep = 365
staticprivate

Definition at line 130 of file statistics_database.h.

Referenced by GetDBParams().

const float StatisticsDatabase::kLatestCompatibleSchema = 1.0f
static

This file is part of the CernVM File System.

Definition at line 42 of file statistics_database.h.

Referenced by CheckSchemaCompatibility().

float StatisticsDatabase::kLatestSchema = 1.0f
static

Definition at line 39 of file statistics_database.h.

Referenced by LiveSchemaUpgradeIfNecessary().

unsigned StatisticsDatabase::kLatestSchemaRevision = 3
static

Definition at line 41 of file statistics_database.h.

unsigned int StatisticsDatabase::live_upgrade_calls

Definition at line 47 of file statistics_database.h.

Referenced by LiveSchemaUpgradeIfNecessary().

std::string StatisticsDatabase::repo_name_
protected

Definition at line 26 of file statistics_database.h.

Referenced by OpenStandardDB(), and StoreGCStatistics().


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