LIBDOODLE(3)

โœจ LIBDOODLE โœจ

okay bestie, sit down, we're talking about libdoodle โ€” the multi-suffix tree based file search library, version 0.7.0. it's a C library. it's a mood. it's giving "i index your files and i do it fast." ๐Ÿ’…


๐ŸŒธ SYNOPSIS ๐ŸŒธ

#include <doodle.h>
typedef void (*DOODLE_Logger)(void * context, unsigned int level, const char * message, ...);
typedef struct {
  char * filename;
  unsigned int mod_time;
} DOODLE_FileInfo;
typedef void (*DOODLE_TreeCallback)(const DOODLE_FileInfo * fileinfo, void * arg);
unsigned int DOODLE_getFileCount(const struct DOODLE_SuffixTree * tree);
const DOODLE_File * DOODLE_getFileAt(const struct DOODLE_SuffixTree * tree, unsigned int index);
struct DOODLE_SuffixTree * DOODLE_tree_create(DOODLE_Logger log, void * context, const char * database);
void DOODLE_tree_set_memory_limit(struct DOODLE_SuffixTree *tree, size_t limit);
void DOODLE_tree_destroy(struct DOODLE_SuffixTree * tree);
int DOODLE_tree_expand(struct DOODLE_SuffixTree * tree, const unsigned char * searchString, const char * fileName);
int DOODLE_tree_truncate(struct DOODLE_SuffixTree * tree, const char * fileName);
int DOODLE_tree_dump(FILE * stream, struct DOODLE_SuffixTree * tree);
int DOODLE_tree_search_approx(struct DOODLE_SuffixTree * tree, const unsigned int approx, const int ignore_case, const unsigned char * ss, DOODLE_ResultCallback * callback, void * arg);
int DOODLE_tree_search(struct DOODLE_SuffixTree * tree, const unsigned char * substring, DOODLE_ResultCallback * callback, void * arg);

๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

libdoodle is a library that gives you a multi-suffix tree to look up files with. the whole vibe is: make a suffix tree โžก๏ธ throw some keywords at it (each one attached to a file) โžก๏ธ search the tree โžก๏ธ yeet the tree. and the โœจiconicโœจ bonus feature? libdoodle has code to quickly serialize the tree into a compact format. no cap.

so here's the flow, bestie. to use libdoodle, your client code first creates a tree with DOODLE_tree_create โ€” you pass it a callback function that logs all the error messages for that tree, plus the name of the database. that's it, tree acquired. ๐ŸŒฑ

then you can search it with DOODLE_tree_search or DOODLE_tree_search_approx (heads up: the approx one needs extra processing with DOODLE_tree_iterate to walk over the individual results, so don't come for me when you forget that step ๐Ÿ™ˆ).

you can grow the tree with new search strings using DOODLE_tree_expand, and you can remove existing matches with DOODLE_tree_truncate. important though: it is only possible to remove all keywords for a given file. no cherry-picking, no "just this one keyword bestie". the whole file's keywords or nothing.

with DOODLE_getFileAt and DOODLE_getFileCount you can inspect the files currently in the tree โ€” and yes you can check their respective modification timestamps, which is useful for keeping track of when an entry maybe outdated. (the manpage says "maybe outdated", i'm just the messenger ๐Ÿ’€)

finally, the tree must be released using DOODLE_tree_destroy. that writes the changes to the disk and frees all associated resources. do not skip this step. do not ghost your tree.

example code for using the complete libdoodle API lives in doodle.c. and if jni.h was found when libdoodle was compiled, libdoodle will contain methods that let Java code directly use libdoodle. check org.gnunet.doodle.Doodle for Java code providing an interface to libdoodle โ€” it even has a sample main method that demonstrates searching the doodle database from Java. java girlies, you're covered. ๐Ÿ’œ


๐Ÿ‘‘ SEE ALSO ๐Ÿ‘‘


libdoodle and doodle are released under the GPL. periodt.


๐Ÿ’€ BUGS ๐Ÿ’€

there is at least one known bug, but nobody was able to reproduce it yet. ๐Ÿ˜ญ but in general things work fine. :-)


๐Ÿ“ฎ REPORTING BUGS ๐Ÿ“ฎ

report bugs to mantis <https://gnunet.org/bugs/> or by sending electronic mail to <christian@grothoff.org>


๐Ÿซถ AUTHORS ๐Ÿซถ

doodle was originally written by Christian Grothoff <christian@grothoff.org>. king behavior, honestly. ๐Ÿ‘‘


๐ŸŒˆ AVAILABILITY ๐ŸŒˆ

you can obtain the original author's latest version from http://grothoff.org/christian/doodle/.


okay that's the whole page, bestie ๐Ÿ’– this was libdoodle, from the libdoodle manual, dated Jan 1 2010, section LIBDOODLE(3). go build something cute with it. mwah. ๐ŸŽ€โœจ