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

#include <history.h>

Inheritance diagram for history::History:

Classes

struct  Branch
 
struct  Tag
 

Public Member Functions

virtual ~History ()
 
virtual bool IsWritable () const =0
 
virtual unsigned GetNumberOfTags () const =0
 
virtual bool BeginTransaction () const =0
 
virtual bool CommitTransaction () const =0
 
virtual bool SetPreviousRevision (const shash::Any &history_hash)=0
 
virtual shash::Any previous_revision () const =0
 
virtual bool Insert (const Tag &tag)=0
 
virtual bool Remove (const std::string &name)=0
 
virtual bool Exists (const std::string &name) const =0
 
virtual bool GetByName (const std::string &name, Tag *tag) const =0
 
virtual bool GetByDate (const time_t timestamp, Tag *tag) const =0
 
virtual bool List (std::vector< Tag > *tags) const =0
 
virtual bool GetBranchHead (const std::string &branch_name, Tag *tag) const =0
 
virtual bool ExistsBranch (const std::string &branch_name) const =0
 
virtual bool InsertBranch (const Branch &branch)=0
 
virtual bool PruneBranches ()=0
 
virtual bool ListBranches (std::vector< Branch > *branches) const =0
 
virtual bool ListRecycleBin (std::vector< shash::Any > *hashes) const =0
 
virtual bool EmptyRecycleBin ()=0
 
virtual bool Rollback (const Tag &updated_target_tag)=0
 
virtual bool ListTagsAffectedByRollback (const std::string &target_tag_name, std::vector< Tag > *tags) const =0
 
virtual bool GetHashes (std::vector< shash::Any > *hashes) const =0
 
virtual void TakeDatabaseFileOwnership ()=0
 
virtual void DropDatabaseFileOwnership ()=0
 
virtual bool OwnsDatabaseFile () const =0
 
virtual bool Vacuum ()=0
 
const std::string & fqrn () const
 

Protected Member Functions

void set_fqrn (const std::string &fqrn)
 

Private Attributes

std::string fqrn_
 

Detailed Description

This is the abstract base class for repository history. It maintains a list of named snapshots in a Tag structure.

Each tag contains meta information (i.e. description, date) and points to one specific catalog revision (revision, root catalog hash). Furthermore tags are associated with one branch. This can be used in clients to selectively apply file system snapshots of a specific branch.

Note: The public interface of the History class is virtual, in order to over- write it in a testing environment. As we are dealing with an SQLite database anyway, the overhead of this should not matter. It could be implemented using CRTP if necessary, but would require com- plex code to do so.

Definition at line 33 of file history.h.

Constructor & Destructor Documentation

virtual history::History::~History ( )
inlinevirtual

Definition at line 102 of file history.h.

Member Function Documentation

virtual bool history::History::BeginTransaction ( ) const
pure virtual

Opens a new database transaction in the underlying SQLite database This can greatly improve performance when used before inserting or removing multiple tags.

Implemented in history::SqliteHistory.

virtual bool history::History::CommitTransaction ( ) const
pure virtual

Closes a transaction (see BeginTransaction())

Implemented in history::SqliteHistory.

virtual void history::History::DropDatabaseFileOwnership ( )
pure virtual

Implemented in history::SqliteHistory.

virtual bool history::History::EmptyRecycleBin ( )
pure virtual

Implemented in history::SqliteHistory.

virtual bool history::History::Exists ( const std::string &  name) const
pure virtual

Implemented in history::SqliteHistory.

virtual bool history::History::ExistsBranch ( const std::string &  branch_name) const
pure virtual

Implemented in history::SqliteHistory.

const std::string& history::History::fqrn ( ) const
inline

Definition at line 193 of file history.h.

Referenced by swissknife::Assistant::GetHistory(), swissknife::CommandTag::GetHistory(), history::SqliteHistory::Open(), and set_fqrn().

Here is the caller graph for this function:

virtual bool history::History::GetBranchHead ( const std::string &  branch_name,
Tag tag 
) const
pure virtual

Implemented in history::SqliteHistory.

virtual bool history::History::GetByDate ( const time_t  timestamp,
Tag tag 
) const
pure virtual

Implemented in history::SqliteHistory.

virtual bool history::History::GetByName ( const std::string &  name,
Tag tag 
) const
pure virtual

Implemented in history::SqliteHistory.

Referenced by anonymous_namespace{repository_diff.cc}::GetTag().

Here is the caller graph for this function:

virtual bool history::History::GetHashes ( std::vector< shash::Any > *  hashes) const
pure virtual

Provides a list of all referenced catalog hashes in this History. The hashes will be ordered by their timestamp in ascending order.

Parameters
hashespointer to the result vector to be filled

Implemented in history::SqliteHistory.

virtual unsigned history::History::GetNumberOfTags ( ) const
pure virtual

Implemented in history::SqliteHistory.

virtual bool history::History::Insert ( const Tag tag)
pure virtual

Implemented in history::SqliteHistory.

virtual bool history::History::InsertBranch ( const Branch branch)
pure virtual

Implemented in history::SqliteHistory.

virtual bool history::History::IsWritable ( ) const
pure virtual

Implemented in history::SqliteHistory.

virtual bool history::History::List ( std::vector< Tag > *  tags) const
pure virtual
virtual bool history::History::ListBranches ( std::vector< Branch > *  branches) const
pure virtual

Implemented in history::SqliteHistory.

Referenced by swissknife::CommandCheck::InspectHistory().

Here is the caller graph for this function:

virtual bool history::History::ListRecycleBin ( std::vector< shash::Any > *  hashes) const
pure virtual

The recycle bin operations are deprecated, only emptying and listing are preserved for migration and testing.

Implemented in history::SqliteHistory.

virtual bool history::History::ListTagsAffectedByRollback ( const std::string &  target_tag_name,
std::vector< Tag > *  tags 
) const
pure virtual

Lists the tags that would be deleted by a rollback to the tag specified.

Note: This doesn't change the database but is mainly used for sanity checks and user output.

Parameters
target_tag_namethe tag name for the planned rollback
tagspointer to the result tag list to be filled
Returns
true on success

Implemented in history::SqliteHistory.

virtual bool history::History::OwnsDatabaseFile ( ) const
pure virtual

Implemented in history::SqliteHistory.

virtual shash::Any history::History::previous_revision ( ) const
pure virtual

Implemented in history::SqliteHistory.

virtual bool history::History::PruneBranches ( )
pure virtual

When removing tags, branches can become abandoned. Remove abandoned branches and redirect the parent pointer of their child branches.

Implemented in history::SqliteHistory.

virtual bool history::History::Remove ( const std::string &  name)
pure virtual

Implemented in history::SqliteHistory.

virtual bool history::History::Rollback ( const Tag updated_target_tag)
pure virtual

Rolls back the history to the provided target tag and deletes all tags in between. Works on the default branch only.

Note: this assumes that the provided target tag was already updated with the republished root catalog information.

Parameters
updated_target_tagthe tag to be rolled back to (updated: see Note)
Returns
true on success

Implemented in history::SqliteHistory.

void history::History::set_fqrn ( const std::string &  fqrn)
inlineprotected

Definition at line 196 of file history.h.

Here is the call graph for this function:

virtual bool history::History::SetPreviousRevision ( const shash::Any history_hash)
pure virtual

Sets the internal pointer to the previous revision of this History file. Note: This must be handled by the user code.

Parameters
history_hashthe content hash of the previous revision

Implemented in history::SqliteHistory.

virtual void history::History::TakeDatabaseFileOwnership ( )
pure virtual

Implemented in history::SqliteHistory.

Referenced by swissknife::Assistant::GetHistory().

Here is the caller graph for this function:

virtual bool history::History::Vacuum ( )
pure virtual

Implemented in history::SqliteHistory.

Member Data Documentation

std::string history::History::fqrn_
private

Definition at line 199 of file history.h.

Referenced by fqrn(), and set_fqrn().


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