Пример #1
0
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
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
}