From 146563ca4565bce870011f111b57db4ea36f76ca Mon Sep 17 00:00:00 2001 From: Sears Russell Date: Sat, 1 Mar 2008 19:34:12 +0000 Subject: [PATCH] Allow third parties to register new iterator types. (made iterator registration non-static; moved constants into constants.h) --- src/stasis/iterator.c | 2 +- stasis/constants.h | 11 +++++++++++ stasis/iterator.h | 12 +++++------- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/stasis/iterator.c b/src/stasis/iterator.c index 53a1e8c..d304f01 100644 --- a/src/stasis/iterator.c +++ b/src/stasis/iterator.c @@ -8,7 +8,7 @@ static lladdIterator_def_t iterators[MAX_ITERATOR_TYPES]; -static void lladdIterator_register(int type, lladdIterator_def_t info) { +void lladdIterator_register(int type, lladdIterator_def_t info) { assert(type < MAX_ITERATOR_TYPES); iterators[type] = info; } diff --git a/stasis/constants.h b/stasis/constants.h index 739b1f3..4a39368 100644 --- a/stasis/constants.h +++ b/stasis/constants.h @@ -248,4 +248,15 @@ extern const short SLOT_TYPE_LENGTHS[]; #define MAX_LSM_COMPARATORS 16 #define MAX_LSM_PAGE_INITIALIZERS 256 #define MAX_LSM_PAGE_ALLOCATORS 16 + +#define MAX_ITERATOR_TYPES 20 +#define LINEAR_HASH_NTA_ITERATOR 0 +#define ARRAY_ITERATOR 1 +#define LOG_MEMORY_ITERATOR 2 +#define POINTER_ITERATOR 3 + +#define USER_DEFINED_ITERATOR 10 + + + #endif diff --git a/stasis/iterator.h b/stasis/iterator.h index 64e8dc1..1c7161e 100644 --- a/stasis/iterator.h +++ b/stasis/iterator.h @@ -6,12 +6,6 @@ BEGIN_C_DECLS -#define MAX_ITERATOR_TYPES 10 -#define LINEAR_HASH_NTA_ITERATOR 0 -#define ARRAY_ITERATOR 1 -#define LOG_MEMORY_ITERATOR 2 -#define POINTER_ITERATOR 3 - typedef struct { // void * new(void * arg); void (*close)(int xid, void * it); @@ -30,7 +24,7 @@ typedef struct { void iterator_init(); -//void lladdIterator_register(int type, lladdIterator_def_t info); +void lladdIterator_register(int type, lladdIterator_def_t info); //lladdIterator_t Titerator(int type, void * arg); @@ -105,6 +99,10 @@ int Titerator_value(int xid, lladdIterator_t * it, byte ** value); all iterators are reentrant.) */ void Titerator_tupleDone(int xid, lladdIterator_t * it); +/** + @todo what is Titerator_releaseLock for?!? It's never called, and + I can't remember why it's here... Delete it? + */ void Titerator_releaseLock(int xid, lladdIterator_t * it); END_C_DECLS