c-ipfs/include/ipfs/repo/fsrepo/lmdb_datastore.h

44 lines
1.2 KiB
C
Raw Normal View History

#pragma once
#include "lmdb.h"
#include "libp2p/db/datastore.h"
static const char* DATASTORE_DB = "DATASTORE";
static const char* JOURNAL_DB = "JOURNAL";
struct lmdb_trans_cursor {
MDB_txn* transaction;
MDB_cursor* cursor;
};
/***
* Places the LMDB methods into the datastore's function pointers
* @param datastore the datastore to fill
* @returns true(1) on success;
*/
int repo_fsrepo_lmdb_cast(struct Datastore* datastore);
/**
* Open an lmdb database with the given parameters.
* Note: for now, the parameters are not used
* @param argc number of parameters in the following array
* @param argv an array of parameters
*/
int repo_fsrepro_lmdb_open(int argc, char** argv, struct Datastore* datastore);
/***
* Close an LMDB database
* NOTE: for now, argc and argv are not used
* @param argc number of parameters in the argv array
* @param argv parameters to be passed in
* @param datastore the datastore struct that contains information about the opened database
*/
2016-12-01 18:08:30 +00:00
int repo_fsrepo_lmdb_close(struct Datastore* datastore);
/***
* Creates the directory
* @param datastore contains the path that needs to be created
* @returns true(1) on success
*/
int repo_fsrepo_lmdb_create_directory(struct Datastore* datastore);