0
0

add support for native C merge operators

This commit is contained in:
Marty Schoch 2016-01-27 17:51:07 -05:00
parent 10e2207179
commit 710d06e974

View File

@ -9,6 +9,8 @@
package store
import "unsafe"
// At the moment this happens to be the same interface as described by
// RocksDB, but this may not always be the case.
@ -28,6 +30,34 @@ type MergeOperator interface {
Name() string
}
// NativeMergeOperator is a merge operator that also includeTermVectors
// a C implementation
type NativeMergeOperator interface {
MergeOperator
// a pointer to function in C with the signature
// char* (*full_merge)(void *state,
// const char* key, size_t key_length,
// const char* existing_value,
// size_t existing_value_length,
// const char* const* operands_list,
// const size_t* operands_list_length, int num_operands,
// unsigned char* success, size_t* new_value_length)
FullMergeC() unsafe.Pointer
// a pointer to function in C with the signature
// char* (*partial_merge)(void *state,
// const char* key, size_t key_length,
// const char* const* operands_list,
// const size_t* operands_list_length, int num_operands,
// unsigned char* success, size_t* new_value_length)
PartialMergeC() unsafe.Pointer
// a pointer to function in C with signature
// const char* merge_operator_name_fn(void *state)
NameC() unsafe.Pointer
}
type EmulatedMerge struct {
Merges map[string][][]byte
mo MergeOperator