track the number of cluster groups written by a cluster_table
This commit is contained in:
@@ -60,6 +60,7 @@ static long tree_alloc_node(struct b_tree *p)
|
||||
fseek(table->t_storage, pos, SEEK_SET);
|
||||
|
||||
len /= sizeof *n;
|
||||
table->t_nr_groups++;
|
||||
|
||||
return (long)len;
|
||||
}
|
||||
@@ -165,6 +166,8 @@ void cluster_table_init(struct cluster_table *table, FILE *storage)
|
||||
&table->t_base);
|
||||
node_init(root);
|
||||
tree_put_node(&table->t_base, 0, (b_tree_node *)root);
|
||||
table->t_nr_groups++;
|
||||
|
||||
b_tree_cache_release_node(&table->t_base, (b_tree_node *)root);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
#ifndef CLUSTER_H_
|
||||
#define CLUSTER_H_
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "b-tree.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
struct cluster_table {
|
||||
struct b_tree t_base;
|
||||
size_t t_nr_groups;
|
||||
FILE *t_storage;
|
||||
};
|
||||
|
||||
@@ -21,7 +22,12 @@ struct cluster {
|
||||
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);
|
||||
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
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user