// destroyOptions destroys the options used for creating, reading, and writing // from the db. It is meant to be used in conjunction with createOptions. func (r *RocksDB) destroyOptions() { C.rocksdb_options_destroy(r.opts) C.rocksdb_readoptions_destroy(r.rOpts) C.rocksdb_writeoptions_destroy(r.wOpts) r.opts = nil r.rOpts = nil r.wOpts = nil }
// destroyOptions destroys the options used for creating, reading, and writing // from the db. It is meant to be used in conjunction with createOptions. func (r *RocksDB) destroyOptions() { // The merge operator is stored inside of r.opts as a std::shared_ptr, // so it will actually be freed automatically. // Calling rocksdb_mergeoperator_destroy will ignore that shared_ptr, // and a subsequent rocksdb_options_destroy would segfault. // The following line zeroes the shared_ptr instead, effectively // deallocating the merge operator if one is set. C.rocksdb_options_set_merge_operator(r.opts, nil) C.rocksdb_options_destroy(r.opts) C.rocksdb_readoptions_destroy(r.rOpts) C.rocksdb_writeoptions_destroy(r.wOpts) r.mergeOperator = nil r.opts = nil r.rOpts = nil r.wOpts = nil }
// destroyOptions destroys the options used for creating, reading, and writing // from the db. It is meant to be used in conjunction with createOptions. func (r *RocksDB) destroyOptions() { // The merge operator and compaction filter are stored inside of // r.opts using std::shared_ptrs, so they'll be freed // automatically. Calling the *_destroy methods directly would // ignore the shared_ptrs, and a subsequent rocksdb_options_destroy // would segfault. The following lines zero the shared_ptrs instead, // which deletes the underlying values. C.rocksdb_options_set_merge_operator(r.opts, nil) C.rocksdb_options_set_compaction_filter_factory(r.opts, nil) C.rocksdb_options_destroy(r.opts) C.rocksdb_readoptions_destroy(r.rOpts) C.rocksdb_writeoptions_destroy(r.wOpts) r.mergeOperator = nil r.compactionFilterFactory = nil r.opts = nil r.rOpts = nil r.wOpts = nil }
func (db *DB) Close() { if db.db != nil { C.rocksdb_close(db.db) db.db = nil if db.opt != nil { C.rocksdb_options_destroy(db.opt) } if db.rOpt != nil { C.rocksdb_readoptions_destroy(db.rOpt) } if db.wOpt != nil { C.rocksdb_writeoptions_destroy(db.wOpt) } if db.cache != nil { C.rocksdb_cache_destroy(db.cache) } if db.fp != nil { C.rocksdb_filterpolicy_destroy(db.fp) } } }
// Close deallocates the WriteOptions, freeing its underlying C struct. func (wo *WriteOptions) Close() { C.rocksdb_writeoptions_destroy(wo.Opt) }
// Destroy deallocates the WriteOptions object. func (opts *WriteOptions) Destroy() { C.rocksdb_writeoptions_destroy(opts.c) opts.c = nil }
// Release deallocates the WriteOptions object. func (o *WriteOptions) Release() { C.rocksdb_writeoptions_destroy(o.c) o.c = nil }
// Destroy deallocates the WriteOptions object. func (self *WriteOptions) Destroy() { C.rocksdb_writeoptions_destroy(self.c) self.c = nil }