本文整理汇总了Golang中C.DBClose函数的典型用法代码示例。如果您正苦于以下问题:Golang DBClose函数的具体用法?Golang DBClose怎么用?Golang DBClose使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DBClose函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Commit
func (r *rocksDBBatch) Commit() error {
if r.batch == nil {
panic("this batch was already committed")
}
r.distinctOpen = false
if r.flushes > 0 {
// We've previously flushed mutations to the C++ batch, so we have to flush
// any remaining mutations as well and then commit the batch.
r.flushMutations()
if err := statusToError(C.DBCommitBatch(r.batch)); err != nil {
return err
}
} else if r.builder.count > 0 {
// Fast-path which avoids flushing mutations to the C++ batch. Instead, we
// directly apply the mutations to the database.
if err := r.parent.ApplyBatchRepr(r.builder.Finish()); err != nil {
return err
}
}
C.DBClose(r.batch)
r.batch = nil
return nil
}
示例2: Close
func (r *rocksDBBatch) Close() {
if i := &r.prefixIter.rocksDBIterator; i.iter != nil {
i.destroy()
}
if i := &r.normalIter.rocksDBIterator; i.iter != nil {
i.destroy()
}
if r.batch != nil {
C.DBClose(r.batch)
}
}
示例3: Close
func (r *rocksDBBatch) Close() {
r.distinct.close()
if i := &r.prefixIter.iter; i.iter != nil {
i.destroy()
}
if i := &r.normalIter.iter; i.iter != nil {
i.destroy()
}
if r.batch != nil {
C.DBClose(r.batch)
}
}
示例4: Close
// Close closes the database by deallocating the underlying handle.
func (r *RocksDB) Close() {
if atomic.AddInt32(&r.refcount, -1) > 0 {
return
}
if len(r.dir) == 0 {
log.Infof("closing in-memory rocksdb instance")
} else {
log.Infof("closing rocksdb instance at %q", r.dir)
}
if r.rdb != nil {
C.DBClose(r.rdb)
r.rdb = nil
}
}
示例5: Close
// Close closes the database by deallocating the underlying handle.
func (r *RocksDB) Close() {
if r.rdb == nil {
log.Errorf("closing unopened rocksdb instance")
return
}
if len(r.dir) == 0 {
log.Infof("closing in-memory rocksdb instance")
} else {
log.Infof("closing rocksdb instance at %q", r.dir)
}
if r.rdb != nil {
C.DBClose(r.rdb)
r.rdb = nil
}
close(r.deallocated)
}
示例6: Commit
func (r *rocksDBBatch) Commit() error {
if r.batch == nil {
panic("this batch was already committed")
}
if err := statusToError(C.DBWriteBatch(r.batch)); err != nil {
return err
}
C.DBClose(r.batch)
r.batch = nil
// On success, run the deferred functions in reverse order.
for i := len(r.defers) - 1; i >= 0; i-- {
r.defers[i]()
}
r.defers = nil
return nil
}
示例7: Close
func (r *rocksDBBatch) Close() {
if r.batch != nil {
C.DBClose(r.batch)
}
}