logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

mdex_add, mdex_addfile, mdex_alias - index data, files and directories

Description

       The  mdex_add  function builds a merkle tree from data with length len and adds entries for both the tree
       and chunks to mdex.

       The mdex_addfile function builds a merkle tree from the file or directory at path and  adds  entries  for
       the trees and chunks to mdex.

       The  mdex_alias  function adds an entry alias of length aliaslen which points to the entry hash of length
       hashlen which must already exist in mdex.

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

       The flags argument is the bitwise OR of zero of more of the following flags:

       MDEX_ALIAS
              Entry is a pointer to another entry.

       MDEX_RAND Entry should be sent using random symbols.

       MDEX_RECURSE Recursively index all files and directories below path.  (mdex_addfile)

       MDEX_MOUNT If set, stay within the same filesystem (i.e., do not cross mount points).

       MDEX_SYMLINK
              Follow symbolic links when recursively indexing.

Errors

EINVAL Invalid argument. Both mdex and hash are required (not NULL), and hashlen > 0.

       ENOMEM Not enough space/cannot allocate memory (POSIX.1-2001).

Library

       Librecast library (liblibrecast, -llibrecast)

Name

       mdex_add, mdex_addfile, mdex_alias - index data, files and directories

Return Value

       These function return zero on success.  On error, -1 is returned, and errno is set to indicate the error.

See Also

mdex_init(3),   mdex_free(3),   mdex_get(3),   mdex_put(3),   mdex_del(3),   mtree_build(3),   q_init(3),
       q_pool_create(3), q_job_seek(3) lc_share(3)

LIBRECAST                                          2023-06-20                                        MDEX_ADD(3)

Synopsis

#include<librecast/mdex.h>intmdex_add(mdex_t*mdex,void*data,size_tlen,q_t*q,intflags);intmdex_addfile(mdex_t*mdex,constchar*path,q_t*q,intflags);intmdex_alias(mdex_t*mdex,unsignedchar*alias,size_taliaslen,unsignedchar*hash,size_thashlen);

       Compile and link with -llibrecast.

See Also