-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathmvcc_dbapi.c
More file actions
37 lines (29 loc) · 750 Bytes
/
mvcc_dbapi.c
File metadata and controls
37 lines (29 loc) · 750 Bytes
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
37
// Define the document API for mvcc and ACID transactions
// implemented for the database project.
#include "mvcc.h"
uint32_t hashVal(uint8_t *src, uint32_t len) {
uint32_t val = 0;
uint32_t b = 378551;
uint32_t a = 63689;
while (len) {
val *= a;
a *= b;
if (len < sizeof(uint32_t))
val += src[--len];
else {
len -= 4;
val += *(uint32_t *)(src + len);
}
}
return val;
}
typedef struct {
DbHandle dbHndl;
DbHandle docHndl;
} MVCC_Interface;
/*
MVCCResult mvcc_OpenDocumentInterface(DbHandle hndl[1], char *name, uint32_t len, Params *params) {
Handle *dbHndl = bindHandle(hndl, Hndl_database);
MVCCResult result = {.value = 0, .count = 0, .objType = objHndl, .status = DB_OK};
}
*/