示例#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
// 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)
}