X-Git-Url: http://git.vrable.net/?a=blobdiff_plain;f=localdb.h;h=4e1292f8008cfc238b26bbba43f761c7ce1905ee;hb=ca9732d7fe1cc7023f5642fd50774982bb430d64;hp=6d28cd827435ea1143d7612471ed34e9c0391570;hpb=1048a6510710acb5bef352d0acb2dd13ecce0e01;p=cumulus.git diff --git a/localdb.h b/localdb.h index 6d28cd8..4e1292f 100644 --- a/localdb.h +++ b/localdb.h @@ -1,7 +1,23 @@ -/* LBS: An LFS-inspired filesystem backup system - * Copyright (C) 2007 Michael Vrable +/* Cumulus: Efficient Filesystem Backup to the Cloud + * Copyright (C) 2007-2008 The Cumulus Developers + * See the AUTHORS file for a list of contributors. * - * When creating backup snapshots, maintain a local database of data blocks and + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +/* When creating backup snapshots, maintain a local database of data blocks and * checksums, in addition to the data contents (which may be stored remotely). * This database is consulted when attempting to build incremental snapshots, * as it says which objects can be reused. @@ -15,6 +31,7 @@ #include +#include #include #include "ref.h" @@ -24,17 +41,27 @@ public: void Open(const char *path, const char *snapshot_name, const char *snapshot_scheme); void Close(); - void StoreObject(const ObjectReference& ref, - const std::string &checksum, int64_t size, double age); + void StoreObject(const ObjectReference& ref, double age); ObjectReference FindObject(const std::string &checksum, int64_t size); - bool IsOldObject(const std::string &checksum, int64_t size, double *age); + bool IsOldObject(const std::string &checksum, int64_t size, double *age, + int *group); bool IsAvailable(const ObjectReference &ref); void UseObject(const ObjectReference& ref); - void SetSegmentChecksum(const std::string &segment, const std::string &path, - const std::string &checksum); - bool GetSegmentChecksum(const std::string &segment, - std::string *seg_path, std::string *seg_checksum); + std::set GetUsedSegments(); + void SetSegmentMetadata(const std::string &segment, const std::string &path, + const std::string &checksum, + const std::string &type, int data_size, + int disk_size); + std::map GetSegmentMetadata( + const std::string &segment); + + bool LoadChunkSignatures(ObjectReference ref, + void **buf, size_t *len, + std::string *algorithm); + void StoreChunkSignatures(ObjectReference ref, + const void *buf, size_t len, + const std::string &algorithm); private: sqlite3 *db; int64_t snapshotid;