2016-11-17 20:07:59 +00:00
|
|
|
/***
|
|
|
|
* a thin wrapper over a datastore for getting and putting block objects
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __IPFS_BLOCKS_BLOCKSTORE_H__
|
2016-12-14 17:07:43 +00:00
|
|
|
#define __IPFS_BLOCKS_BLOCKSTORE_H__
|
|
|
|
|
|
|
|
#include "ipfs/cid/cid.h"
|
|
|
|
#include "ipfs/repo/fsrepo/fs_repo.h"
|
2016-11-17 20:07:59 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Delete a block based on its Cid
|
|
|
|
* @param cid the Cid to look for
|
|
|
|
* @param returns true(1) on success
|
|
|
|
*/
|
2016-11-30 16:46:41 +00:00
|
|
|
int ipfs_blockstore_delete(struct Cid* cid, struct FSRepo* fs_repo);
|
2016-11-17 20:07:59 +00:00
|
|
|
|
|
|
|
/***
|
|
|
|
* Determine if the Cid can be found
|
|
|
|
* @param cid the Cid to look for
|
|
|
|
* @returns true(1) if found
|
|
|
|
*/
|
2016-11-30 16:46:41 +00:00
|
|
|
int ipfs_blockstore_has(struct Cid* cid, struct FSRepo* fs_repo);
|
2016-11-17 20:07:59 +00:00
|
|
|
|
|
|
|
/***
|
|
|
|
* Find a block based on its Cid
|
|
|
|
* @param cid the Cid to look for
|
|
|
|
* @param block where to put the data to be returned
|
|
|
|
* @returns true(1) on success
|
|
|
|
*/
|
2016-12-14 17:07:43 +00:00
|
|
|
int ipfs_blockstore_get(const struct Cid* cid, struct Block** block, const struct FSRepo* fs_repo);
|
2016-11-17 20:07:59 +00:00
|
|
|
|
|
|
|
/***
|
|
|
|
* Put a block in the blockstore
|
|
|
|
* @param block the block to store
|
|
|
|
* @returns true(1) on success
|
|
|
|
*/
|
2016-12-14 17:07:43 +00:00
|
|
|
int ipfs_blockstore_put(struct Block* block, const struct FSRepo* fs_repo);
|
2016-11-17 20:07:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
#endif
|