diff --git a/src/cluster.c b/src/cluster.c new file mode 100644 index 0000000..76dcdff --- /dev/null +++ b/src/cluster.c @@ -0,0 +1,41 @@ +#include + +#include "bin.h" +#include "cluster.h" + +static const struct b_tree_ops cluster_table_ops = { + .tree_get_node = NULL, + .tree_put_node = NULL, + .tree_alloc_node = NULL, + + .node_get_nr_entries = NULL, + .node_set_nr_entries = NULL, + .node_get_entries = NULL, + .node_get_children = NULL, + + .entry_compare = NULL, +}; + +void cluster_table_init(struct cluster_table *table, FILE *storage) +{ + memset(table, 0x0, sizeof *table); + + table->t_storage = storage; + + b_tree_init(&table->t_base, &cluster_table_ops, sizeof(struct ec3_cluster_group), sizeof(struct ec3_cluster), EC3_CLUSTERS_PER_GROUP + 1); +} + +void cluster_table_finish(struct cluster_table *table) +{ + +} + +int cluster_table_get(struct cluster_table *table, unsigned long id, struct cluster *out) +{ + return -1; +} + +int cluster_table_put(struct cluster_table *table, const struct cluster *in) +{ + return -1; +} \ No newline at end of file diff --git a/src/cluster.h b/src/cluster.h new file mode 100644 index 0000000..25a1e72 --- /dev/null +++ b/src/cluster.h @@ -0,0 +1,27 @@ +#ifndef CLUSTER_H_ +#define CLUSTER_H_ + +#include + +#include "b-tree.h" + +struct cluster_table { + struct b_tree t_base; + FILE *t_storage; +}; + +struct cluster { + unsigned long c_id; + size_t c_base; + size_t c_len; + unsigned long c_checksum; + unsigned int c_flags; +}; + +extern void cluster_table_init(struct cluster_table *table, FILE *storage); +extern void cluster_table_finish(struct cluster_table *table); + +extern int cluster_table_get(struct cluster_table *table, unsigned long id, struct cluster *out); +extern int cluster_table_put(struct cluster_table *table, const struct cluster *in); + +#endif \ No newline at end of file