diff options
author | Oran Agra <oran@redislabs.com> | 2018-06-26 14:14:35 +0300 |
---|---|---|
committer | Oran Agra <oran@redislabs.com> | 2018-06-27 15:00:41 +0300 |
commit | 5616d4c6036eeea416f38aa2e41a57249e69277f (patch) | |
tree | fe9b4126768f6c190f63e457fbfaa9476e7c6e5e /src/rax.h | |
parent | e8099cabd19c4e3a46c94c39e69e13191d43f5eb (diff) | |
download | redis-5616d4c6036eeea416f38aa2e41a57249e69277f.tar.gz |
add active defrag support for streams
Diffstat (limited to 'src/rax.h')
-rw-r--r-- | src/rax.h | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -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 |