SIGMOD Contest 2011
Loading...
Searching...
No Matches
scdb.h
Go to the documentation of this file.
1/*
2Copyright 2011 Massachusetts Institute of Technology.
3All rights reserved. Use of this source code is governed by a
4BSD-style license that can be found in the LICENSE file.
5*/
6
14#ifndef SCDB_H__
15#define SCDB_H__
16
17#include <stddef.h>
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
23struct scdb_index;
25typedef struct scdb_index scdb_index;
26
27struct scdb_iterator;
30
46
48#define SCDB_MAX_KEY_LENGTH 1024
50#define SCDB_MAX_VALUE_LENGTH 4096
51
60scdb_index* scdb_open(size_t max_disk_bytes, const char* disk_path);
61
67void scdb_close(scdb_index* index);
68
87scdb_status scdb_read(scdb_index* index, const char* key, size_t key_length,
88 char* value_buffer, size_t* value_buffer_length);
89
90
103scdb_status scdb_write(scdb_index* index, const char* key, size_t key_length,
104 const char* value_buffer, size_t value_length);
105
116scdb_status scdb_delete(scdb_index* index, const char* key, size_t key_length);
117
140scdb_status scdb_cas(scdb_index* index, const char* key, size_t key_length,
141 const char* current_value, size_t current_value_length,
142 const char* new_value, size_t new_value_length);
143
157 const char* key, size_t key_length);
158
164void scdb_iterator_close(scdb_iterator* iterator);
165
188 char* key_buffer, size_t* key_buffer_length,
189 char* value_buffer, size_t* value_buffer_length);
190
191
192#ifdef __cplusplus
193} /* extern "C" */
194#endif
195
196#endif
scdb_index * scdb_open(size_t max_disk_bytes, const char *disk_path)
Opens an existing index, or creates one if it does not exist.
Definition nullimplementation.c:13
scdb_iterator * scdb_iterate(scdb_index *index, const char *key, size_t key_length)
Create an iterator over the index, starting at the smallest key that is greater than or equal to the ...
Definition nullimplementation.c:40
scdb_status
Status code return by SCDB function calls.
Definition scdb.h:32
@ SCDB_ERROR
Some other error occurred.
Definition scdb.h:44
@ SCDB_OK
Operation completed successfully.
Definition scdb.h:34
@ SCDB_VALUE_BUFFER_TOO_SMALL
The buffer provided for the value is too small.
Definition scdb.h:40
@ SCDB_KEY_BUFFER_TOO_SMALL
The buffer provided for the key is too small.
Definition scdb.h:38
@ SCDB_NOT_FOUND
The specified key was not found so the operation was not perfomed.
Definition scdb.h:36
@ SCDB_COMPARE_FAILED
For compare and swap, the current value did not match.
Definition scdb.h:42
scdb_status scdb_delete(scdb_index *index, const char *key, size_t key_length)
Removes the specified key and associated value from the index.
Definition nullimplementation.c:30
scdb_status scdb_write(scdb_index *index, const char *key, size_t key_length, const char *value_buffer, size_t value_length)
Sets the specified key to map to the specified value.
Definition nullimplementation.c:25
scdb_status scdb_next(scdb_iterator *iterator, char *key_buffer, size_t *key_buffer_length, char *value_buffer, size_t *value_buffer_length)
Reads the current key/value pair from the iterator, then advances the iterator.
Definition nullimplementation.c:48
scdb_status scdb_read(scdb_index *index, const char *key, size_t key_length, char *value_buffer, size_t *value_buffer_length)
Reads the value corresponding to the specified key (exact match).
Definition nullimplementation.c:20
scdb_status scdb_cas(scdb_index *index, const char *key, size_t key_length, const char *current_value, size_t current_value_length, const char *new_value, size_t new_value_length)
Performs an atomic compare and swap.
Definition nullimplementation.c:34
void scdb_iterator_close(scdb_iterator *iterator)
Closes an open iterator.
Definition nullimplementation.c:45
void scdb_close(scdb_index *index)
Closes an open index.
Definition nullimplementation.c:17
Definition refimplementation.c:24
Definition refimplementation.c:38