Extend the storage backends to support options

This commit is contained in:
Kai Krueger
2013-10-13 23:25:14 -06:00
parent 5941e23ced
commit e70bfafa20
13 changed files with 104 additions and 67 deletions

View File

@ -33,7 +33,7 @@ extern "C" {
class metaTile {
public:
metaTile(const std::string &xmlconfig, int x, int y, int z);
metaTile(const std::string &xmlconfig, const std::string &options, int x, int y, int z);
void clear();
void set(int x, int y, const std::string &data);
const std::string get(int x, int y);
@ -43,6 +43,7 @@ class metaTile {
private:
int x_, y_, z_;
std::string xmlconfig_;
std::string options_;
std::string tile[METATILE][METATILE];
static const int header_size = sizeof(struct meta_layout) + (sizeof(struct entry) * (METATILE * METATILE));

View File

@ -22,12 +22,12 @@ extern "C" {
};
struct storage_backend {
int (*tile_read)(struct storage_backend * store, const char *xmlconfig, int x, int y, int z, char *buf, size_t sz, int * compressed, char * err_msg);
struct stat_info (*tile_stat)(struct storage_backend * store, const char *xmlconfig, int x, int y, int z);
int (*metatile_write)(struct storage_backend * store, const char *xmlconfig, int x, int y, int z, const char *buf, int sz);
int (*tile_read)(struct storage_backend * store, const char *xmlconfig, const char *options, int x, int y, int z, char *buf, size_t sz, int * compressed, char * err_msg);
struct stat_info (*tile_stat)(struct storage_backend * store, const char *xmlconfig, const char *options, int x, int y, int z);
int (*metatile_write)(struct storage_backend * store, const char *xmlconfig, const char *options, int x, int y, int z, const char *buf, int sz);
int (*metatile_delete)(struct storage_backend * store, const char *xmlconfig, int x, int y, int z);
int (*metatile_expire)(struct storage_backend * store, const char *xmlconfig, int x, int y, int z);
char * (*tile_storage_id)(struct storage_backend * store, const char *xmlconfig, int x, int y, int z, char * string);
char * (*tile_storage_id)(struct storage_backend * store, const char *xmlconfig, const char *options, int x, int y, int z, char * string);
int (*close_storage)(struct storage_backend * store);
void * storage_ctx;