-
Notifications
You must be signed in to change notification settings - Fork 12
/
db_cursor.h
36 lines (30 loc) · 1.12 KB
/
db_cursor.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#pragma once
// database cursor handle extension to index
typedef enum {
CursorNone,
CursorLeftEof,
CursorRightEof,
CursorPosBefore, // cursor is before a key
CursorPosAt // cursor is at a key
} PosState;
// DbCursor handle extension
typedef struct {
uint8_t *key; // cursor key bytes
uint32_t size; // size of user data
uint32_t keyLen; // cursor key length
uint32_t baseLen; // cursor base length
uint32_t suffix; // cursor suffix length
uint32_t resultSet; // max size buffered keys
DbAddr deDupHash; // dedup hash table
PosState state; // cursor position state enum
uint8_t foundKey; // cursor position found the key
char binaryFlds; // index keys have fields
uint8_t deDup; // cursor will deDuplicate result set
} DbCursor;
DbStatus dbCloseCursor(DbCursor *cursor, DbMap *map);
DbStatus dbFindKey(DbCursor *cursor, DbMap *map, void *key, uint32_t keyLen, CursorOp op);
DbStatus dbNextKey(DbCursor *cursor, DbMap *map);
DbStatus dbPrevKey(DbCursor *cursor, DbMap *map);
DbStatus dbRightKey(DbCursor *cursor, DbMap *map);
DbStatus dbLeftKey(DbCursor *cursor, DbMap *map);
uint64_t dbGetDocId(DbCursor *cursor);