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

#include <nfs_maps_sqlite.h>

Inheritance diagram for NfsMapsSqlite:
Collaboration diagram for NfsMapsSqlite:

Classes

struct  BusyHandlerInfo
 

Public Member Functions

virtual ~NfsMapsSqlite ()
 
virtual uint64_t GetInode (const PathString &path)
 
virtual bool GetPath (const uint64_t inode, PathString *path)
 
- Public Member Functions inherited from NfsMaps
virtual ~NfsMaps ()
 
virtual void SetInodeResidue (unsigned residue_class, unsigned remainder)
 
virtual void Spawn ()
 
virtual std::string GetStatistics ()
 

Static Public Member Functions

static NfsMapsSqliteCreate (const std::string &db_dir, const uint64_t root_inode, const bool rebuild, perf::Statistics *statistics_)
 

Private Member Functions

 NfsMapsSqlite ()
 
uint64_t FindInode (const PathString &path)
 
uint64_t IssueInode (const PathString &path)
 
uint64_t RetryGetInode (const PathString &path, int attempt)
 

Static Private Member Functions

static int BusyHandler (void *data, int attempt)
 

Private Attributes

sqlite3 * db_
 
sqlite3_stmt * stmt_get_path_
 
sqlite3_stmt * stmt_get_inode_
 
sqlite3_stmt * stmt_add_
 
pthread_mutex_t * lock_
 
BusyHandlerInfo busy_handler_info_
 
perf::Countern_db_seq_
 
perf::Countern_db_added_
 
perf::Countern_db_path_found_
 
perf::Countern_db_inode_found_
 

Static Private Attributes

static const unsigned kMaxDBSqlLen = 128
 
static const char * kSqlCreateTable
 
static const char * kSqlAddRoot
 
static const char * kSqlAddInode
 
static const char * kSqlGetInode
 
static const char * kSqlGetPath
 

Detailed Description

Definition at line 24 of file nfs_maps_sqlite.h.

Constructor & Destructor Documentation

NfsMapsSqlite::~NfsMapsSqlite ( )
virtual

Definition at line 312 of file nfs_maps_sqlite.cc.

NfsMapsSqlite::NfsMapsSqlite ( )
private

Definition at line 295 of file nfs_maps_sqlite.cc.

Here is the call graph for this function:

Member Function Documentation

int NfsMapsSqlite::BusyHandler ( void *  data,
int  attempt 
)
staticprivate

Definition at line 50 of file nfs_maps_sqlite.cc.

Here is the call graph for this function:

NfsMapsSqlite * NfsMapsSqlite::Create ( const std::string &  db_dir,
const uint64_t  root_inode,
const bool  rebuild,
perf::Statistics statistics_ 
)
static

Definition at line 76 of file nfs_maps_sqlite.cc.

Referenced by FileSystem::SetupNfsMaps().

Here is the call graph for this function:

Here is the caller graph for this function:

uint64_t NfsMapsSqlite::FindInode ( const PathString path)
private

Finds an inode by path

Returns
inode number, 0 if path not found

Definition at line 172 of file nfs_maps_sqlite.cc.

Referenced by Create().

Here is the call graph for this function:

Here is the caller graph for this function:

uint64_t NfsMapsSqlite::GetInode ( const PathString path)
virtual

Finds the inode for path or issues a new inode.

Implements NfsMaps.

Definition at line 260 of file nfs_maps_sqlite.cc.

bool NfsMapsSqlite::GetPath ( const uint64_t  inode,
PathString path 
)
virtual

Finds the path that belongs to an inode. This must be successful. The inode input comes from the file system, i.e. it must have been issued before.

Returns
false if not found

Implements NfsMaps.

Definition at line 271 of file nfs_maps_sqlite.cc.

Here is the call graph for this function:

uint64_t NfsMapsSqlite::IssueInode ( const PathString path)
private

Adds a new inode by path

Returns
New inode number, 0 on error

Definition at line 200 of file nfs_maps_sqlite.cc.

Here is the call graph for this function:

uint64_t NfsMapsSqlite::RetryGetInode ( const PathString path,
int  attempt 
)
private

Definition at line 230 of file nfs_maps_sqlite.cc.

Here is the call graph for this function:

Member Data Documentation

BusyHandlerInfo NfsMapsSqlite::busy_handler_info_
private

Definition at line 71 of file nfs_maps_sqlite.h.

Referenced by Create().

sqlite3* NfsMapsSqlite::db_
private

Definition at line 65 of file nfs_maps_sqlite.h.

Referenced by Create(), and ~NfsMapsSqlite().

const unsigned NfsMapsSqlite::kMaxDBSqlLen = 128
staticprivate

Max length of the sql statements

Definition at line 40 of file nfs_maps_sqlite.h.

const char * NfsMapsSqlite::kSqlAddInode
staticprivate
Initial value:
=
"INSERT INTO inodes VALUES (?);"

Definition at line 43 of file nfs_maps_sqlite.h.

const char * NfsMapsSqlite::kSqlAddRoot
staticprivate
Initial value:
=
"INSERT INTO inodes (rowid, path) VALUES (?, \"\");"

Definition at line 42 of file nfs_maps_sqlite.h.

const char * NfsMapsSqlite::kSqlCreateTable
staticprivate
Initial value:
=
"CREATE TABLE IF NOT EXISTS inodes (path TEXT PRIMARY KEY);"

Definition at line 41 of file nfs_maps_sqlite.h.

const char * NfsMapsSqlite::kSqlGetInode
staticprivate
Initial value:
=
"SELECT rowid FROM inodes where path = ?;"

Definition at line 44 of file nfs_maps_sqlite.h.

const char * NfsMapsSqlite::kSqlGetPath
staticprivate
Initial value:
=
"SELECT path FROM inodes where rowid = ?;"

Definition at line 45 of file nfs_maps_sqlite.h.

pthread_mutex_t* NfsMapsSqlite::lock_
private

Definition at line 69 of file nfs_maps_sqlite.h.

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

perf::Counter* NfsMapsSqlite::n_db_added_
private

Definition at line 74 of file nfs_maps_sqlite.h.

Referenced by Create().

perf::Counter* NfsMapsSqlite::n_db_inode_found_
private

Definition at line 76 of file nfs_maps_sqlite.h.

Referenced by Create().

perf::Counter* NfsMapsSqlite::n_db_path_found_
private

Definition at line 75 of file nfs_maps_sqlite.h.

Referenced by Create().

perf::Counter* NfsMapsSqlite::n_db_seq_
private

Definition at line 73 of file nfs_maps_sqlite.h.

Referenced by Create().

sqlite3_stmt* NfsMapsSqlite::stmt_add_
private

Definition at line 68 of file nfs_maps_sqlite.h.

Referenced by Create(), and ~NfsMapsSqlite().

sqlite3_stmt* NfsMapsSqlite::stmt_get_inode_
private

Definition at line 67 of file nfs_maps_sqlite.h.

Referenced by Create(), and ~NfsMapsSqlite().

sqlite3_stmt* NfsMapsSqlite::stmt_get_path_
private

Definition at line 66 of file nfs_maps_sqlite.h.

Referenced by Create(), and ~NfsMapsSqlite().


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