From 44da2e446bf6352dd5ee9053b424e34e6c2e74d2 Mon Sep 17 00:00:00 2001 From: Al Date: Fri, 9 Oct 2015 15:37:10 -0400 Subject: [PATCH] [geodb] Additional filenames and struct members in geodb.h --- src/geodb.h | 20 +++++++++++++------- src/graph_builder.c | 2 +- src/graph_builder.h | 2 ++ 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/geodb.h b/src/geodb.h index c3727961..087d193e 100644 --- a/src/geodb.h +++ b/src/geodb.h @@ -5,19 +5,23 @@ #include #include -#include "bloom.h" #include "libpostal_config.h" #include "geonames.h" +#include "graph.h" #include "sparkey/sparkey.h" #include "sparkey/sparkey-internal.h" #include "string_utils.h" #include "trie.h" #include "trie_search.h" -#define GEODB_TRIE_FILENAME "geodb.trie" -#define GEODB_TRIE_FILENAME_LEN strlen(GEODB_TRIE_FILENAME) -#define GEODB_BLOOM_FILTER_FILENAME "geodb.bloom" -#define GEODB_BLOOM_FILTER_FILENAME_LEN strlen(GEODB_BLOOM_FILTER_FILENAME) +#define GEODB_NAMES_TRIE_FILENAME "geodb_names.trie" +#define GEODB_TRIE_FILENAME_LEN strlen(GEODB_NAMES_TRIE_FILENAME) +#define GEODB_FEATURES_TRIE_FILENAME "geodb_features.trie" +#define GEODB_FEATURES_TRIE_FILENAME_LEN strlen(GEODB_FEATURES_TRIE_FILENAME) +#define GEODB_FEATURE_GRAPH_FILENAME "geodb_feature_graph.dat" +#define GEODB_FEATURE_GRAPH_FILENAME_LEN strlen(GEODB_FEATURE_GRAPH_FILENAME) +#define GEODB_POSTAL_CODES_FILENAME "geodb_postal_codes.dat" +#define GEODB_POSTAL_CODES_FILENAME_LEN strlen(GEODB_POSTAL_CODES_FILENAME) #define GEODB_HASH_FILENAME "geodb.spi" #define GEODB_HASH_FILENAME_LEN strlen(GEODB_HASH_FILENAME) #define GEODB_LOG_FILENAME "geodb.spl" @@ -34,8 +38,10 @@ typedef union geodb_value { } geodb_value_t; typedef struct geodb { - trie_t *trie; - bloom_filter_t *bloom_filter; + trie_t *names; + trie_t *features; + cstring_array *postal_codes; + graph_t *feature_graph; sparkey_hashreader *hash_reader; sparkey_logiter *log_iter; char_array *value_buf; diff --git a/src/graph_builder.c b/src/graph_builder.c index 477044aa..35c48f5b 100644 --- a/src/graph_builder.c +++ b/src/graph_builder.c @@ -8,7 +8,7 @@ KSORT_INIT(graph_edge_array, graph_edge_t, ks_lt_graph_edge) KSORT_INIT(graph_edge_array_sort_vertices, graph_edge_t, ks_lt_graph_edge_sort_vertices) -static void graph_builder_destroy(graph_builder_t *self) { +void graph_builder_destroy(graph_builder_t *self) { if (self == NULL) return; if (self->edges != NULL) { diff --git a/src/graph_builder.h b/src/graph_builder.h index 897ee372..d80f4652 100644 --- a/src/graph_builder.h +++ b/src/graph_builder.h @@ -35,6 +35,8 @@ typedef struct graph_builder { } graph_builder_t; graph_builder_t *graph_builder_new(graph_type_t type, bool fixed_rows); +void graph_builder_destroy(graph_builder_t *self); + /* Destroy the builder and return a graph.