예제 #1
0
파일: options.go 프로젝트: C0rWin/fabric
// SetMergeOperator sets the merge operator which will be called
// if a merge operations are used.
// Default: nil
func (opts *Options) SetMergeOperator(value MergeOperator) {
	if nmo, ok := value.(nativeMergeOperator); ok {
		opts.cmo = nmo.c
	} else {
		idx := registerMergeOperator(value)
		opts.cmo = C.gorocksdb_mergeoperator_create(C.uintptr_t(idx))
	}
	C.rocksdb_options_set_merge_operator(opts.c, opts.cmo)
}
예제 #2
0
파일: options.go 프로젝트: butine/research
// The merge operator will called if Merge operations are used.
// Default: nil
func (self *Options) SetMergeOperator(value MergeOperator) {
	if nmo, ok := value.(nativeMergeOperator); ok {
		self.cmo = nmo.c
	} else {
		h := unsafe.Pointer(&value)
		self.mo = &value
		self.cmo = C.gorocksdb_mergeoperator_create(h)
	}
	C.rocksdb_options_set_merge_operator(self.c, self.cmo)
}