Implementation of MerkleDag get and put

Now saving and retrieving MerkleDags that contain data. Now need to work
with links and other types.
This commit is contained in:
jmjatlanta 2016-12-05 17:23:58 -05:00
parent 8a80d2afc7
commit da6490ac7f
14 changed files with 246 additions and 26 deletions

View file

@ -72,7 +72,7 @@ int config_path(char* config_root, char* extension, char* result, int max_len);
* @param num_bits_for_keypair number of bits for the key pair
* @returns true(1) on success, otherwise 0
*/
int ipfs_repo_config_init(struct RepoConfig* config, unsigned int num_bits_for_keypair, char* repo_path);
int ipfs_repo_config_init(struct RepoConfig* config, unsigned int num_bits_for_keypair, const char* repo_path);
/***
* Initialize memory for a RepoConfig struct

View file

@ -20,8 +20,10 @@ struct Datastore {
// function pointers for datastore operations
int (*datastore_open)(int argc, char** argv, struct Datastore* datastore);
int (*datastore_close)(struct Datastore* datastore);
int (*datastore_put)(const char* key, size_t key_size, unsigned char* data, size_t data_length, struct Datastore* datastore);
//int (*datastore_get)(const char* key, struct Block* block);
int (*datastore_put)(const unsigned char* key, size_t key_size, unsigned char* data, size_t data_length, const struct Datastore* datastore);
int (*datastore_put_block)(const struct Block* block, const struct Datastore* datastore);
int (*datastore_get)(const char* key, size_t key_size, unsigned char* data, size_t max_data_length, size_t* data_length, const struct Datastore* datastore);
int (*datastore_get_block)(const struct Cid* cid, struct Block** block, const struct Datastore* datastore);
// a handle to the datastore "context" used by the datastore
void* handle;
};
@ -33,7 +35,7 @@ struct Datastore {
* @param config_root the path to the root of IPFS
* @returns true(1) on success
*/
int ipfs_repo_config_datastore_init(struct Datastore* datastore, char* config_root);
int ipfs_repo_config_datastore_init(struct Datastore* datastore, const char* config_root);
/***
* initialize the structure of the datastore

View file

@ -48,7 +48,7 @@ int fs_repo_write_config_file(char* path, struct RepoConfig* config);
* @param repo the struct to allocate memory for
* @returns false(0) if something bad happened, otherwise true(1)
*/
int ipfs_repo_fsrepo_new(char* repo_path, struct RepoConfig* config, struct FSRepo** fs_repo);
int ipfs_repo_fsrepo_new(const char* repo_path, struct RepoConfig* config, struct FSRepo** fs_repo);
/***
* Free all resources used by this struct