Ejemplo n.º 1
0
// CompactRange runs a manual compaction on the Range of keys given. This is
// not likely to be needed for typical usage.
func (db *DB) CompactRange(r Range) {
	var start, limit *C.char
	if len(r.Start) != 0 {
		start = (*C.char)(unsafe.Pointer(&r.Start[0]))
	}
	if len(r.Limit) != 0 {
		limit = (*C.char)(unsafe.Pointer(&r.Limit[0]))
	}
	C.rocksdb_compact_range(
		db.Ldb, start, C.size_t(len(r.Start)), limit, C.size_t(len(r.Limit)))
}
Ejemplo n.º 2
0
func (db *DB) Compact() error {
	C.rocksdb_compact_range(db.db, nil, 0, nil, 0)
	return nil
}
Ejemplo n.º 3
0
// CompactRange runs a manual compaction on the Range of keys given. This is
// not likely to be needed for typical usage.
func (self *DB) CompactRange(r Range) {
	cStart := byteToChar(r.Start)
	cLimit := byteToChar(r.Limit)

	C.rocksdb_compact_range(self.c, cStart, C.size_t(len(r.Start)), cLimit, C.size_t(len(r.Limit)))
}
Ejemplo n.º 4
0
// CompactRange compacts the specified key range. Specifying nil for
// the start key starts the compaction from the start of the database.
// Similarly, specifying nil for the end key will compact through the
// last key. Note that the use of the word "Range" here does not refer
// to Cockroach ranges, just to a generalized key range.
func (r *RocksDB) CompactRange(start, end Key) {
	C.rocksdb_compact_range(r.rdb, bytesPointer(start), (C.size_t)(len(start)),
		bytesPointer(end), (C.size_t)(len(end)))
}