[geodb] Additional filenames and struct members in geodb.h

This commit is contained in:
Al
2015-10-09 15:37:10 -04:00
parent 67d128c386
commit 44da2e446b
3 changed files with 16 additions and 8 deletions

View File

@@ -5,19 +5,23 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdint.h> #include <stdint.h>
#include "bloom.h"
#include "libpostal_config.h" #include "libpostal_config.h"
#include "geonames.h" #include "geonames.h"
#include "graph.h"
#include "sparkey/sparkey.h" #include "sparkey/sparkey.h"
#include "sparkey/sparkey-internal.h" #include "sparkey/sparkey-internal.h"
#include "string_utils.h" #include "string_utils.h"
#include "trie.h" #include "trie.h"
#include "trie_search.h" #include "trie_search.h"
#define GEODB_TRIE_FILENAME "geodb.trie" #define GEODB_NAMES_TRIE_FILENAME "geodb_names.trie"
#define GEODB_TRIE_FILENAME_LEN strlen(GEODB_TRIE_FILENAME) #define GEODB_TRIE_FILENAME_LEN strlen(GEODB_NAMES_TRIE_FILENAME)
#define GEODB_BLOOM_FILTER_FILENAME "geodb.bloom" #define GEODB_FEATURES_TRIE_FILENAME "geodb_features.trie"
#define GEODB_BLOOM_FILTER_FILENAME_LEN strlen(GEODB_BLOOM_FILTER_FILENAME) #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 "geodb.spi"
#define GEODB_HASH_FILENAME_LEN strlen(GEODB_HASH_FILENAME) #define GEODB_HASH_FILENAME_LEN strlen(GEODB_HASH_FILENAME)
#define GEODB_LOG_FILENAME "geodb.spl" #define GEODB_LOG_FILENAME "geodb.spl"
@@ -34,8 +38,10 @@ typedef union geodb_value {
} geodb_value_t; } geodb_value_t;
typedef struct geodb { typedef struct geodb {
trie_t *trie; trie_t *names;
bloom_filter_t *bloom_filter; trie_t *features;
cstring_array *postal_codes;
graph_t *feature_graph;
sparkey_hashreader *hash_reader; sparkey_hashreader *hash_reader;
sparkey_logiter *log_iter; sparkey_logiter *log_iter;
char_array *value_buf; char_array *value_buf;

View File

@@ -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) 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 == NULL) return;
if (self->edges != NULL) { if (self->edges != NULL) {

View File

@@ -35,6 +35,8 @@ typedef struct graph_builder {
} graph_builder_t; } graph_builder_t;
graph_builder_t *graph_builder_new(graph_type_t type, bool fixed_rows); 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. Destroy the builder and return a graph.