ESDM
Middleware for Earth System Data
mongodb.h
1 /* This file is part of ESDM.
2  *
3  * This program is free software: you can redistribute it and/or modify
4  * it under the terms of the GNU Lesser General Public License as published by
5  * the Free Software Foundation, either version 3 of the License, or
6  * (at your option) any later version.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with ESDM. If not, see <http://www.gnu.org/licenses/>.
15  */
16 #ifndef MONGODB_H
17 #define MONGODB_H
18 
19 #include <esdm.h>
20 
21 // Internal functions used by this backend.
22 typedef struct {
23  const char *type;
24  const char *name;
25  const char *target;
26 
27  mongoc_client_t *client;
28  mongoc_database_t *database;
29  mongoc_collection_t *collection;
30 
32 
33 // Internal functions used by this backend.
34 typedef struct {
36  int other;
37 
38  mongoc_client_t *client;
39  mongoc_database_t *database;
40  mongoc_collection_t *collection;
42 
43 // forward declarations
44 
45 static void mongodb_test();
46 
47 static void log(const char *format, ...);
48 
49 static int mkfs(esdm_backend_t *backend);
50 
57 static int fsck();
58 
59 static int entry_create(const char *path);
60 
61 static int entry_retrieve(const char *path);
62 
63 static int entry_update(const char *path, void *buf, size_t len);
64 
65 static int entry_destroy(const char *path);
66 
67 static int container_create(esdm_backend_t *backend, esdm_container_t *container);
68 
69 static int container_retrieve(esdm_backend_t *backend, esdm_container_t *container);
70 
71 static int container_update(esdm_backend_t *backend, esdm_container_t *container);
72 
73 static int container_destroy(esdm_backend_t *backend, esdm_container_t *container);
74 
75 static int dataset_create(esdm_backend_t *backend, esdm_dataset_t *dataset);
76 
77 static int dataset_retrieve(esdm_backend_t *backend, esdm_dataset_t *dataset);
78 
79 static int dataset_update(esdm_backend_t *backend, esdm_dataset_t *dataset);
80 
81 static int dataset_destroy(esdm_backend_t *backend, esdm_dataset_t *dataset);
82 
83 static int fragment_update(esdm_backend_t *backend, esdm_fragment_t *fragment);
84 
85 static int mongodb_backend_performance_estimate(esdm_backend_t *backend);
86 
87 static int mongodb_create(esdm_backend_t *backend, char *name);
88 
89 static int mongodb_open(esdm_backend_t *backend);
90 
91 static int mongodb_write(esdm_backend_t *backend);
92 
93 static int mongodb_read(esdm_backend_t *backend);
94 
95 static int mongodb_close(esdm_backend_t *backend);
96 
97 static int mongodb_allocate(esdm_backend_t *backend);
98 
99 static int mongodb_update(esdm_backend_t *backend);
100 
101 static int mongodb_lookup(esdm_backend_t *backend);
102 
120 
126 int mongodb_finalize();
127 
128 static void mongodb_test();
129 
130 #endif
int mongodb_finalize()
Definition: mongodb.c:542
esdm_backend_t * mongodb_backend_init(esdm_config_backend_t *config)
Definition: mongodb.c:499
Definition: esdm-datatypes-internal.h:197
Definition: esdm-datatypes-internal.h:252
Definition: esdm-datatypes-internal.h:41
Definition: esdm-datatypes-internal.h:59
Definition: esdm-datatypes-internal.h:78
Definition: mongodb.h:34
Definition: mongodb.h:22