예제 #1
0
파일: db.go 프로젝트: tradia/gotable
func (db *DB) Commit(wb *WriteBatch) error {
	if wb != nil && wb.batch != nil {
		var errStr *C.char
		C.rocksdb_write(db.db, db.wOpt, wb.batch, &errStr)
		C.rocksdb_writebatch_clear(wb.batch)
		if errStr != nil {
			defer C.free(unsafe.Pointer(errStr))
			return errors.New(C.GoString(errStr))
		}
	}

	return nil
}
예제 #2
0
// Clear removes all the enqueued Put and Deletes.
func (w *WriteBatch) Clear() {
	C.rocksdb_writebatch_clear(w.c)
}
예제 #3
0
파일: batch.go 프로젝트: Abioy/ledisdb
func (w *WriteBatch) Rollback() error {
	C.rocksdb_writebatch_clear(w.wbatch)
	return nil
}
예제 #4
0
// Clear removes all the enqueued Put and Deletes.
func (self *WriteBatch) Clear() {
	C.rocksdb_writebatch_clear(self.c)
}
예제 #5
0
func (w *WriteBatch) Rollback() error {
	if !w.commitOk {
		C.rocksdb_writebatch_clear(w.wbatch)
	}
	return nil
}