19 if (NULL == reflog || !reflog->
OpenDatabase(database_path)) {
25 "opened Reflog database '%s' for repository '%s'",
26 database_path.c_str(), reflog->
fqrn().c_str());
33 const std::string &repo_name) {
35 if (NULL == reflog || !reflog->
CreateDatabase(database_path, repo_name)) {
42 database_path.c_str(), repo_name.c_str());
48 int fd = open(path.c_str(), O_RDONLY);
69 std::string hex_hash = value.
ToString();
70 bool retval =
SafeWrite(fd, hex_hash.data(), hex_hash.length());
81 const std::string &repo_name) {
84 if (!database_.IsValid() || !database_->InsertInitialValues(repo_name)) {
86 "failed to initialize empty database '%s'",
87 database_path.c_str());
159 std::vector<shash::Any> *hashes)
const
161 return ListOlderThan(type, static_cast<uint64_t>(-1), hashes);
168 std::vector<shash::Any> *hashes)
const
230 uint64_t *timestamp)
const
262 const bool fetching =
278 uint64_t *timestamp)
const
323 const std::string &database_path,
326 bool retval =
HashFile(database_path, hash_reflog);
bool ContainsReference(const shash::Any &hash, const SqlReflog::ReferenceType type) const
void TakeDatabaseFileOwnership()
std::string database_file() const
bool ContainsHistory(const shash::Any &history) const
const manifest::Manifest * manifest() const
bool AddHistory(const shash::Any &history)
UniquePtr< ReflogDatabase > database_
bool GetCatalogTimestamp(const shash::Any &catalog, uint64_t *timestamp) const
UniquePtr< SqlListReferences > list_references_
bool HashFile(const std::string &filename, Any *any_digest)
static const std::string kFqrnKey
const int kDefaultFileMode
static bool ReadChecksum(const std::string &path, shash::Any *checksum)
string Trim(const string &raw, bool trim_newline)
const char kSuffixCertificate
std::string ToString(const bool with_suffix=false) const
const history::History * history() const
bool AddReference(const shash::Any &hash, const SqlReflog::ReferenceType type)
bool SafeWrite(int fd, const void *buf, size_t nbyte)
assert((mem||(size==0))&&"Out Of Memory")
bool AddCatalog(const shash::Any &catalog)
static Reflog * Create(const std::string &database_path, const std::string &repo_name)
static ReflogDatabase * Open(const std::string &filename, const OpenMode open_mode)
bool ContainsMetainfo(const shash::Any &metainfo) const
UniquePtr< SqlRemoveReference > remove_reference_
static Reflog * Open(const std::string &database_path)
bool OpenDatabase(const std::string &database_path)
bool AddMetainfo(const shash::Any &metainfo)
bool Remove(const shash::Any &hash)
const char kSuffixCatalog
UniquePtr< SqlCountReferences > count_references_
bool List(SqlReflog::ReferenceType type, std::vector< shash::Any > *hashes) const
static void HashDatabase(const std::string &database_path, shash::Any *hash_reflog)
manifest::Reflog * reflog
bool GetReferenceTimestamp(const shash::Any &hash, const SqlReflog::ReferenceType type, uint64_t *timestamp) const
const char kSuffixMetainfo
bool ListOlderThan(SqlReflog::ReferenceType type, uint64_t timestamp, std::vector< shash::Any > *hashes) const
void DropDatabaseFileOwnership()
const char kSuffixHistory
bool AddCertificate(const shash::Any &certificate)
bool GetLineFd(const int fd, std::string *line)
UniquePtr< SqlInsertReference > insert_reference_
bool ContainsCatalog(const shash::Any &catalog) const
Any MkFromHexPtr(const HexPtr hex, const char suffix)
UniquePtr< SqlContainsReference > contains_reference_
static bool WriteChecksum(const std::string &path, const shash::Any &value)
bool ContainsCertificate(const shash::Any &certificate) const
static ReflogDatabase * Create(const std::string &filename)
bool CreateDatabase(const std::string &database_path, const std::string &repo_name)
UniquePtr< SqlGetTimestamp > get_timestamp_
CVMFS_EXPORT void LogCvmfs(const LogSource source, const int mask, const char *format,...)