rasdaman complete source
simplefilestorage.hh
Go to the documentation of this file.
1 /*
2 * This file is part of rasdaman community.
3 *
4 * Rasdaman community is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * Rasdaman community is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with rasdaman community. If not, see <http://www.gnu.org/licenses/>.
16 *
17 * Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
18 rasdaman GmbH.
19 *
20 * For more information please see <http://www.rasdaman.org>
21 * or contact Peter Baumann via <baumann@rasdaman.com>.
22 */
23 /*************************************************************
24  *
25  *
26  * PURPOSE:
27  * The interface used by the file storage modules.
28  *
29  *
30  * COMMENTS:
31  *
32  ************************************************************/
33 
34 #ifndef _SIMPLEFILESTORAGE_HH_
35 #define _SIMPLEFILESTORAGE_HH_
36 
37 #include <vector>
38 #include <string>
39 #include "ifilestorage.hh"
44 {
45 public:
46  SimpleFileStorage(const std::string& storage_path) throw (r_Error);
47  // Update the content of a blob. The blob should exist already.
48  void update(const char* data, r_Bytes size, int BlobId) throw (r_Error);
49  // Store the content of a new blob.
50  virtual void insert(const char* data, r_Bytes size, int BlobId) throw (r_Error);
51  // Retrive the content of a previously stored blob
52  virtual void retrieve(int BlobId, char** data, r_Bytes* size) throw (r_Error);
53  // Delete a previously stored blob.
54  virtual void remove(int BlobId) throw (r_Error);
55 
56  virtual ~SimpleFileStorage();
57 private:
58  // Given on BlobId will return the path where the blob should be stored.
59  // It's returned as a vector so that other functions can iterate trough it and check
60  // or create the directories on each level.
61  void getPath(int BlobId, std::vector<std::string>* path);
62  // Similar to the one above but returns the agregated path
63  void getPath(int BlobId, std::string* path);
64  std::string root_path;
65 
66 }; // class SimpleFileStorage
67 
68 #endif // _SIMPLEFILESTORAGE_HH_
SimpleFileStorage(const std::string &storage_path)
virtual void retrieve(int BlobId, char **data, r_Bytes *size)
virtual ~SimpleFileStorage()
Definition: simplefilestorage.hh:43
Definition: ifilestorage.hh:44
void update(const char *data, r_Bytes size, int BlobId)
virtual void insert(const char *data, r_Bytes size, int BlobId)