summaryrefslogtreecommitdiff
path: root/src/rax.h
diff options
context:
space:
mode:
authorOran Agra <oran@redislabs.com>2018-06-26 14:14:35 +0300
committerOran Agra <oran@redislabs.com>2018-06-27 15:00:41 +0300
commit5616d4c6036eeea416f38aa2e41a57249e69277f (patch)
treefe9b4126768f6c190f63e457fbfaa9476e7c6e5e /src/rax.h
parente8099cabd19c4e3a46c94c39e69e13191d43f5eb (diff)
downloadredis-5616d4c6036eeea416f38aa2e41a57249e69277f.tar.gz
add active defrag support for streams
Diffstat (limited to 'src/rax.h')
-rw-r--r--src/rax.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/rax.h b/src/rax.h
index 5b4d45167..9e6bc0b51 100644
--- a/src/rax.h
+++ b/src/rax.h
@@ -119,6 +119,12 @@ typedef struct raxStack {
int oom; /* True if pushing into this stack failed for OOM at some point. */
} raxStack;
+/* Optional callback used for iterators and be notified on each rax node.
+ * This is used by active defrag, the return value is an indication that
+ * the noderef was chagned, and the tree needs to be updated.
+ * This is currently only supported in forward iterations (raxNext) */
+typedef int (*raxNodeCallback)(raxNode **noderef);
+
/* Radix tree iterator state is encapsulated into this data structure. */
#define RAX_ITER_STATIC_LEN 128
#define RAX_ITER_JUST_SEEKED (1<<0) /* Iterator was just seeked. Return current
@@ -137,6 +143,7 @@ typedef struct raxIterator {
unsigned char key_static_string[RAX_ITER_STATIC_LEN];
raxNode *node; /* Current node. Only for unsafe iteration. */
raxStack stack; /* Stack used for unsafe iteration. */
+ raxNodeCallback node_cb;
} raxIterator;
/* A special pointer returned for not found items. */
@@ -161,4 +168,7 @@ int raxEOF(raxIterator *it);
void raxShow(rax *rax);
uint64_t raxSize(rax *rax);
+/* internals */
+void raxSetData(raxNode *n, void *data);
+
#endif