コード例 #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)
}