Added the ability to retrieve the file using directories
Files can be refered to directly using their hash, or the hash of their directory and the file name.
This commit is contained in:
parent
396dfc6abc
commit
c2fe60949e
11 changed files with 233 additions and 5 deletions
12
include/ipfs/importer/resolver.h
Normal file
12
include/ipfs/importer/resolver.h
Normal file
|
@ -0,0 +1,12 @@
|
|||
#pragma once
|
||||
|
||||
#include "ipfs/merkledag/node.h"
|
||||
|
||||
/**
|
||||
* Interogate the path and the current node, looking
|
||||
* for the desired node.
|
||||
* @param path the current path
|
||||
* @param from the current node (or NULL if it is the first call)
|
||||
* @returns what we are looking for, or NULL if it wasn't found
|
||||
*/
|
||||
struct Node* ipfs_resolver_get(const char* path, struct Node* from, const struct FSRepo* fs_repo);
|
|
@ -25,4 +25,13 @@ int ipfs_merkledag_add(struct Node* node, struct FSRepo* fs_repo, size_t* bytes_
|
|||
*/
|
||||
int ipfs_merkledag_get(const unsigned char* hash, size_t hash_size, struct Node** node, const struct FSRepo* fs_repo);
|
||||
|
||||
/***
|
||||
* Retrieves a node from the datastore based on the multihash
|
||||
* @param multihash the base58 encoded multihash (should start with Qm) as a null terminated string
|
||||
* @param node the node to be created
|
||||
* @param fs_repo the repository
|
||||
* @returns true(1) on success
|
||||
*/
|
||||
int ipfs_merkledag_get_by_multihash(const unsigned char* multihash, size_t multihash_length, struct Node** node, const struct FSRepo* fs_repo);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -142,6 +142,13 @@ int ipfs_node_new(struct Node** node);
|
|||
*/
|
||||
int ipfs_node_create_directory(struct Node** node);
|
||||
|
||||
/***
|
||||
* Determine if this node is actually a directory
|
||||
* @param node the node to examine
|
||||
* @returns true(1) if this node is a directory. Otherwise, false(0)
|
||||
*/
|
||||
int ipfs_node_is_directory(struct Node* node);
|
||||
|
||||
/**
|
||||
* sets the Cid into the struct element titled cached
|
||||
* @param node the node to work with
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue