// SetFilterPolicy sets the filter policy opts reduce disk reads. // Many applications will benefit from passing the result of // NewBloomFilterPolicy() here. // Default: nil func (opts *BlockBasedTableOptions) SetFilterPolicy(fp FilterPolicy) { if nfp, ok := fp.(nativeFilterPolicy); ok { opts.cFp = nfp.c } else { idx := registerFilterPolicy(fp) opts.cFp = C.gorocksdb_filterpolicy_create(C.uintptr_t(idx)) } C.rocksdb_block_based_options_set_filter_policy(opts.c, opts.cFp) }
// If set use the specified filter policy to reduce disk reads. // Many applications will benefit from passing the result of // NewBloomFilterPolicy() here. // Default: nil func (self *BlockBasedTableOptions) SetFilterPolicy(value FilterPolicy) { if nfp, ok := value.(nativeFilterPolicy); ok { self.cfp = nfp.c } else { h := unsafe.Pointer(&value) self.fp = &value self.cfp = C.gorocksdb_filterpolicy_create(h) } C.rocksdb_block_based_options_set_filter_policy(self.c, self.cfp) }