MTREE_BUILD(3)

NAME
mtree_build - build a merkle tree from base data

LIBRARY
Librecast library (liblibrecast, -llibrecast)

SYNOPSIS
#include <librecast/mtree.h>

int mtree_build(mtree_t *tree, void * const data, q_t *q);

Compile and link with -llibrecast.

DESCRIPTION
The mtree_build function builds a merkle tree tree which was previously initialized with mtree_init(3) from the base data pointed to by data.

If q is not NULL, it must point to a queue q_t structure previously initialized with q_init(3). This queue will have jobs enqueued to build the tree. This is normally used in conjunction with a threadpool created with q_pool_create(3) with threads all calling q_job_seek(3).

If q is NULL, the creation and destruction of a queue and threadpool will be handled automatically.

RETURN VALUE
mtree_init() returns zero on success. On error, -1 is returned, and errno is set to indicate the error.

The mtree_free() function returns no value, and preserves errno.

ERRORS
TODO

BUGS
No error handling.

EXAMPLE
TODO

SEE ALSO
mtree_init(3), mtree_free(3), q_init(3), q_pool_create(3), q_job_seek(3)