Allow third parties to register new iterator types. (made iterator registration non-static; moved constants into constants.h)

This commit is contained in:
Sears Russell 2008-03-01 19:34:12 +00:00
parent f05b0233a3
commit 146563ca45
3 changed files with 17 additions and 8 deletions

View file

@ -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;
}

View file

@ -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

View file

@ -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