CernVM-FS
2.12.0
|
#include <statistics_database.h>
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 |
T | GetProperty (const std::string &key) const |
T | 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 StatisticsDatabase * | OpenStandardDB (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 StatisticsDatabase * | Create (const std::string &filename) |
static StatisticsDatabase * | Open (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 = 4 |
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 |
Definition at line 20 of file statistics_database.h.
|
protected |
Definition at line 649 of file statistics_database.cc.
StatisticsDatabase::~StatisticsDatabase | ( | ) |
Definition at line 408 of file statistics_database.cc.
bool StatisticsDatabase::CheckSchemaCompatibility | ( | ) |
bool StatisticsDatabase::CompactDatabase | ( | ) | const |
Definition at line 402 of file statistics_database.cc.
bool StatisticsDatabase::CreateEmptyDatabase | ( | ) |
|
static |
Check if the CVMFS_EXTENDED_GC_STATS is ON or not
repo_name | fully qualified name of the repository |
Check if the CVMFS_EXTENDED_GC_STATS is ON or not
repo_name | fully qualified name of the repository |
Definition at line 625 of file statistics_database.cc.
Referenced by swissknife::CommandGc::Main(), and anonymous_namespace{statistics_database.cc}::PrepareStatementIntoGc().
|
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 default: 365
repo_name | Fully qualified name of the repository |
path | pointer to save the db path in |
days_to_keep | pointer to save the number of days |
Definition at line 564 of file statistics_database.cc.
Referenced by OpenStandardDB().
bool StatisticsDatabase::LiveSchemaUpgradeIfNecessary | ( | ) |
|
static |
Opens or creates a statistics DB in standard path for repo_name repository
Definition at line 413 of file statistics_database.cc.
Referenced by swissknife::CommandGc::Main(), swissknife::Ingest::Main(), swissknife::CommandSync::Main(), and receiver::CommitProcessor::Process().
|
protected |
Prune the statistics DB (delete records older than certain threshold)
days | number of days of records to keep, 0 means no pruning |
Definition at line 487 of file statistics_database.cc.
Referenced by OpenStandardDB().
|
protected |
Definition at line 471 of file statistics_database.cc.
Referenced by StoreGCStatistics(), and StorePublishStatistics().
bool StatisticsDatabase::StoreGCStatistics | ( | const perf::Statistics * | statistics, |
const std::string & | start_time, | ||
const bool | success | ||
) |
Store a publish entry into the database
Definition at line 458 of file statistics_database.cc.
Referenced by swissknife::CommandGc::Main().
bool StatisticsDatabase::StorePublishStatistics | ( | const perf::Statistics * | statistics, |
const std::string & | start_time, | ||
const bool | success | ||
) |
Store a publish entry into the database
Definition at line 446 of file statistics_database.cc.
Referenced by swissknife::Ingest::Main(), swissknife::CommandSync::Main(), and receiver::CommitProcessor::Process().
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.
Definition at line 519 of file statistics_database.cc.
Referenced by swissknife::CommandGc::Main(), swissknife::Ingest::Main(), swissknife::CommandSync::Main(), and receiver::CommitProcessor::Process().
bool StatisticsDatabase::UploadStatistics | ( | upload::AbstractUploader * | uploader, |
std::string | local_path = "" |
||
) |
Upload the statistics database into the storage backend configured in uploader.
Definition at line 544 of file statistics_database.cc.
|
friend |
Definition at line 22 of file statistics_database.h.
unsigned int StatisticsDatabase::check_compatibility_calls |
Definition at line 46 of file statistics_database.h.
Referenced by CheckSchemaCompatibility().
|
mutable |
Definition at line 48 of file statistics_database.h.
Referenced by CompactDatabase().
|
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().
|
static |
Definition at line 44 of file statistics_database.h.
Referenced by StatisticsDatabase(), and ~StatisticsDatabase().
|
staticprivate |
Definition at line 130 of file statistics_database.h.
Referenced by GetDBParams().
|
static |
This file is part of the CernVM File System.
Definition at line 42 of file statistics_database.h.
Referenced by CheckSchemaCompatibility().
|
static |
Definition at line 39 of file statistics_database.h.
Referenced by LiveSchemaUpgradeIfNecessary().
|
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().
|
protected |
Definition at line 26 of file statistics_database.h.
Referenced by OpenStandardDB(), and StoreGCStatistics().