X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;f=buffer_tree.h;h=9de992687573ede116bc89ba8ff2f950c82919a6;hb=ec5c6d12200e42b48e6376d43a7e653051a9259f;hp=c84a93058e575ed6a8fdbc79c49160b2d0271985;hpb=c4d243653174f3f4ffc331a4bfc54de94d612f34;p=paraslash.git diff --git a/buffer_tree.h b/buffer_tree.h index c84a9305..9de99268 100644 --- a/buffer_tree.h +++ b/buffer_tree.h @@ -1,11 +1,19 @@ struct btr_node; -typedef int (*btr_command_handler)(const char *command, char **result); +typedef int (*btr_command_handler)(struct btr_node *btrn, + const char *command, char **result); -struct btr_node *btr_new_node(char *name, struct btr_node *parent, - btr_command_handler handler); -void btr_del_node(struct btr_node *btrn); +enum btr_node_type { + BTR_NT_ROOT, + BTR_NT_INTERNAL, + BTR_NT_LEAF, +}; + +struct btr_node *btr_new_node(const char *name, struct btr_node *parent, + btr_command_handler handler, void *context); +void btr_remove_node(struct btr_node *btrn); +void btr_free_node(struct btr_node *btrn); void btr_add_output(char *buf, size_t size, struct btr_node *btrn); bool btr_no_children(struct btr_node *btrn); size_t btr_bytes_pending(struct btr_node *btrn); @@ -15,3 +23,14 @@ size_t btr_next_buffer(struct btr_node *btrn, char **bufp); void btr_consume(struct btr_node *btrn, size_t numbytes); int btr_exec(struct btr_node *btrn, const char *command, char **value_result); int btr_exec_up(struct btr_node *btrn, const char *command, char **value_result); +void btr_splice_out_node(struct btr_node *btrn); +void btr_pushdown(struct btr_node *btrn); +void *btr_context(struct btr_node *btrn); +void btr_merge(struct btr_node *btrn, size_t dest_size); +bool btr_eof(struct btr_node *btrn); +void btr_log_tree(struct btr_node *btrn, int loglevel); +int btr_pushdown_one(struct btr_node *btrn); +bool btr_inplace_ok(struct btr_node *btrn); +int btr_node_status(struct btr_node *btrn, size_t min_iqs, + enum btr_node_type type); +void btr_get_node_start(struct btr_node *btrn, struct timeval *tv);