X-Git-Url: http://git.vrable.net/?p=cumulus.git;a=blobdiff_plain;f=metadata.cc;h=2ae075190cf49afaed661fd53f66498843bb6a97;hp=71d7b7266bfb8cf13fc78ebb5635f080c9e9a082;hb=f38dd9bcb0caffd3fc9126b05788c936690e8288;hpb=013636b17f3e44f5ac4837750a3888999d35d2f8 diff --git a/metadata.cc b/metadata.cc index 71d7b72..2ae0751 100644 --- a/metadata.cc +++ b/metadata.cc @@ -1,12 +1,31 @@ -/* LBS: An LFS-inspired filesystem backup system - * Copyright (C) 2007-2008 Michael Vrable +/* Cumulus: Smart Filesystem Backup to Dumb Servers * - * Handling of metadata written to backup snapshots. This manages the writing + * Copyright (C) 2007-2008 The Regents of the University of California + * Written by Michael Vrable + * + * 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. + */ + +/* Handling of metadata written to backup snapshots. This manages the writing * of file metadata into new backup snapshots, including breaking the metadata * log apart across separate objects. Eventually this should include unified * handling of the statcache, and re-use of metadata between snapshots. */ +#include +#include #include #include #include @@ -79,7 +98,7 @@ static string encode_dict(const map& dict) string result; if (dict.find("name") != dict.end()) { - result += "name: " + dict.at("name") + "\n"; + result += "name: " + dict.find("name")->second + "\n"; } for (map::const_iterator i = dict.begin(); @@ -99,7 +118,7 @@ MetadataWriter::MetadataWriter(TarSegmentStore *store, { statcache_path = path; statcache_path += "/statcache2"; - if (snapshot_scheme != NULL) + if (snapshot_scheme != NULL && strlen(snapshot_scheme) > 0) statcache_path = statcache_path + "-" + snapshot_scheme; statcache_tmp_path = statcache_path + "." + snapshot_name; @@ -109,7 +128,7 @@ MetadataWriter::MetadataWriter(TarSegmentStore *store, if (statcache_out == NULL) { fprintf(stderr, "Error opening statcache %s: %m\n", statcache_tmp_path.c_str()); - throw IOException("Error opening statcache"); + fatal("Error opening statcache"); } old_metadata_eof = false;