2016-12-14 17:07:43 +00:00
|
|
|
/**
|
|
|
|
* Helpers for testing
|
|
|
|
*/
|
|
|
|
|
2017-04-27 16:35:26 +00:00
|
|
|
/***
|
|
|
|
* Drop a repository by deleting the directory
|
|
|
|
* @param path the path of the repository
|
|
|
|
* @returns true(1) on success, false(0) otherwise
|
|
|
|
*/
|
|
|
|
int drop_repository(const char* path);
|
|
|
|
|
2016-12-05 18:11:22 +00:00
|
|
|
/**
|
|
|
|
* Create a new repository in the directory, erasing old one
|
|
|
|
* NOTE: base directory must already exist
|
|
|
|
*/
|
2017-04-13 14:31:58 +00:00
|
|
|
int drop_and_build_repository(const char* dir, int swarm_port, struct Libp2pVector* bootstrap_peers, char** peer_id);
|
2016-12-14 17:07:43 +00:00
|
|
|
|
|
|
|
int drop_build_and_open_repo(const char* path, struct FSRepo** fs_repo);
|
2017-03-19 12:47:19 +00:00
|
|
|
|
|
|
|
/***
|
|
|
|
* Helper to create a test file in the OS
|
|
|
|
* @pram fileName the resultant file name
|
|
|
|
* @param bytes the data that goes in the file
|
|
|
|
* @param num_bytes the size of the buffer
|
|
|
|
*/
|
|
|
|
int create_file(const char* fileName, unsigned char* bytes, size_t num_bytes);
|
|
|
|
|
|
|
|
/***
|
|
|
|
* Create a buffer with some bytes
|
|
|
|
* @param buffer where to put the bytes
|
|
|
|
* @param num_bytes how much to fill of the buffer
|
|
|
|
*/
|
|
|
|
int create_bytes(unsigned char* buffer, size_t num_bytes);
|