aboutsummaryrefslogtreecommitdiff
path: root/iomt.h
diff options
context:
space:
mode:
authorFranklin Wei <me@fwei.tk>2018-06-27 23:38:36 -0400
committerFranklin Wei <me@fwei.tk>2018-06-27 23:38:36 -0400
commitbe7238d18b06b726f1c688c39c21800ef22f72c1 (patch)
treedbffd58a595b53ed9dc80a21cd9888b5c0187128 /iomt.h
parent3b232072565e54293466f8ba477547686be578bd (diff)
downloadcsaa-be7238d18b06b726f1c688c39c21800ef22f72c1.zip
csaa-be7238d18b06b726f1c688c39c21800ef22f72c1.tar.gz
csaa-be7238d18b06b726f1c688c39c21800ef22f72c1.tar.bz2
csaa-be7238d18b06b726f1c688c39c21800ef22f72c1.tar.xz
Optimize DB code
Diffstat (limited to 'iomt.h')
-rw-r--r--iomt.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/iomt.h b/iomt.h
index 2162bd6..a4fafc1 100644
--- a/iomt.h
+++ b/iomt.h
@@ -1,6 +1,7 @@
#ifndef CSAA_IOMT_H
#define CSAA_IOMT_H
#include "crypto.h"
+#include <sqlite3.h>
struct iomt_node {
uint64_t idx, next_idx; /* idx cannot be zero */
@@ -37,6 +38,9 @@ struct iomt {
* not NULL) key2_name = key2_val */
const char *key1_name, *key2_name;
int key1_val, key2_val;
+
+ sqlite3_stmt *getnode, *updatenode, *insertnode;
+ sqlite3_stmt *getleaf, *updateleaf, *insertleaf;
} db;
struct {
hash_t *mt_nodes; /* this has 2 * mt_leafcount - 1 elements. Note
@@ -66,7 +70,14 @@ struct iomt *iomt_new_from_db(void *db,
const char *key1_name, int key1_val,
const char *key2_name, int key2_val,
int logleaves);
+
struct iomt *iomt_dup(const struct iomt *tree);
+struct iomt *iomt_dup_in_db(void *db,
+ const char *nodes_table, const char *leaves_table,
+ const char *key1_name, int key1_val,
+ const char *key2_name, int key2_val,
+ const struct iomt *oldtree);
+
void iomt_free(struct iomt *tree);
/* Find a leaf with IOMT index `idx' and change its value, propagating