id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
sequencelengths
21
1.41k
docstring
stringlengths
6
2.61k
docstring_tokens
sequencelengths
3
215
sha
stringlengths
40
40
url
stringlengths
85
252
151,400
stathat/consistent
consistent.go
Add
func (c *Consistent) Add(elt string) { c.Lock() defer c.Unlock() c.add(elt) }
go
func (c *Consistent) Add(elt string) { c.Lock() defer c.Unlock() c.add(elt) }
[ "func", "(", "c", "*", "Consistent", ")", "Add", "(", "elt", "string", ")", "{", "c", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "Unlock", "(", ")", "\n", "c", ".", "add", "(", "elt", ")", "\n", "}" ]
// Add inserts a string element in the consistent hash.
[ "Add", "inserts", "a", "string", "element", "in", "the", "consistent", "hash", "." ]
ad91dc4a3a642859730ff3d65929fce009bfdc23
https://github.com/stathat/consistent/blob/ad91dc4a3a642859730ff3d65929fce009bfdc23/consistent.go#L74-L78
151,401
stathat/consistent
consistent.go
Remove
func (c *Consistent) Remove(elt string) { c.Lock() defer c.Unlock() c.remove(elt) }
go
func (c *Consistent) Remove(elt string) { c.Lock() defer c.Unlock() c.remove(elt) }
[ "func", "(", "c", "*", "Consistent", ")", "Remove", "(", "elt", "string", ")", "{", "c", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "Unlock", "(", ")", "\n", "c", ".", "remove", "(", "elt", ")", "\n", "}" ]
// Remove removes an element from the hash.
[ "Remove", "removes", "an", "element", "from", "the", "hash", "." ]
ad91dc4a3a642859730ff3d65929fce009bfdc23
https://github.com/stathat/consistent/blob/ad91dc4a3a642859730ff3d65929fce009bfdc23/consistent.go#L91-L95
151,402
stathat/consistent
consistent.go
Set
func (c *Consistent) Set(elts []string) { c.Lock() defer c.Unlock() for k := range c.members { found := false for _, v := range elts { if k == v { found = true break } } if !found { c.remove(k) } } for _, v := range elts { _, exists := c.members[v] if exists { continue } c.add(v) } }
go
func (c *Consistent) Set(elts []string) { c.Lock() defer c.Unlock() for k := range c.members { found := false for _, v := range elts { if k == v { found = true break } } if !found { c.remove(k) } } for _, v := range elts { _, exists := c.members[v] if exists { continue } c.add(v) } }
[ "func", "(", "c", "*", "Consistent", ")", "Set", "(", "elts", "[", "]", "string", ")", "{", "c", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "Unlock", "(", ")", "\n", "for", "k", ":=", "range", "c", ".", "members", "{", "found", ":=", "false", "\n", "for", "_", ",", "v", ":=", "range", "elts", "{", "if", "k", "==", "v", "{", "found", "=", "true", "\n", "break", "\n", "}", "\n", "}", "\n", "if", "!", "found", "{", "c", ".", "remove", "(", "k", ")", "\n", "}", "\n", "}", "\n", "for", "_", ",", "v", ":=", "range", "elts", "{", "_", ",", "exists", ":=", "c", ".", "members", "[", "v", "]", "\n", "if", "exists", "{", "continue", "\n", "}", "\n", "c", ".", "add", "(", "v", ")", "\n", "}", "\n", "}" ]
// Set sets all the elements in the hash. If there are existing elements not // present in elts, they will be removed.
[ "Set", "sets", "all", "the", "elements", "in", "the", "hash", ".", "If", "there", "are", "existing", "elements", "not", "present", "in", "elts", "they", "will", "be", "removed", "." ]
ad91dc4a3a642859730ff3d65929fce009bfdc23
https://github.com/stathat/consistent/blob/ad91dc4a3a642859730ff3d65929fce009bfdc23/consistent.go#L109-L131
151,403
stathat/consistent
consistent.go
Get
func (c *Consistent) Get(name string) (string, error) { c.RLock() defer c.RUnlock() if len(c.circle) == 0 { return "", ErrEmptyCircle } key := c.hashKey(name) i := c.search(key) return c.circle[c.sortedHashes[i]], nil }
go
func (c *Consistent) Get(name string) (string, error) { c.RLock() defer c.RUnlock() if len(c.circle) == 0 { return "", ErrEmptyCircle } key := c.hashKey(name) i := c.search(key) return c.circle[c.sortedHashes[i]], nil }
[ "func", "(", "c", "*", "Consistent", ")", "Get", "(", "name", "string", ")", "(", "string", ",", "error", ")", "{", "c", ".", "RLock", "(", ")", "\n", "defer", "c", ".", "RUnlock", "(", ")", "\n", "if", "len", "(", "c", ".", "circle", ")", "==", "0", "{", "return", "\"", "\"", ",", "ErrEmptyCircle", "\n", "}", "\n", "key", ":=", "c", ".", "hashKey", "(", "name", ")", "\n", "i", ":=", "c", ".", "search", "(", "key", ")", "\n", "return", "c", ".", "circle", "[", "c", ".", "sortedHashes", "[", "i", "]", "]", ",", "nil", "\n", "}" ]
// Get returns an element close to where name hashes to in the circle.
[ "Get", "returns", "an", "element", "close", "to", "where", "name", "hashes", "to", "in", "the", "circle", "." ]
ad91dc4a3a642859730ff3d65929fce009bfdc23
https://github.com/stathat/consistent/blob/ad91dc4a3a642859730ff3d65929fce009bfdc23/consistent.go#L144-L153
151,404
stathat/consistent
consistent.go
GetTwo
func (c *Consistent) GetTwo(name string) (string, string, error) { c.RLock() defer c.RUnlock() if len(c.circle) == 0 { return "", "", ErrEmptyCircle } key := c.hashKey(name) i := c.search(key) a := c.circle[c.sortedHashes[i]] if c.count == 1 { return a, "", nil } start := i var b string for i = start + 1; i != start; i++ { if i >= len(c.sortedHashes) { i = 0 } b = c.circle[c.sortedHashes[i]] if b != a { break } } return a, b, nil }
go
func (c *Consistent) GetTwo(name string) (string, string, error) { c.RLock() defer c.RUnlock() if len(c.circle) == 0 { return "", "", ErrEmptyCircle } key := c.hashKey(name) i := c.search(key) a := c.circle[c.sortedHashes[i]] if c.count == 1 { return a, "", nil } start := i var b string for i = start + 1; i != start; i++ { if i >= len(c.sortedHashes) { i = 0 } b = c.circle[c.sortedHashes[i]] if b != a { break } } return a, b, nil }
[ "func", "(", "c", "*", "Consistent", ")", "GetTwo", "(", "name", "string", ")", "(", "string", ",", "string", ",", "error", ")", "{", "c", ".", "RLock", "(", ")", "\n", "defer", "c", ".", "RUnlock", "(", ")", "\n", "if", "len", "(", "c", ".", "circle", ")", "==", "0", "{", "return", "\"", "\"", ",", "\"", "\"", ",", "ErrEmptyCircle", "\n", "}", "\n", "key", ":=", "c", ".", "hashKey", "(", "name", ")", "\n", "i", ":=", "c", ".", "search", "(", "key", ")", "\n", "a", ":=", "c", ".", "circle", "[", "c", ".", "sortedHashes", "[", "i", "]", "]", "\n\n", "if", "c", ".", "count", "==", "1", "{", "return", "a", ",", "\"", "\"", ",", "nil", "\n", "}", "\n\n", "start", ":=", "i", "\n", "var", "b", "string", "\n", "for", "i", "=", "start", "+", "1", ";", "i", "!=", "start", ";", "i", "++", "{", "if", "i", ">=", "len", "(", "c", ".", "sortedHashes", ")", "{", "i", "=", "0", "\n", "}", "\n", "b", "=", "c", ".", "circle", "[", "c", ".", "sortedHashes", "[", "i", "]", "]", "\n", "if", "b", "!=", "a", "{", "break", "\n", "}", "\n", "}", "\n", "return", "a", ",", "b", ",", "nil", "\n", "}" ]
// GetTwo returns the two closest distinct elements to the name input in the circle.
[ "GetTwo", "returns", "the", "two", "closest", "distinct", "elements", "to", "the", "name", "input", "in", "the", "circle", "." ]
ad91dc4a3a642859730ff3d65929fce009bfdc23
https://github.com/stathat/consistent/blob/ad91dc4a3a642859730ff3d65929fce009bfdc23/consistent.go#L167-L193
151,405
stathat/consistent
consistent.go
GetN
func (c *Consistent) GetN(name string, n int) ([]string, error) { c.RLock() defer c.RUnlock() if len(c.circle) == 0 { return nil, ErrEmptyCircle } if c.count < int64(n) { n = int(c.count) } var ( key = c.hashKey(name) i = c.search(key) start = i res = make([]string, 0, n) elem = c.circle[c.sortedHashes[i]] ) res = append(res, elem) if len(res) == n { return res, nil } for i = start + 1; i != start; i++ { if i >= len(c.sortedHashes) { i = 0 } elem = c.circle[c.sortedHashes[i]] if !sliceContainsMember(res, elem) { res = append(res, elem) } if len(res) == n { break } } return res, nil }
go
func (c *Consistent) GetN(name string, n int) ([]string, error) { c.RLock() defer c.RUnlock() if len(c.circle) == 0 { return nil, ErrEmptyCircle } if c.count < int64(n) { n = int(c.count) } var ( key = c.hashKey(name) i = c.search(key) start = i res = make([]string, 0, n) elem = c.circle[c.sortedHashes[i]] ) res = append(res, elem) if len(res) == n { return res, nil } for i = start + 1; i != start; i++ { if i >= len(c.sortedHashes) { i = 0 } elem = c.circle[c.sortedHashes[i]] if !sliceContainsMember(res, elem) { res = append(res, elem) } if len(res) == n { break } } return res, nil }
[ "func", "(", "c", "*", "Consistent", ")", "GetN", "(", "name", "string", ",", "n", "int", ")", "(", "[", "]", "string", ",", "error", ")", "{", "c", ".", "RLock", "(", ")", "\n", "defer", "c", ".", "RUnlock", "(", ")", "\n\n", "if", "len", "(", "c", ".", "circle", ")", "==", "0", "{", "return", "nil", ",", "ErrEmptyCircle", "\n", "}", "\n\n", "if", "c", ".", "count", "<", "int64", "(", "n", ")", "{", "n", "=", "int", "(", "c", ".", "count", ")", "\n", "}", "\n\n", "var", "(", "key", "=", "c", ".", "hashKey", "(", "name", ")", "\n", "i", "=", "c", ".", "search", "(", "key", ")", "\n", "start", "=", "i", "\n", "res", "=", "make", "(", "[", "]", "string", ",", "0", ",", "n", ")", "\n", "elem", "=", "c", ".", "circle", "[", "c", ".", "sortedHashes", "[", "i", "]", "]", "\n", ")", "\n\n", "res", "=", "append", "(", "res", ",", "elem", ")", "\n\n", "if", "len", "(", "res", ")", "==", "n", "{", "return", "res", ",", "nil", "\n", "}", "\n\n", "for", "i", "=", "start", "+", "1", ";", "i", "!=", "start", ";", "i", "++", "{", "if", "i", ">=", "len", "(", "c", ".", "sortedHashes", ")", "{", "i", "=", "0", "\n", "}", "\n", "elem", "=", "c", ".", "circle", "[", "c", ".", "sortedHashes", "[", "i", "]", "]", "\n", "if", "!", "sliceContainsMember", "(", "res", ",", "elem", ")", "{", "res", "=", "append", "(", "res", ",", "elem", ")", "\n", "}", "\n", "if", "len", "(", "res", ")", "==", "n", "{", "break", "\n", "}", "\n", "}", "\n\n", "return", "res", ",", "nil", "\n", "}" ]
// GetN returns the N closest distinct elements to the name input in the circle.
[ "GetN", "returns", "the", "N", "closest", "distinct", "elements", "to", "the", "name", "input", "in", "the", "circle", "." ]
ad91dc4a3a642859730ff3d65929fce009bfdc23
https://github.com/stathat/consistent/blob/ad91dc4a3a642859730ff3d65929fce009bfdc23/consistent.go#L196-L236
151,406
tecbot/gorocksdb
ratelimiter.go
NewRateLimiter
func NewRateLimiter(rate_bytes_per_sec, refill_period_us int64, fairness int32) *RateLimiter { return NewNativeRateLimiter(C.rocksdb_ratelimiter_create( C.int64_t(rate_bytes_per_sec), C.int64_t(refill_period_us), C.int32_t(fairness), )) }
go
func NewRateLimiter(rate_bytes_per_sec, refill_period_us int64, fairness int32) *RateLimiter { return NewNativeRateLimiter(C.rocksdb_ratelimiter_create( C.int64_t(rate_bytes_per_sec), C.int64_t(refill_period_us), C.int32_t(fairness), )) }
[ "func", "NewRateLimiter", "(", "rate_bytes_per_sec", ",", "refill_period_us", "int64", ",", "fairness", "int32", ")", "*", "RateLimiter", "{", "return", "NewNativeRateLimiter", "(", "C", ".", "rocksdb_ratelimiter_create", "(", "C", ".", "int64_t", "(", "rate_bytes_per_sec", ")", ",", "C", ".", "int64_t", "(", "refill_period_us", ")", ",", "C", ".", "int32_t", "(", "fairness", ")", ",", ")", ")", "\n", "}" ]
// NewDefaultRateLimiter creates a default RateLimiter object.
[ "NewDefaultRateLimiter", "creates", "a", "default", "RateLimiter", "object", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/ratelimiter.go#L14-L20
151,407
tecbot/gorocksdb
ratelimiter.go
Destroy
func (self *RateLimiter) Destroy() { C.rocksdb_ratelimiter_destroy(self.c) self.c = nil }
go
func (self *RateLimiter) Destroy() { C.rocksdb_ratelimiter_destroy(self.c) self.c = nil }
[ "func", "(", "self", "*", "RateLimiter", ")", "Destroy", "(", ")", "{", "C", ".", "rocksdb_ratelimiter_destroy", "(", "self", ".", "c", ")", "\n", "self", ".", "c", "=", "nil", "\n", "}" ]
// Destroy deallocates the RateLimiter object.
[ "Destroy", "deallocates", "the", "RateLimiter", "object", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/ratelimiter.go#L28-L31
151,408
tecbot/gorocksdb
dbpath.go
NewDBPath
func NewDBPath(path string, target_size uint64) *DBPath { cpath := C.CString(path) defer C.free(unsafe.Pointer(cpath)) return NewNativeDBPath(C.rocksdb_dbpath_create(cpath, C.uint64_t(target_size))) }
go
func NewDBPath(path string, target_size uint64) *DBPath { cpath := C.CString(path) defer C.free(unsafe.Pointer(cpath)) return NewNativeDBPath(C.rocksdb_dbpath_create(cpath, C.uint64_t(target_size))) }
[ "func", "NewDBPath", "(", "path", "string", ",", "target_size", "uint64", ")", "*", "DBPath", "{", "cpath", ":=", "C", ".", "CString", "(", "path", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cpath", ")", ")", "\n", "return", "NewNativeDBPath", "(", "C", ".", "rocksdb_dbpath_create", "(", "cpath", ",", "C", ".", "uint64_t", "(", "target_size", ")", ")", ")", "\n", "}" ]
// NewDBPath creates a DBPath object // with the given path and target_size.
[ "NewDBPath", "creates", "a", "DBPath", "object", "with", "the", "given", "path", "and", "target_size", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/dbpath.go#L15-L19
151,409
tecbot/gorocksdb
dbpath.go
NewDBPathsFromData
func NewDBPathsFromData(paths []string, target_sizes []uint64) []*DBPath { dbpaths := make([]*DBPath, len(paths)) for i, path := range paths { targetSize := target_sizes[i] dbpaths[i] = NewDBPath(path, targetSize) } return dbpaths }
go
func NewDBPathsFromData(paths []string, target_sizes []uint64) []*DBPath { dbpaths := make([]*DBPath, len(paths)) for i, path := range paths { targetSize := target_sizes[i] dbpaths[i] = NewDBPath(path, targetSize) } return dbpaths }
[ "func", "NewDBPathsFromData", "(", "paths", "[", "]", "string", ",", "target_sizes", "[", "]", "uint64", ")", "[", "]", "*", "DBPath", "{", "dbpaths", ":=", "make", "(", "[", "]", "*", "DBPath", ",", "len", "(", "paths", ")", ")", "\n", "for", "i", ",", "path", ":=", "range", "paths", "{", "targetSize", ":=", "target_sizes", "[", "i", "]", "\n", "dbpaths", "[", "i", "]", "=", "NewDBPath", "(", "path", ",", "targetSize", ")", "\n", "}", "\n\n", "return", "dbpaths", "\n", "}" ]
// NewDBPathsFromData creates a slice with allocated DBPath objects // from paths and target_sizes.
[ "NewDBPathsFromData", "creates", "a", "slice", "with", "allocated", "DBPath", "objects", "from", "paths", "and", "target_sizes", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/dbpath.go#L33-L41
151,410
tecbot/gorocksdb
options_read.go
Destroy
func (opts *ReadOptions) Destroy() { C.rocksdb_readoptions_destroy(opts.c) opts.c = nil }
go
func (opts *ReadOptions) Destroy() { C.rocksdb_readoptions_destroy(opts.c) opts.c = nil }
[ "func", "(", "opts", "*", "ReadOptions", ")", "Destroy", "(", ")", "{", "C", ".", "rocksdb_readoptions_destroy", "(", "opts", ".", "c", ")", "\n", "opts", ".", "c", "=", "nil", "\n", "}" ]
// Destroy deallocates the ReadOptions object.
[ "Destroy", "deallocates", "the", "ReadOptions", "object", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/options_read.go#L122-L125
151,411
tecbot/gorocksdb
transaction.go
Commit
func (transaction *Transaction) Commit() error { var ( cErr *C.char ) C.rocksdb_transaction_commit(transaction.c, &cErr) if cErr != nil { defer C.free(unsafe.Pointer(cErr)) return errors.New(C.GoString(cErr)) } return nil }
go
func (transaction *Transaction) Commit() error { var ( cErr *C.char ) C.rocksdb_transaction_commit(transaction.c, &cErr) if cErr != nil { defer C.free(unsafe.Pointer(cErr)) return errors.New(C.GoString(cErr)) } return nil }
[ "func", "(", "transaction", "*", "Transaction", ")", "Commit", "(", ")", "error", "{", "var", "(", "cErr", "*", "C", ".", "char", "\n", ")", "\n", "C", ".", "rocksdb_transaction_commit", "(", "transaction", ".", "c", ",", "&", "cErr", ")", "\n", "if", "cErr", "!=", "nil", "{", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cErr", ")", ")", "\n", "return", "errors", ".", "New", "(", "C", ".", "GoString", "(", "cErr", ")", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// Commit commits the transaction to the database.
[ "Commit", "commits", "the", "transaction", "to", "the", "database", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/transaction.go#L23-L33
151,412
tecbot/gorocksdb
transaction.go
Rollback
func (transaction *Transaction) Rollback() error { var ( cErr *C.char ) C.rocksdb_transaction_rollback(transaction.c, &cErr) if cErr != nil { defer C.free(unsafe.Pointer(cErr)) return errors.New(C.GoString(cErr)) } return nil }
go
func (transaction *Transaction) Rollback() error { var ( cErr *C.char ) C.rocksdb_transaction_rollback(transaction.c, &cErr) if cErr != nil { defer C.free(unsafe.Pointer(cErr)) return errors.New(C.GoString(cErr)) } return nil }
[ "func", "(", "transaction", "*", "Transaction", ")", "Rollback", "(", ")", "error", "{", "var", "(", "cErr", "*", "C", ".", "char", "\n", ")", "\n", "C", ".", "rocksdb_transaction_rollback", "(", "transaction", ".", "c", ",", "&", "cErr", ")", "\n\n", "if", "cErr", "!=", "nil", "{", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cErr", ")", ")", "\n", "return", "errors", ".", "New", "(", "C", ".", "GoString", "(", "cErr", ")", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// Rollback performs a rollback on the transaction.
[ "Rollback", "performs", "a", "rollback", "on", "the", "transaction", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/transaction.go#L36-L47
151,413
tecbot/gorocksdb
transaction.go
Put
func (transaction *Transaction) Put(key, value []byte) error { var ( cErr *C.char cKey = byteToChar(key) cValue = byteToChar(value) ) C.rocksdb_transaction_put( transaction.c, cKey, C.size_t(len(key)), cValue, C.size_t(len(value)), &cErr, ) if cErr != nil { defer C.free(unsafe.Pointer(cErr)) return errors.New(C.GoString(cErr)) } return nil }
go
func (transaction *Transaction) Put(key, value []byte) error { var ( cErr *C.char cKey = byteToChar(key) cValue = byteToChar(value) ) C.rocksdb_transaction_put( transaction.c, cKey, C.size_t(len(key)), cValue, C.size_t(len(value)), &cErr, ) if cErr != nil { defer C.free(unsafe.Pointer(cErr)) return errors.New(C.GoString(cErr)) } return nil }
[ "func", "(", "transaction", "*", "Transaction", ")", "Put", "(", "key", ",", "value", "[", "]", "byte", ")", "error", "{", "var", "(", "cErr", "*", "C", ".", "char", "\n", "cKey", "=", "byteToChar", "(", "key", ")", "\n", "cValue", "=", "byteToChar", "(", "value", ")", "\n", ")", "\n", "C", ".", "rocksdb_transaction_put", "(", "transaction", ".", "c", ",", "cKey", ",", "C", ".", "size_t", "(", "len", "(", "key", ")", ")", ",", "cValue", ",", "C", ".", "size_t", "(", "len", "(", "value", ")", ")", ",", "&", "cErr", ",", ")", "\n", "if", "cErr", "!=", "nil", "{", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cErr", ")", ")", "\n", "return", "errors", ".", "New", "(", "C", ".", "GoString", "(", "cErr", ")", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// Put writes data associated with a key to the transaction.
[ "Put", "writes", "data", "associated", "with", "a", "key", "to", "the", "transaction", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/transaction.go#L84-L98
151,414
tecbot/gorocksdb
transaction.go
Delete
func (transaction *Transaction) Delete(key []byte) error { var ( cErr *C.char cKey = byteToChar(key) ) C.rocksdb_transaction_delete(transaction.c, cKey, C.size_t(len(key)), &cErr) if cErr != nil { defer C.free(unsafe.Pointer(cErr)) return errors.New(C.GoString(cErr)) } return nil }
go
func (transaction *Transaction) Delete(key []byte) error { var ( cErr *C.char cKey = byteToChar(key) ) C.rocksdb_transaction_delete(transaction.c, cKey, C.size_t(len(key)), &cErr) if cErr != nil { defer C.free(unsafe.Pointer(cErr)) return errors.New(C.GoString(cErr)) } return nil }
[ "func", "(", "transaction", "*", "Transaction", ")", "Delete", "(", "key", "[", "]", "byte", ")", "error", "{", "var", "(", "cErr", "*", "C", ".", "char", "\n", "cKey", "=", "byteToChar", "(", "key", ")", "\n", ")", "\n", "C", ".", "rocksdb_transaction_delete", "(", "transaction", ".", "c", ",", "cKey", ",", "C", ".", "size_t", "(", "len", "(", "key", ")", ")", ",", "&", "cErr", ")", "\n", "if", "cErr", "!=", "nil", "{", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cErr", ")", ")", "\n", "return", "errors", ".", "New", "(", "C", ".", "GoString", "(", "cErr", ")", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// Delete removes the data associated with the key from the transaction.
[ "Delete", "removes", "the", "data", "associated", "with", "the", "key", "from", "the", "transaction", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/transaction.go#L101-L112
151,415
tecbot/gorocksdb
transaction.go
NewIterator
func (transaction *Transaction) NewIterator(opts *ReadOptions) *Iterator { return NewNativeIterator( unsafe.Pointer(C.rocksdb_transaction_create_iterator(transaction.c, opts.c))) }
go
func (transaction *Transaction) NewIterator(opts *ReadOptions) *Iterator { return NewNativeIterator( unsafe.Pointer(C.rocksdb_transaction_create_iterator(transaction.c, opts.c))) }
[ "func", "(", "transaction", "*", "Transaction", ")", "NewIterator", "(", "opts", "*", "ReadOptions", ")", "*", "Iterator", "{", "return", "NewNativeIterator", "(", "unsafe", ".", "Pointer", "(", "C", ".", "rocksdb_transaction_create_iterator", "(", "transaction", ".", "c", ",", "opts", ".", "c", ")", ")", ")", "\n", "}" ]
// NewIterator returns an Iterator over the database that uses the // ReadOptions given.
[ "NewIterator", "returns", "an", "Iterator", "over", "the", "database", "that", "uses", "the", "ReadOptions", "given", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/transaction.go#L116-L119
151,416
tecbot/gorocksdb
transaction.go
Destroy
func (transaction *Transaction) Destroy() { C.rocksdb_transaction_destroy(transaction.c) transaction.c = nil }
go
func (transaction *Transaction) Destroy() { C.rocksdb_transaction_destroy(transaction.c) transaction.c = nil }
[ "func", "(", "transaction", "*", "Transaction", ")", "Destroy", "(", ")", "{", "C", ".", "rocksdb_transaction_destroy", "(", "transaction", ".", "c", ")", "\n", "transaction", ".", "c", "=", "nil", "\n", "}" ]
// Destroy deallocates the transaction object.
[ "Destroy", "deallocates", "the", "transaction", "object", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/transaction.go#L122-L125
151,417
tecbot/gorocksdb
backup.go
GetTimestamp
func (b *BackupEngineInfo) GetTimestamp(index int) int64 { return int64(C.rocksdb_backup_engine_info_timestamp(b.c, C.int(index))) }
go
func (b *BackupEngineInfo) GetTimestamp(index int) int64 { return int64(C.rocksdb_backup_engine_info_timestamp(b.c, C.int(index))) }
[ "func", "(", "b", "*", "BackupEngineInfo", ")", "GetTimestamp", "(", "index", "int", ")", "int64", "{", "return", "int64", "(", "C", ".", "rocksdb_backup_engine_info_timestamp", "(", "b", ".", "c", ",", "C", ".", "int", "(", "index", ")", ")", ")", "\n", "}" ]
// GetTimestamp gets the timestamp at which the backup index was taken.
[ "GetTimestamp", "gets", "the", "timestamp", "at", "which", "the", "backup", "index", "was", "taken", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/backup.go#L24-L26
151,418
tecbot/gorocksdb
backup.go
GetBackupId
func (b *BackupEngineInfo) GetBackupId(index int) int64 { return int64(C.rocksdb_backup_engine_info_backup_id(b.c, C.int(index))) }
go
func (b *BackupEngineInfo) GetBackupId(index int) int64 { return int64(C.rocksdb_backup_engine_info_backup_id(b.c, C.int(index))) }
[ "func", "(", "b", "*", "BackupEngineInfo", ")", "GetBackupId", "(", "index", "int", ")", "int64", "{", "return", "int64", "(", "C", ".", "rocksdb_backup_engine_info_backup_id", "(", "b", ".", "c", ",", "C", ".", "int", "(", "index", ")", ")", ")", "\n", "}" ]
// GetBackupId gets an id that uniquely identifies a backup // regardless of its position.
[ "GetBackupId", "gets", "an", "id", "that", "uniquely", "identifies", "a", "backup", "regardless", "of", "its", "position", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/backup.go#L30-L32
151,419
tecbot/gorocksdb
backup.go
GetSize
func (b *BackupEngineInfo) GetSize(index int) int64 { return int64(C.rocksdb_backup_engine_info_size(b.c, C.int(index))) }
go
func (b *BackupEngineInfo) GetSize(index int) int64 { return int64(C.rocksdb_backup_engine_info_size(b.c, C.int(index))) }
[ "func", "(", "b", "*", "BackupEngineInfo", ")", "GetSize", "(", "index", "int", ")", "int64", "{", "return", "int64", "(", "C", ".", "rocksdb_backup_engine_info_size", "(", "b", ".", "c", ",", "C", ".", "int", "(", "index", ")", ")", ")", "\n", "}" ]
// GetSize get the size of the backup in bytes.
[ "GetSize", "get", "the", "size", "of", "the", "backup", "in", "bytes", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/backup.go#L35-L37
151,420
tecbot/gorocksdb
backup.go
GetNumFiles
func (b *BackupEngineInfo) GetNumFiles(index int) int32 { return int32(C.rocksdb_backup_engine_info_number_files(b.c, C.int(index))) }
go
func (b *BackupEngineInfo) GetNumFiles(index int) int32 { return int32(C.rocksdb_backup_engine_info_number_files(b.c, C.int(index))) }
[ "func", "(", "b", "*", "BackupEngineInfo", ")", "GetNumFiles", "(", "index", "int", ")", "int32", "{", "return", "int32", "(", "C", ".", "rocksdb_backup_engine_info_number_files", "(", "b", ".", "c", ",", "C", ".", "int", "(", "index", ")", ")", ")", "\n", "}" ]
// GetNumFiles gets the number of files in the backup index.
[ "GetNumFiles", "gets", "the", "number", "of", "files", "in", "the", "backup", "index", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/backup.go#L40-L42
151,421
tecbot/gorocksdb
backup.go
Destroy
func (b *BackupEngineInfo) Destroy() { C.rocksdb_backup_engine_info_destroy(b.c) b.c = nil }
go
func (b *BackupEngineInfo) Destroy() { C.rocksdb_backup_engine_info_destroy(b.c) b.c = nil }
[ "func", "(", "b", "*", "BackupEngineInfo", ")", "Destroy", "(", ")", "{", "C", ".", "rocksdb_backup_engine_info_destroy", "(", "b", ".", "c", ")", "\n", "b", ".", "c", "=", "nil", "\n", "}" ]
// Destroy destroys the backup engine info instance.
[ "Destroy", "destroys", "the", "backup", "engine", "info", "instance", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/backup.go#L45-L48
151,422
tecbot/gorocksdb
backup.go
SetKeepLogFiles
func (ro *RestoreOptions) SetKeepLogFiles(v int) { C.rocksdb_restore_options_set_keep_log_files(ro.c, C.int(v)) }
go
func (ro *RestoreOptions) SetKeepLogFiles(v int) { C.rocksdb_restore_options_set_keep_log_files(ro.c, C.int(v)) }
[ "func", "(", "ro", "*", "RestoreOptions", ")", "SetKeepLogFiles", "(", "v", "int", ")", "{", "C", ".", "rocksdb_restore_options_set_keep_log_files", "(", "ro", ".", "c", ",", "C", ".", "int", "(", "v", ")", ")", "\n", "}" ]
// SetKeepLogFiles is used to set or unset the keep_log_files option // If true, restore won't overwrite the existing log files in wal_dir. It will // also move all log files from archive directory to wal_dir. // By default, this is false.
[ "SetKeepLogFiles", "is", "used", "to", "set", "or", "unset", "the", "keep_log_files", "option", "If", "true", "restore", "won", "t", "overwrite", "the", "existing", "log", "files", "in", "wal_dir", ".", "It", "will", "also", "move", "all", "log", "files", "from", "archive", "directory", "to", "wal_dir", ".", "By", "default", "this", "is", "false", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/backup.go#L67-L69
151,423
tecbot/gorocksdb
backup.go
OpenBackupEngine
func OpenBackupEngine(opts *Options, path string) (*BackupEngine, error) { var cErr *C.char cpath := C.CString(path) defer C.free(unsafe.Pointer(cpath)) be := C.rocksdb_backup_engine_open(opts.c, cpath, &cErr) if cErr != nil { defer C.free(unsafe.Pointer(cErr)) return nil, errors.New(C.GoString(cErr)) } return &BackupEngine{ c: be, path: path, opts: opts, }, nil }
go
func OpenBackupEngine(opts *Options, path string) (*BackupEngine, error) { var cErr *C.char cpath := C.CString(path) defer C.free(unsafe.Pointer(cpath)) be := C.rocksdb_backup_engine_open(opts.c, cpath, &cErr) if cErr != nil { defer C.free(unsafe.Pointer(cErr)) return nil, errors.New(C.GoString(cErr)) } return &BackupEngine{ c: be, path: path, opts: opts, }, nil }
[ "func", "OpenBackupEngine", "(", "opts", "*", "Options", ",", "path", "string", ")", "(", "*", "BackupEngine", ",", "error", ")", "{", "var", "cErr", "*", "C", ".", "char", "\n", "cpath", ":=", "C", ".", "CString", "(", "path", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cpath", ")", ")", "\n\n", "be", ":=", "C", ".", "rocksdb_backup_engine_open", "(", "opts", ".", "c", ",", "cpath", ",", "&", "cErr", ")", "\n", "if", "cErr", "!=", "nil", "{", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cErr", ")", ")", "\n", "return", "nil", ",", "errors", ".", "New", "(", "C", ".", "GoString", "(", "cErr", ")", ")", "\n", "}", "\n", "return", "&", "BackupEngine", "{", "c", ":", "be", ",", "path", ":", "path", ",", "opts", ":", "opts", ",", "}", ",", "nil", "\n", "}" ]
// OpenBackupEngine opens a backup engine with specified options.
[ "OpenBackupEngine", "opens", "a", "backup", "engine", "with", "specified", "options", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/backup.go#L85-L100
151,424
tecbot/gorocksdb
backup.go
CreateNewBackup
func (b *BackupEngine) CreateNewBackup(db *DB) error { var cErr *C.char C.rocksdb_backup_engine_create_new_backup(b.c, db.c, &cErr) if cErr != nil { defer C.free(unsafe.Pointer(cErr)) return errors.New(C.GoString(cErr)) } return nil }
go
func (b *BackupEngine) CreateNewBackup(db *DB) error { var cErr *C.char C.rocksdb_backup_engine_create_new_backup(b.c, db.c, &cErr) if cErr != nil { defer C.free(unsafe.Pointer(cErr)) return errors.New(C.GoString(cErr)) } return nil }
[ "func", "(", "b", "*", "BackupEngine", ")", "CreateNewBackup", "(", "db", "*", "DB", ")", "error", "{", "var", "cErr", "*", "C", ".", "char", "\n\n", "C", ".", "rocksdb_backup_engine_create_new_backup", "(", "b", ".", "c", ",", "db", ".", "c", ",", "&", "cErr", ")", "\n", "if", "cErr", "!=", "nil", "{", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cErr", ")", ")", "\n", "return", "errors", ".", "New", "(", "C", ".", "GoString", "(", "cErr", ")", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
// CreateNewBackup takes a new backup from db.
[ "CreateNewBackup", "takes", "a", "new", "backup", "from", "db", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/backup.go#L108-L118
151,425
tecbot/gorocksdb
backup.go
GetInfo
func (b *BackupEngine) GetInfo() *BackupEngineInfo { return &BackupEngineInfo{ c: C.rocksdb_backup_engine_get_backup_info(b.c), } }
go
func (b *BackupEngine) GetInfo() *BackupEngineInfo { return &BackupEngineInfo{ c: C.rocksdb_backup_engine_get_backup_info(b.c), } }
[ "func", "(", "b", "*", "BackupEngine", ")", "GetInfo", "(", ")", "*", "BackupEngineInfo", "{", "return", "&", "BackupEngineInfo", "{", "c", ":", "C", ".", "rocksdb_backup_engine_get_backup_info", "(", "b", ".", "c", ")", ",", "}", "\n", "}" ]
// GetInfo gets an object that gives information about // the backups that have already been taken
[ "GetInfo", "gets", "an", "object", "that", "gives", "information", "about", "the", "backups", "that", "have", "already", "been", "taken" ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/backup.go#L122-L126
151,426
tecbot/gorocksdb
backup.go
Close
func (b *BackupEngine) Close() { C.rocksdb_backup_engine_close(b.c) b.c = nil }
go
func (b *BackupEngine) Close() { C.rocksdb_backup_engine_close(b.c) b.c = nil }
[ "func", "(", "b", "*", "BackupEngine", ")", "Close", "(", ")", "{", "C", ".", "rocksdb_backup_engine_close", "(", "b", ".", "c", ")", "\n", "b", ".", "c", "=", "nil", "\n", "}" ]
// Close close the backup engine and cleans up state // The backups already taken remain on storage.
[ "Close", "close", "the", "backup", "engine", "and", "cleans", "up", "state", "The", "backups", "already", "taken", "remain", "on", "storage", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/backup.go#L149-L152
151,427
tecbot/gorocksdb
options_env.go
Destroy
func (opts *EnvOptions) Destroy() { C.rocksdb_envoptions_destroy(opts.c) opts.c = nil }
go
func (opts *EnvOptions) Destroy() { C.rocksdb_envoptions_destroy(opts.c) opts.c = nil }
[ "func", "(", "opts", "*", "EnvOptions", ")", "Destroy", "(", ")", "{", "C", ".", "rocksdb_envoptions_destroy", "(", "opts", ".", "c", ")", "\n", "opts", ".", "c", "=", "nil", "\n", "}" ]
// Destroy deallocates the EnvOptions object.
[ "Destroy", "deallocates", "the", "EnvOptions", "object", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/options_env.go#L22-L25
151,428
tecbot/gorocksdb
sst_file_writer.go
NewSSTFileWriter
func NewSSTFileWriter(opts *EnvOptions, dbOpts *Options) *SSTFileWriter { c := C.rocksdb_sstfilewriter_create(opts.c, dbOpts.c) return &SSTFileWriter{c: c} }
go
func NewSSTFileWriter(opts *EnvOptions, dbOpts *Options) *SSTFileWriter { c := C.rocksdb_sstfilewriter_create(opts.c, dbOpts.c) return &SSTFileWriter{c: c} }
[ "func", "NewSSTFileWriter", "(", "opts", "*", "EnvOptions", ",", "dbOpts", "*", "Options", ")", "*", "SSTFileWriter", "{", "c", ":=", "C", ".", "rocksdb_sstfilewriter_create", "(", "opts", ".", "c", ",", "dbOpts", ".", "c", ")", "\n", "return", "&", "SSTFileWriter", "{", "c", ":", "c", "}", "\n", "}" ]
// NewSSTFileWriter creates an SSTFileWriter object.
[ "NewSSTFileWriter", "creates", "an", "SSTFileWriter", "object", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/sst_file_writer.go#L19-L22
151,429
tecbot/gorocksdb
sst_file_writer.go
Open
func (w *SSTFileWriter) Open(path string) error { var ( cErr *C.char cPath = C.CString(path) ) defer C.free(unsafe.Pointer(cPath)) C.rocksdb_sstfilewriter_open(w.c, cPath, &cErr) if cErr != nil { defer C.free(unsafe.Pointer(cErr)) return errors.New(C.GoString(cErr)) } return nil }
go
func (w *SSTFileWriter) Open(path string) error { var ( cErr *C.char cPath = C.CString(path) ) defer C.free(unsafe.Pointer(cPath)) C.rocksdb_sstfilewriter_open(w.c, cPath, &cErr) if cErr != nil { defer C.free(unsafe.Pointer(cErr)) return errors.New(C.GoString(cErr)) } return nil }
[ "func", "(", "w", "*", "SSTFileWriter", ")", "Open", "(", "path", "string", ")", "error", "{", "var", "(", "cErr", "*", "C", ".", "char", "\n", "cPath", "=", "C", ".", "CString", "(", "path", ")", "\n", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cPath", ")", ")", "\n", "C", ".", "rocksdb_sstfilewriter_open", "(", "w", ".", "c", ",", "cPath", ",", "&", "cErr", ")", "\n", "if", "cErr", "!=", "nil", "{", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cErr", ")", ")", "\n", "return", "errors", ".", "New", "(", "C", ".", "GoString", "(", "cErr", ")", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// Open prepares SstFileWriter to write into file located at "path".
[ "Open", "prepares", "SstFileWriter", "to", "write", "into", "file", "located", "at", "path", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/sst_file_writer.go#L25-L37
151,430
tecbot/gorocksdb
sst_file_writer.go
Finish
func (w *SSTFileWriter) Finish() error { var cErr *C.char C.rocksdb_sstfilewriter_finish(w.c, &cErr) if cErr != nil { defer C.free(unsafe.Pointer(cErr)) return errors.New(C.GoString(cErr)) } return nil }
go
func (w *SSTFileWriter) Finish() error { var cErr *C.char C.rocksdb_sstfilewriter_finish(w.c, &cErr) if cErr != nil { defer C.free(unsafe.Pointer(cErr)) return errors.New(C.GoString(cErr)) } return nil }
[ "func", "(", "w", "*", "SSTFileWriter", ")", "Finish", "(", ")", "error", "{", "var", "cErr", "*", "C", ".", "char", "\n", "C", ".", "rocksdb_sstfilewriter_finish", "(", "w", ".", "c", ",", "&", "cErr", ")", "\n", "if", "cErr", "!=", "nil", "{", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cErr", ")", ")", "\n", "return", "errors", ".", "New", "(", "C", ".", "GoString", "(", "cErr", ")", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// Finish finishes writing to sst file and close file.
[ "Finish", "finishes", "writing", "to", "sst", "file", "and", "close", "file", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/sst_file_writer.go#L54-L62
151,431
tecbot/gorocksdb
options_transactiondb.go
Destroy
func (opts *TransactionDBOptions) Destroy() { C.rocksdb_transactiondb_options_destroy(opts.c) opts.c = nil }
go
func (opts *TransactionDBOptions) Destroy() { C.rocksdb_transactiondb_options_destroy(opts.c) opts.c = nil }
[ "func", "(", "opts", "*", "TransactionDBOptions", ")", "Destroy", "(", ")", "{", "C", ".", "rocksdb_transactiondb_options_destroy", "(", "opts", ".", "c", ")", "\n", "opts", ".", "c", "=", "nil", "\n", "}" ]
// Destroy deallocates the TransactionDBOptions object.
[ "Destroy", "deallocates", "the", "TransactionDBOptions", "object", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/options_transactiondb.go#L69-L72
151,432
tecbot/gorocksdb
cache.go
NewLRUCache
func NewLRUCache(capacity int) *Cache { return NewNativeCache(C.rocksdb_cache_create_lru(C.size_t(capacity))) }
go
func NewLRUCache(capacity int) *Cache { return NewNativeCache(C.rocksdb_cache_create_lru(C.size_t(capacity))) }
[ "func", "NewLRUCache", "(", "capacity", "int", ")", "*", "Cache", "{", "return", "NewNativeCache", "(", "C", ".", "rocksdb_cache_create_lru", "(", "C", ".", "size_t", "(", "capacity", ")", ")", ")", "\n", "}" ]
// NewLRUCache creates a new LRU Cache object with the capacity given.
[ "NewLRUCache", "creates", "a", "new", "LRU", "Cache", "object", "with", "the", "capacity", "given", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/cache.go#L12-L14
151,433
tecbot/gorocksdb
cache.go
Destroy
func (c *Cache) Destroy() { C.rocksdb_cache_destroy(c.c) c.c = nil }
go
func (c *Cache) Destroy() { C.rocksdb_cache_destroy(c.c) c.c = nil }
[ "func", "(", "c", "*", "Cache", ")", "Destroy", "(", ")", "{", "C", ".", "rocksdb_cache_destroy", "(", "c", ".", "c", ")", "\n", "c", ".", "c", "=", "nil", "\n", "}" ]
// Destroy deallocates the Cache object.
[ "Destroy", "deallocates", "the", "Cache", "object", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/cache.go#L32-L35
151,434
tecbot/gorocksdb
options_block_based_table.go
Destroy
func (opts *BlockBasedTableOptions) Destroy() { C.rocksdb_block_based_options_destroy(opts.c) opts.c = nil opts.cache = nil opts.compCache = nil }
go
func (opts *BlockBasedTableOptions) Destroy() { C.rocksdb_block_based_options_destroy(opts.c) opts.c = nil opts.cache = nil opts.compCache = nil }
[ "func", "(", "opts", "*", "BlockBasedTableOptions", ")", "Destroy", "(", ")", "{", "C", ".", "rocksdb_block_based_options_destroy", "(", "opts", ".", "c", ")", "\n", "opts", ".", "c", "=", "nil", "\n", "opts", ".", "cache", "=", "nil", "\n", "opts", ".", "compCache", "=", "nil", "\n", "}" ]
// Destroy deallocates the BlockBasedTableOptions object.
[ "Destroy", "deallocates", "the", "BlockBasedTableOptions", "object", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/options_block_based_table.go#L44-L49
151,435
tecbot/gorocksdb
options_compaction.go
Destroy
func (opts *UniversalCompactionOptions) Destroy() { C.rocksdb_universal_compaction_options_destroy(opts.c) opts.c = nil }
go
func (opts *UniversalCompactionOptions) Destroy() { C.rocksdb_universal_compaction_options_destroy(opts.c) opts.c = nil }
[ "func", "(", "opts", "*", "UniversalCompactionOptions", ")", "Destroy", "(", ")", "{", "C", ".", "rocksdb_universal_compaction_options_destroy", "(", "opts", ".", "c", ")", "\n", "opts", ".", "c", "=", "nil", "\n", "}" ]
// Destroy deallocates the UniversalCompactionOptions object.
[ "Destroy", "deallocates", "the", "UniversalCompactionOptions", "object", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/options_compaction.go#L127-L130
151,436
tecbot/gorocksdb
slice.go
NewSlice
func NewSlice(data *C.char, size C.size_t) *Slice { return &Slice{data, size, false} }
go
func NewSlice(data *C.char, size C.size_t) *Slice { return &Slice{data, size, false} }
[ "func", "NewSlice", "(", "data", "*", "C", ".", "char", ",", "size", "C", ".", "size_t", ")", "*", "Slice", "{", "return", "&", "Slice", "{", "data", ",", "size", ",", "false", "}", "\n", "}" ]
// NewSlice returns a slice with the given data.
[ "NewSlice", "returns", "a", "slice", "with", "the", "given", "data", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/slice.go#L23-L25
151,437
tecbot/gorocksdb
slice.go
StringToSlice
func StringToSlice(data string) *Slice { return NewSlice(C.CString(data), C.size_t(len(data))) }
go
func StringToSlice(data string) *Slice { return NewSlice(C.CString(data), C.size_t(len(data))) }
[ "func", "StringToSlice", "(", "data", "string", ")", "*", "Slice", "{", "return", "NewSlice", "(", "C", ".", "CString", "(", "data", ")", ",", "C", ".", "size_t", "(", "len", "(", "data", ")", ")", ")", "\n", "}" ]
// StringToSlice is similar to NewSlice, but can be called with // a Go string type. This exists to make testing integration // with Gorocksdb easier.
[ "StringToSlice", "is", "similar", "to", "NewSlice", "but", "can", "be", "called", "with", "a", "Go", "string", "type", ".", "This", "exists", "to", "make", "testing", "integration", "with", "Gorocksdb", "easier", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/slice.go#L30-L32
151,438
tecbot/gorocksdb
slice.go
Free
func (s *Slice) Free() { if !s.freed { C.free(unsafe.Pointer(s.data)) s.freed = true } }
go
func (s *Slice) Free() { if !s.freed { C.free(unsafe.Pointer(s.data)) s.freed = true } }
[ "func", "(", "s", "*", "Slice", ")", "Free", "(", ")", "{", "if", "!", "s", ".", "freed", "{", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "s", ".", "data", ")", ")", "\n", "s", ".", "freed", "=", "true", "\n", "}", "\n", "}" ]
// Free frees the slice data.
[ "Free", "frees", "the", "slice", "data", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/slice.go#L45-L50
151,439
tecbot/gorocksdb
options.go
IncreaseParallelism
func (opts *Options) IncreaseParallelism(total_threads int) { C.rocksdb_options_increase_parallelism(opts.c, C.int(total_threads)) }
go
func (opts *Options) IncreaseParallelism(total_threads int) { C.rocksdb_options_increase_parallelism(opts.c, C.int(total_threads)) }
[ "func", "(", "opts", "*", "Options", ")", "IncreaseParallelism", "(", "total_threads", "int", ")", "{", "C", ".", "rocksdb_options_increase_parallelism", "(", "opts", ".", "c", ",", "C", ".", "int", "(", "total_threads", ")", ")", "\n", "}" ]
// IncreaseParallelism sets the parallelism. // // By default, RocksDB uses only one background thread for flush and // compaction. Calling this function will set it up such that total of // `total_threads` is used. Good value for `total_threads` is the number of // cores. You almost definitely want to call this function if your system is // bottlenecked by RocksDB.
[ "IncreaseParallelism", "sets", "the", "parallelism", ".", "By", "default", "RocksDB", "uses", "only", "one", "background", "thread", "for", "flush", "and", "compaction", ".", "Calling", "this", "function", "will", "set", "it", "up", "such", "that", "total", "of", "total_threads", "is", "used", ".", "Good", "value", "for", "total_threads", "is", "the", "number", "of", "cores", ".", "You", "almost", "definitely", "want", "to", "call", "this", "function", "if", "your", "system", "is", "bottlenecked", "by", "RocksDB", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/options.go#L251-L253
151,440
tecbot/gorocksdb
options.go
OptimizeUniversalStyleCompaction
func (opts *Options) OptimizeUniversalStyleCompaction(memtable_memory_budget uint64) { C.rocksdb_options_optimize_universal_style_compaction(opts.c, C.uint64_t(memtable_memory_budget)) }
go
func (opts *Options) OptimizeUniversalStyleCompaction(memtable_memory_budget uint64) { C.rocksdb_options_optimize_universal_style_compaction(opts.c, C.uint64_t(memtable_memory_budget)) }
[ "func", "(", "opts", "*", "Options", ")", "OptimizeUniversalStyleCompaction", "(", "memtable_memory_budget", "uint64", ")", "{", "C", ".", "rocksdb_options_optimize_universal_style_compaction", "(", "opts", ".", "c", ",", "C", ".", "uint64_t", "(", "memtable_memory_budget", ")", ")", "\n", "}" ]
// OptimizeUniversalStyleCompaction optimize the DB for universal compaction. // See note on OptimizeLevelStyleCompaction.
[ "OptimizeUniversalStyleCompaction", "optimize", "the", "DB", "for", "universal", "compaction", ".", "See", "note", "on", "OptimizeLevelStyleCompaction", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/options.go#L296-L298
151,441
tecbot/gorocksdb
options.go
SetMinLevelToCompress
func (opts *Options) SetMinLevelToCompress(value int) { C.rocksdb_options_set_min_level_to_compress(opts.c, C.int(value)) }
go
func (opts *Options) SetMinLevelToCompress(value int) { C.rocksdb_options_set_min_level_to_compress(opts.c, C.int(value)) }
[ "func", "(", "opts", "*", "Options", ")", "SetMinLevelToCompress", "(", "value", "int", ")", "{", "C", ".", "rocksdb_options_set_min_level_to_compress", "(", "opts", ".", "c", ",", "C", ".", "int", "(", "value", ")", ")", "\n", "}" ]
// SetMinLevelToCompress sets the start level to use compression.
[ "SetMinLevelToCompress", "sets", "the", "start", "level", "to", "use", "compression", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/options.go#L391-L393
151,442
tecbot/gorocksdb
options.go
SetCreateIfMissingColumnFamilies
func (opts *Options) SetCreateIfMissingColumnFamilies(value bool) { C.rocksdb_options_set_create_missing_column_families(opts.c, boolToChar(value)) }
go
func (opts *Options) SetCreateIfMissingColumnFamilies(value bool) { C.rocksdb_options_set_create_missing_column_families(opts.c, boolToChar(value)) }
[ "func", "(", "opts", "*", "Options", ")", "SetCreateIfMissingColumnFamilies", "(", "value", "bool", ")", "{", "C", ".", "rocksdb_options_set_create_missing_column_families", "(", "opts", ".", "c", ",", "boolToChar", "(", "value", ")", ")", "\n", "}" ]
// SetCreateIfMissingColumnFamilies specifies whether the column families // should be created if they are missing.
[ "SetCreateIfMissingColumnFamilies", "specifies", "whether", "the", "column", "families", "should", "be", "created", "if", "they", "are", "missing", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/options.go#L1086-L1088
151,443
tecbot/gorocksdb
options.go
SetBlockBasedTableFactory
func (opts *Options) SetBlockBasedTableFactory(value *BlockBasedTableOptions) { opts.bbto = value C.rocksdb_options_set_block_based_table_factory(opts.c, value.c) }
go
func (opts *Options) SetBlockBasedTableFactory(value *BlockBasedTableOptions) { opts.bbto = value C.rocksdb_options_set_block_based_table_factory(opts.c, value.c) }
[ "func", "(", "opts", "*", "Options", ")", "SetBlockBasedTableFactory", "(", "value", "*", "BlockBasedTableOptions", ")", "{", "opts", ".", "bbto", "=", "value", "\n", "C", ".", "rocksdb_options_set_block_based_table_factory", "(", "opts", ".", "c", ",", "value", ".", "c", ")", "\n", "}" ]
// SetBlockBasedTableFactory sets the block based table factory.
[ "SetBlockBasedTableFactory", "sets", "the", "block", "based", "table", "factory", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/options.go#L1091-L1094
151,444
tecbot/gorocksdb
options.go
Destroy
func (opts *Options) Destroy() { C.rocksdb_options_destroy(opts.c) if opts.ccmp != nil { C.rocksdb_comparator_destroy(opts.ccmp) } if opts.cst != nil { C.rocksdb_slicetransform_destroy(opts.cst) } if opts.ccf != nil { C.rocksdb_compactionfilter_destroy(opts.ccf) } opts.c = nil opts.env = nil opts.bbto = nil }
go
func (opts *Options) Destroy() { C.rocksdb_options_destroy(opts.c) if opts.ccmp != nil { C.rocksdb_comparator_destroy(opts.ccmp) } if opts.cst != nil { C.rocksdb_slicetransform_destroy(opts.cst) } if opts.ccf != nil { C.rocksdb_compactionfilter_destroy(opts.ccf) } opts.c = nil opts.env = nil opts.bbto = nil }
[ "func", "(", "opts", "*", "Options", ")", "Destroy", "(", ")", "{", "C", ".", "rocksdb_options_destroy", "(", "opts", ".", "c", ")", "\n", "if", "opts", ".", "ccmp", "!=", "nil", "{", "C", ".", "rocksdb_comparator_destroy", "(", "opts", ".", "ccmp", ")", "\n", "}", "\n", "if", "opts", ".", "cst", "!=", "nil", "{", "C", ".", "rocksdb_slicetransform_destroy", "(", "opts", ".", "cst", ")", "\n", "}", "\n", "if", "opts", ".", "ccf", "!=", "nil", "{", "C", ".", "rocksdb_compactionfilter_destroy", "(", "opts", ".", "ccf", ")", "\n", "}", "\n", "opts", ".", "c", "=", "nil", "\n", "opts", ".", "env", "=", "nil", "\n", "opts", ".", "bbto", "=", "nil", "\n", "}" ]
// Destroy deallocates the Options object.
[ "Destroy", "deallocates", "the", "Options", "object", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/options.go#L1112-L1126
151,445
tecbot/gorocksdb
options_ingest.go
SetMoveFiles
func (opts *IngestExternalFileOptions) SetMoveFiles(flag bool) { C.rocksdb_ingestexternalfileoptions_set_move_files(opts.c, boolToChar(flag)) }
go
func (opts *IngestExternalFileOptions) SetMoveFiles(flag bool) { C.rocksdb_ingestexternalfileoptions_set_move_files(opts.c, boolToChar(flag)) }
[ "func", "(", "opts", "*", "IngestExternalFileOptions", ")", "SetMoveFiles", "(", "flag", "bool", ")", "{", "C", ".", "rocksdb_ingestexternalfileoptions_set_move_files", "(", "opts", ".", "c", ",", "boolToChar", "(", "flag", ")", ")", "\n", "}" ]
// SetMoveFiles specifies if it should move the files instead of copying them. // Default to false.
[ "SetMoveFiles", "specifies", "if", "it", "should", "move", "the", "files", "instead", "of", "copying", "them", ".", "Default", "to", "false", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/options_ingest.go#L23-L25
151,446
tecbot/gorocksdb
options_ingest.go
SetSnapshotConsistency
func (opts *IngestExternalFileOptions) SetSnapshotConsistency(flag bool) { C.rocksdb_ingestexternalfileoptions_set_snapshot_consistency(opts.c, boolToChar(flag)) }
go
func (opts *IngestExternalFileOptions) SetSnapshotConsistency(flag bool) { C.rocksdb_ingestexternalfileoptions_set_snapshot_consistency(opts.c, boolToChar(flag)) }
[ "func", "(", "opts", "*", "IngestExternalFileOptions", ")", "SetSnapshotConsistency", "(", "flag", "bool", ")", "{", "C", ".", "rocksdb_ingestexternalfileoptions_set_snapshot_consistency", "(", "opts", ".", "c", ",", "boolToChar", "(", "flag", ")", ")", "\n", "}" ]
// SetSnapshotConsistency if specifies the consistency. // If set to false, an ingested file key could appear in existing snapshots that were created before the // file was ingested. // Default to true.
[ "SetSnapshotConsistency", "if", "specifies", "the", "consistency", ".", "If", "set", "to", "false", "an", "ingested", "file", "key", "could", "appear", "in", "existing", "snapshots", "that", "were", "created", "before", "the", "file", "was", "ingested", ".", "Default", "to", "true", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/options_ingest.go#L31-L33
151,447
tecbot/gorocksdb
options_ingest.go
Destroy
func (opts *IngestExternalFileOptions) Destroy() { C.rocksdb_ingestexternalfileoptions_destroy(opts.c) opts.c = nil }
go
func (opts *IngestExternalFileOptions) Destroy() { C.rocksdb_ingestexternalfileoptions_destroy(opts.c) opts.c = nil }
[ "func", "(", "opts", "*", "IngestExternalFileOptions", ")", "Destroy", "(", ")", "{", "C", ".", "rocksdb_ingestexternalfileoptions_destroy", "(", "opts", ".", "c", ")", "\n", "opts", ".", "c", "=", "nil", "\n", "}" ]
// Destroy deallocates the IngestExternalFileOptions object.
[ "Destroy", "deallocates", "the", "IngestExternalFileOptions", "object", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/options_ingest.go#L62-L65
151,448
tecbot/gorocksdb
iterator.go
ValidForPrefix
func (iter *Iterator) ValidForPrefix(prefix []byte) bool { if C.rocksdb_iter_valid(iter.c) == 0 { return false } key := iter.Key() result := bytes.HasPrefix(key.Data(), prefix) key.Free() return result }
go
func (iter *Iterator) ValidForPrefix(prefix []byte) bool { if C.rocksdb_iter_valid(iter.c) == 0 { return false } key := iter.Key() result := bytes.HasPrefix(key.Data(), prefix) key.Free() return result }
[ "func", "(", "iter", "*", "Iterator", ")", "ValidForPrefix", "(", "prefix", "[", "]", "byte", ")", "bool", "{", "if", "C", ".", "rocksdb_iter_valid", "(", "iter", ".", "c", ")", "==", "0", "{", "return", "false", "\n", "}", "\n\n", "key", ":=", "iter", ".", "Key", "(", ")", "\n", "result", ":=", "bytes", ".", "HasPrefix", "(", "key", ".", "Data", "(", ")", ",", "prefix", ")", "\n", "key", ".", "Free", "(", ")", "\n", "return", "result", "\n", "}" ]
// ValidForPrefix returns false only when an Iterator has iterated past the // first or the last key in the database or the specified prefix.
[ "ValidForPrefix", "returns", "false", "only", "when", "an", "Iterator", "has", "iterated", "past", "the", "first", "or", "the", "last", "key", "in", "the", "database", "or", "the", "specified", "prefix", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/iterator.go#L46-L55
151,449
tecbot/gorocksdb
iterator.go
Key
func (iter *Iterator) Key() *Slice { var cLen C.size_t cKey := C.rocksdb_iter_key(iter.c, &cLen) if cKey == nil { return nil } return &Slice{cKey, cLen, true} }
go
func (iter *Iterator) Key() *Slice { var cLen C.size_t cKey := C.rocksdb_iter_key(iter.c, &cLen) if cKey == nil { return nil } return &Slice{cKey, cLen, true} }
[ "func", "(", "iter", "*", "Iterator", ")", "Key", "(", ")", "*", "Slice", "{", "var", "cLen", "C", ".", "size_t", "\n", "cKey", ":=", "C", ".", "rocksdb_iter_key", "(", "iter", ".", "c", ",", "&", "cLen", ")", "\n", "if", "cKey", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "return", "&", "Slice", "{", "cKey", ",", "cLen", ",", "true", "}", "\n", "}" ]
// Key returns the key the iterator currently holds.
[ "Key", "returns", "the", "key", "the", "iterator", "currently", "holds", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/iterator.go#L58-L65
151,450
tecbot/gorocksdb
iterator.go
Value
func (iter *Iterator) Value() *Slice { var cLen C.size_t cVal := C.rocksdb_iter_value(iter.c, &cLen) if cVal == nil { return nil } return &Slice{cVal, cLen, true} }
go
func (iter *Iterator) Value() *Slice { var cLen C.size_t cVal := C.rocksdb_iter_value(iter.c, &cLen) if cVal == nil { return nil } return &Slice{cVal, cLen, true} }
[ "func", "(", "iter", "*", "Iterator", ")", "Value", "(", ")", "*", "Slice", "{", "var", "cLen", "C", ".", "size_t", "\n", "cVal", ":=", "C", ".", "rocksdb_iter_value", "(", "iter", ".", "c", ",", "&", "cLen", ")", "\n", "if", "cVal", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "return", "&", "Slice", "{", "cVal", ",", "cLen", ",", "true", "}", "\n", "}" ]
// Value returns the value in the database the iterator currently holds.
[ "Value", "returns", "the", "value", "in", "the", "database", "the", "iterator", "currently", "holds", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/iterator.go#L68-L75
151,451
tecbot/gorocksdb
iterator.go
Seek
func (iter *Iterator) Seek(key []byte) { cKey := byteToChar(key) C.rocksdb_iter_seek(iter.c, cKey, C.size_t(len(key))) }
go
func (iter *Iterator) Seek(key []byte) { cKey := byteToChar(key) C.rocksdb_iter_seek(iter.c, cKey, C.size_t(len(key))) }
[ "func", "(", "iter", "*", "Iterator", ")", "Seek", "(", "key", "[", "]", "byte", ")", "{", "cKey", ":=", "byteToChar", "(", "key", ")", "\n", "C", ".", "rocksdb_iter_seek", "(", "iter", ".", "c", ",", "cKey", ",", "C", ".", "size_t", "(", "len", "(", "key", ")", ")", ")", "\n", "}" ]
// Seek moves the iterator to the position greater than or equal to the key.
[ "Seek", "moves", "the", "iterator", "to", "the", "position", "greater", "than", "or", "equal", "to", "the", "key", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/iterator.go#L98-L101
151,452
tecbot/gorocksdb
iterator.go
SeekForPrev
func (iter *Iterator) SeekForPrev(key []byte) { cKey := byteToChar(key) C.rocksdb_iter_seek_for_prev(iter.c, cKey, C.size_t(len(key))) }
go
func (iter *Iterator) SeekForPrev(key []byte) { cKey := byteToChar(key) C.rocksdb_iter_seek_for_prev(iter.c, cKey, C.size_t(len(key))) }
[ "func", "(", "iter", "*", "Iterator", ")", "SeekForPrev", "(", "key", "[", "]", "byte", ")", "{", "cKey", ":=", "byteToChar", "(", "key", ")", "\n", "C", ".", "rocksdb_iter_seek_for_prev", "(", "iter", ".", "c", ",", "cKey", ",", "C", ".", "size_t", "(", "len", "(", "key", ")", ")", ")", "\n", "}" ]
// SeekForPrev moves the iterator to the last key that less than or equal // to the target key, in contrast with Seek.
[ "SeekForPrev", "moves", "the", "iterator", "to", "the", "last", "key", "that", "less", "than", "or", "equal", "to", "the", "target", "key", "in", "contrast", "with", "Seek", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/iterator.go#L105-L108
151,453
tecbot/gorocksdb
write_batch.go
WriteBatchFrom
func WriteBatchFrom(data []byte) *WriteBatch { return NewNativeWriteBatch(C.rocksdb_writebatch_create_from(byteToChar(data), C.size_t(len(data)))) }
go
func WriteBatchFrom(data []byte) *WriteBatch { return NewNativeWriteBatch(C.rocksdb_writebatch_create_from(byteToChar(data), C.size_t(len(data)))) }
[ "func", "WriteBatchFrom", "(", "data", "[", "]", "byte", ")", "*", "WriteBatch", "{", "return", "NewNativeWriteBatch", "(", "C", ".", "rocksdb_writebatch_create_from", "(", "byteToChar", "(", "data", ")", ",", "C", ".", "size_t", "(", "len", "(", "data", ")", ")", ")", ")", "\n", "}" ]
// WriteBatchFrom creates a write batch from a serialized WriteBatch.
[ "WriteBatchFrom", "creates", "a", "write", "batch", "from", "a", "serialized", "WriteBatch", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/write_batch.go#L26-L28
151,454
tecbot/gorocksdb
write_batch.go
Put
func (wb *WriteBatch) Put(key, value []byte) { cKey := byteToChar(key) cValue := byteToChar(value) C.rocksdb_writebatch_put(wb.c, cKey, C.size_t(len(key)), cValue, C.size_t(len(value))) }
go
func (wb *WriteBatch) Put(key, value []byte) { cKey := byteToChar(key) cValue := byteToChar(value) C.rocksdb_writebatch_put(wb.c, cKey, C.size_t(len(key)), cValue, C.size_t(len(value))) }
[ "func", "(", "wb", "*", "WriteBatch", ")", "Put", "(", "key", ",", "value", "[", "]", "byte", ")", "{", "cKey", ":=", "byteToChar", "(", "key", ")", "\n", "cValue", ":=", "byteToChar", "(", "value", ")", "\n", "C", ".", "rocksdb_writebatch_put", "(", "wb", ".", "c", ",", "cKey", ",", "C", ".", "size_t", "(", "len", "(", "key", ")", ")", ",", "cValue", ",", "C", ".", "size_t", "(", "len", "(", "value", ")", ")", ")", "\n", "}" ]
// Put queues a key-value pair.
[ "Put", "queues", "a", "key", "-", "value", "pair", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/write_batch.go#L31-L35
151,455
tecbot/gorocksdb
write_batch.go
PutCF
func (wb *WriteBatch) PutCF(cf *ColumnFamilyHandle, key, value []byte) { cKey := byteToChar(key) cValue := byteToChar(value) C.rocksdb_writebatch_put_cf(wb.c, cf.c, cKey, C.size_t(len(key)), cValue, C.size_t(len(value))) }
go
func (wb *WriteBatch) PutCF(cf *ColumnFamilyHandle, key, value []byte) { cKey := byteToChar(key) cValue := byteToChar(value) C.rocksdb_writebatch_put_cf(wb.c, cf.c, cKey, C.size_t(len(key)), cValue, C.size_t(len(value))) }
[ "func", "(", "wb", "*", "WriteBatch", ")", "PutCF", "(", "cf", "*", "ColumnFamilyHandle", ",", "key", ",", "value", "[", "]", "byte", ")", "{", "cKey", ":=", "byteToChar", "(", "key", ")", "\n", "cValue", ":=", "byteToChar", "(", "value", ")", "\n", "C", ".", "rocksdb_writebatch_put_cf", "(", "wb", ".", "c", ",", "cf", ".", "c", ",", "cKey", ",", "C", ".", "size_t", "(", "len", "(", "key", ")", ")", ",", "cValue", ",", "C", ".", "size_t", "(", "len", "(", "value", ")", ")", ")", "\n", "}" ]
// PutCF queues a key-value pair in a column family.
[ "PutCF", "queues", "a", "key", "-", "value", "pair", "in", "a", "column", "family", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/write_batch.go#L38-L42
151,456
tecbot/gorocksdb
write_batch.go
Merge
func (wb *WriteBatch) Merge(key, value []byte) { cKey := byteToChar(key) cValue := byteToChar(value) C.rocksdb_writebatch_merge(wb.c, cKey, C.size_t(len(key)), cValue, C.size_t(len(value))) }
go
func (wb *WriteBatch) Merge(key, value []byte) { cKey := byteToChar(key) cValue := byteToChar(value) C.rocksdb_writebatch_merge(wb.c, cKey, C.size_t(len(key)), cValue, C.size_t(len(value))) }
[ "func", "(", "wb", "*", "WriteBatch", ")", "Merge", "(", "key", ",", "value", "[", "]", "byte", ")", "{", "cKey", ":=", "byteToChar", "(", "key", ")", "\n", "cValue", ":=", "byteToChar", "(", "value", ")", "\n", "C", ".", "rocksdb_writebatch_merge", "(", "wb", ".", "c", ",", "cKey", ",", "C", ".", "size_t", "(", "len", "(", "key", ")", ")", ",", "cValue", ",", "C", ".", "size_t", "(", "len", "(", "value", ")", ")", ")", "\n", "}" ]
// Merge queues a merge of "value" with the existing value of "key".
[ "Merge", "queues", "a", "merge", "of", "value", "with", "the", "existing", "value", "of", "key", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/write_batch.go#L45-L49
151,457
tecbot/gorocksdb
write_batch.go
MergeCF
func (wb *WriteBatch) MergeCF(cf *ColumnFamilyHandle, key, value []byte) { cKey := byteToChar(key) cValue := byteToChar(value) C.rocksdb_writebatch_merge_cf(wb.c, cf.c, cKey, C.size_t(len(key)), cValue, C.size_t(len(value))) }
go
func (wb *WriteBatch) MergeCF(cf *ColumnFamilyHandle, key, value []byte) { cKey := byteToChar(key) cValue := byteToChar(value) C.rocksdb_writebatch_merge_cf(wb.c, cf.c, cKey, C.size_t(len(key)), cValue, C.size_t(len(value))) }
[ "func", "(", "wb", "*", "WriteBatch", ")", "MergeCF", "(", "cf", "*", "ColumnFamilyHandle", ",", "key", ",", "value", "[", "]", "byte", ")", "{", "cKey", ":=", "byteToChar", "(", "key", ")", "\n", "cValue", ":=", "byteToChar", "(", "value", ")", "\n", "C", ".", "rocksdb_writebatch_merge_cf", "(", "wb", ".", "c", ",", "cf", ".", "c", ",", "cKey", ",", "C", ".", "size_t", "(", "len", "(", "key", ")", ")", ",", "cValue", ",", "C", ".", "size_t", "(", "len", "(", "value", ")", ")", ")", "\n", "}" ]
// MergeCF queues a merge of "value" with the existing value of "key" in a // column family.
[ "MergeCF", "queues", "a", "merge", "of", "value", "with", "the", "existing", "value", "of", "key", "in", "a", "column", "family", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/write_batch.go#L53-L57
151,458
tecbot/gorocksdb
write_batch.go
Delete
func (wb *WriteBatch) Delete(key []byte) { cKey := byteToChar(key) C.rocksdb_writebatch_delete(wb.c, cKey, C.size_t(len(key))) }
go
func (wb *WriteBatch) Delete(key []byte) { cKey := byteToChar(key) C.rocksdb_writebatch_delete(wb.c, cKey, C.size_t(len(key))) }
[ "func", "(", "wb", "*", "WriteBatch", ")", "Delete", "(", "key", "[", "]", "byte", ")", "{", "cKey", ":=", "byteToChar", "(", "key", ")", "\n", "C", ".", "rocksdb_writebatch_delete", "(", "wb", ".", "c", ",", "cKey", ",", "C", ".", "size_t", "(", "len", "(", "key", ")", ")", ")", "\n", "}" ]
// Delete queues a deletion of the data at key.
[ "Delete", "queues", "a", "deletion", "of", "the", "data", "at", "key", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/write_batch.go#L60-L63
151,459
tecbot/gorocksdb
write_batch.go
DeleteCF
func (wb *WriteBatch) DeleteCF(cf *ColumnFamilyHandle, key []byte) { cKey := byteToChar(key) C.rocksdb_writebatch_delete_cf(wb.c, cf.c, cKey, C.size_t(len(key))) }
go
func (wb *WriteBatch) DeleteCF(cf *ColumnFamilyHandle, key []byte) { cKey := byteToChar(key) C.rocksdb_writebatch_delete_cf(wb.c, cf.c, cKey, C.size_t(len(key))) }
[ "func", "(", "wb", "*", "WriteBatch", ")", "DeleteCF", "(", "cf", "*", "ColumnFamilyHandle", ",", "key", "[", "]", "byte", ")", "{", "cKey", ":=", "byteToChar", "(", "key", ")", "\n", "C", ".", "rocksdb_writebatch_delete_cf", "(", "wb", ".", "c", ",", "cf", ".", "c", ",", "cKey", ",", "C", ".", "size_t", "(", "len", "(", "key", ")", ")", ")", "\n", "}" ]
// DeleteCF queues a deletion of the data at key in a column family.
[ "DeleteCF", "queues", "a", "deletion", "of", "the", "data", "at", "key", "in", "a", "column", "family", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/write_batch.go#L66-L69
151,460
tecbot/gorocksdb
write_batch.go
Data
func (wb *WriteBatch) Data() []byte { var cSize C.size_t cValue := C.rocksdb_writebatch_data(wb.c, &cSize) return charToByte(cValue, cSize) }
go
func (wb *WriteBatch) Data() []byte { var cSize C.size_t cValue := C.rocksdb_writebatch_data(wb.c, &cSize) return charToByte(cValue, cSize) }
[ "func", "(", "wb", "*", "WriteBatch", ")", "Data", "(", ")", "[", "]", "byte", "{", "var", "cSize", "C", ".", "size_t", "\n", "cValue", ":=", "C", ".", "rocksdb_writebatch_data", "(", "wb", ".", "c", ",", "&", "cSize", ")", "\n", "return", "charToByte", "(", "cValue", ",", "cSize", ")", "\n", "}" ]
// Data returns the serialized version of this batch.
[ "Data", "returns", "the", "serialized", "version", "of", "this", "batch", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/write_batch.go#L72-L76
151,461
tecbot/gorocksdb
write_batch.go
NewIterator
func (wb *WriteBatch) NewIterator() *WriteBatchIterator { data := wb.Data() if len(data) < 8+4 { return &WriteBatchIterator{} } return &WriteBatchIterator{data: data[12:]} }
go
func (wb *WriteBatch) NewIterator() *WriteBatchIterator { data := wb.Data() if len(data) < 8+4 { return &WriteBatchIterator{} } return &WriteBatchIterator{data: data[12:]} }
[ "func", "(", "wb", "*", "WriteBatch", ")", "NewIterator", "(", ")", "*", "WriteBatchIterator", "{", "data", ":=", "wb", ".", "Data", "(", ")", "\n", "if", "len", "(", "data", ")", "<", "8", "+", "4", "{", "return", "&", "WriteBatchIterator", "{", "}", "\n", "}", "\n", "return", "&", "WriteBatchIterator", "{", "data", ":", "data", "[", "12", ":", "]", "}", "\n", "}" ]
// NewIterator returns a iterator to iterate over the records in the batch.
[ "NewIterator", "returns", "a", "iterator", "to", "iterate", "over", "the", "records", "in", "the", "batch", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/write_batch.go#L84-L90
151,462
tecbot/gorocksdb
write_batch.go
Destroy
func (wb *WriteBatch) Destroy() { C.rocksdb_writebatch_destroy(wb.c) wb.c = nil }
go
func (wb *WriteBatch) Destroy() { C.rocksdb_writebatch_destroy(wb.c) wb.c = nil }
[ "func", "(", "wb", "*", "WriteBatch", ")", "Destroy", "(", ")", "{", "C", ".", "rocksdb_writebatch_destroy", "(", "wb", ".", "c", ")", "\n", "wb", ".", "c", "=", "nil", "\n", "}" ]
// Destroy deallocates the WriteBatch object.
[ "Destroy", "deallocates", "the", "WriteBatch", "object", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/write_batch.go#L98-L101
151,463
tecbot/gorocksdb
write_batch.go
Next
func (iter *WriteBatchIterator) Next() bool { if iter.err != nil || len(iter.data) == 0 { return false } // reset the current record iter.record.CF = 0 iter.record.Key = nil iter.record.Value = nil // parse the record type iter.record.Type = iter.decodeRecType() switch iter.record.Type { case WriteBatchDeletionRecord, WriteBatchSingleDeletionRecord: iter.record.Key = iter.decodeSlice() case WriteBatchCFDeletionRecord, WriteBatchCFSingleDeletionRecord: iter.record.CF = int(iter.decodeVarint()) if iter.err == nil { iter.record.Key = iter.decodeSlice() } case WriteBatchValueRecord, WriteBatchMergeRecord, WriteBatchRangeDeletion, WriteBatchBlobIndex: iter.record.Key = iter.decodeSlice() if iter.err == nil { iter.record.Value = iter.decodeSlice() } case WriteBatchCFValueRecord, WriteBatchCFRangeDeletion, WriteBatchCFMergeRecord, WriteBatchCFBlobIndex: iter.record.CF = int(iter.decodeVarint()) if iter.err == nil { iter.record.Key = iter.decodeSlice() } if iter.err == nil { iter.record.Value = iter.decodeSlice() } case WriteBatchLogDataRecord: iter.record.Value = iter.decodeSlice() case WriteBatchNoopRecord, WriteBatchBeginPrepareXIDRecord, WriteBatchBeginPersistedPrepareXIDRecord: case WriteBatchEndPrepareXIDRecord, WriteBatchCommitXIDRecord, WriteBatchRollbackXIDRecord: iter.record.Value = iter.decodeSlice() default: iter.err = errors.New("unsupported wal record type") } return iter.err == nil }
go
func (iter *WriteBatchIterator) Next() bool { if iter.err != nil || len(iter.data) == 0 { return false } // reset the current record iter.record.CF = 0 iter.record.Key = nil iter.record.Value = nil // parse the record type iter.record.Type = iter.decodeRecType() switch iter.record.Type { case WriteBatchDeletionRecord, WriteBatchSingleDeletionRecord: iter.record.Key = iter.decodeSlice() case WriteBatchCFDeletionRecord, WriteBatchCFSingleDeletionRecord: iter.record.CF = int(iter.decodeVarint()) if iter.err == nil { iter.record.Key = iter.decodeSlice() } case WriteBatchValueRecord, WriteBatchMergeRecord, WriteBatchRangeDeletion, WriteBatchBlobIndex: iter.record.Key = iter.decodeSlice() if iter.err == nil { iter.record.Value = iter.decodeSlice() } case WriteBatchCFValueRecord, WriteBatchCFRangeDeletion, WriteBatchCFMergeRecord, WriteBatchCFBlobIndex: iter.record.CF = int(iter.decodeVarint()) if iter.err == nil { iter.record.Key = iter.decodeSlice() } if iter.err == nil { iter.record.Value = iter.decodeSlice() } case WriteBatchLogDataRecord: iter.record.Value = iter.decodeSlice() case WriteBatchNoopRecord, WriteBatchBeginPrepareXIDRecord, WriteBatchBeginPersistedPrepareXIDRecord: case WriteBatchEndPrepareXIDRecord, WriteBatchCommitXIDRecord, WriteBatchRollbackXIDRecord: iter.record.Value = iter.decodeSlice() default: iter.err = errors.New("unsupported wal record type") } return iter.err == nil }
[ "func", "(", "iter", "*", "WriteBatchIterator", ")", "Next", "(", ")", "bool", "{", "if", "iter", ".", "err", "!=", "nil", "||", "len", "(", "iter", ".", "data", ")", "==", "0", "{", "return", "false", "\n", "}", "\n", "// reset the current record", "iter", ".", "record", ".", "CF", "=", "0", "\n", "iter", ".", "record", ".", "Key", "=", "nil", "\n", "iter", ".", "record", ".", "Value", "=", "nil", "\n\n", "// parse the record type", "iter", ".", "record", ".", "Type", "=", "iter", ".", "decodeRecType", "(", ")", "\n\n", "switch", "iter", ".", "record", ".", "Type", "{", "case", "WriteBatchDeletionRecord", ",", "WriteBatchSingleDeletionRecord", ":", "iter", ".", "record", ".", "Key", "=", "iter", ".", "decodeSlice", "(", ")", "\n", "case", "WriteBatchCFDeletionRecord", ",", "WriteBatchCFSingleDeletionRecord", ":", "iter", ".", "record", ".", "CF", "=", "int", "(", "iter", ".", "decodeVarint", "(", ")", ")", "\n", "if", "iter", ".", "err", "==", "nil", "{", "iter", ".", "record", ".", "Key", "=", "iter", ".", "decodeSlice", "(", ")", "\n", "}", "\n", "case", "WriteBatchValueRecord", ",", "WriteBatchMergeRecord", ",", "WriteBatchRangeDeletion", ",", "WriteBatchBlobIndex", ":", "iter", ".", "record", ".", "Key", "=", "iter", ".", "decodeSlice", "(", ")", "\n", "if", "iter", ".", "err", "==", "nil", "{", "iter", ".", "record", ".", "Value", "=", "iter", ".", "decodeSlice", "(", ")", "\n", "}", "\n", "case", "WriteBatchCFValueRecord", ",", "WriteBatchCFRangeDeletion", ",", "WriteBatchCFMergeRecord", ",", "WriteBatchCFBlobIndex", ":", "iter", ".", "record", ".", "CF", "=", "int", "(", "iter", ".", "decodeVarint", "(", ")", ")", "\n", "if", "iter", ".", "err", "==", "nil", "{", "iter", ".", "record", ".", "Key", "=", "iter", ".", "decodeSlice", "(", ")", "\n", "}", "\n", "if", "iter", ".", "err", "==", "nil", "{", "iter", ".", "record", ".", "Value", "=", "iter", ".", "decodeSlice", "(", ")", "\n", "}", "\n", "case", "WriteBatchLogDataRecord", ":", "iter", ".", "record", ".", "Value", "=", "iter", ".", "decodeSlice", "(", ")", "\n", "case", "WriteBatchNoopRecord", ",", "WriteBatchBeginPrepareXIDRecord", ",", "WriteBatchBeginPersistedPrepareXIDRecord", ":", "case", "WriteBatchEndPrepareXIDRecord", ",", "WriteBatchCommitXIDRecord", ",", "WriteBatchRollbackXIDRecord", ":", "iter", ".", "record", ".", "Value", "=", "iter", ".", "decodeSlice", "(", ")", "\n", "default", ":", "iter", ".", "err", "=", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "return", "iter", ".", "err", "==", "nil", "\n\n", "}" ]
// Next returns the next record. // Returns false if no further record exists.
[ "Next", "returns", "the", "next", "record", ".", "Returns", "false", "if", "no", "further", "record", "exists", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/write_batch.go#L147-L209
151,464
tecbot/gorocksdb
slice_transform.go
NewFixedPrefixTransform
func NewFixedPrefixTransform(prefixLen int) SliceTransform { return NewNativeSliceTransform(C.rocksdb_slicetransform_create_fixed_prefix(C.size_t(prefixLen))) }
go
func NewFixedPrefixTransform(prefixLen int) SliceTransform { return NewNativeSliceTransform(C.rocksdb_slicetransform_create_fixed_prefix(C.size_t(prefixLen))) }
[ "func", "NewFixedPrefixTransform", "(", "prefixLen", "int", ")", "SliceTransform", "{", "return", "NewNativeSliceTransform", "(", "C", ".", "rocksdb_slicetransform_create_fixed_prefix", "(", "C", ".", "size_t", "(", "prefixLen", ")", ")", ")", "\n", "}" ]
// NewFixedPrefixTransform creates a new fixed prefix transform.
[ "NewFixedPrefixTransform", "creates", "a", "new", "fixed", "prefix", "transform", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/slice_transform.go#L22-L24
151,465
tecbot/gorocksdb
cow.go
NewCOWList
func NewCOWList() *COWList { var list []interface{} v := &atomic.Value{} v.Store(list) return &COWList{v: v, mu: new(sync.Mutex)} }
go
func NewCOWList() *COWList { var list []interface{} v := &atomic.Value{} v.Store(list) return &COWList{v: v, mu: new(sync.Mutex)} }
[ "func", "NewCOWList", "(", ")", "*", "COWList", "{", "var", "list", "[", "]", "interface", "{", "}", "\n", "v", ":=", "&", "atomic", ".", "Value", "{", "}", "\n", "v", ".", "Store", "(", "list", ")", "\n", "return", "&", "COWList", "{", "v", ":", "v", ",", "mu", ":", "new", "(", "sync", ".", "Mutex", ")", "}", "\n", "}" ]
// NewCOWList creates a new COWList.
[ "NewCOWList", "creates", "a", "new", "COWList", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/cow.go#L18-L23
151,466
tecbot/gorocksdb
cow.go
Append
func (c *COWList) Append(i interface{}) int { c.mu.Lock() defer c.mu.Unlock() list := c.v.Load().([]interface{}) newLen := len(list) + 1 newList := make([]interface{}, newLen) copy(newList, list) newList[newLen-1] = i c.v.Store(newList) return newLen - 1 }
go
func (c *COWList) Append(i interface{}) int { c.mu.Lock() defer c.mu.Unlock() list := c.v.Load().([]interface{}) newLen := len(list) + 1 newList := make([]interface{}, newLen) copy(newList, list) newList[newLen-1] = i c.v.Store(newList) return newLen - 1 }
[ "func", "(", "c", "*", "COWList", ")", "Append", "(", "i", "interface", "{", "}", ")", "int", "{", "c", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "mu", ".", "Unlock", "(", ")", "\n", "list", ":=", "c", ".", "v", ".", "Load", "(", ")", ".", "(", "[", "]", "interface", "{", "}", ")", "\n", "newLen", ":=", "len", "(", "list", ")", "+", "1", "\n", "newList", ":=", "make", "(", "[", "]", "interface", "{", "}", ",", "newLen", ")", "\n", "copy", "(", "newList", ",", "list", ")", "\n", "newList", "[", "newLen", "-", "1", "]", "=", "i", "\n", "c", ".", "v", ".", "Store", "(", "newList", ")", "\n", "return", "newLen", "-", "1", "\n", "}" ]
// Append appends an item to the COWList and returns the index for that item.
[ "Append", "appends", "an", "item", "to", "the", "COWList", "and", "returns", "the", "index", "for", "that", "item", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/cow.go#L26-L36
151,467
tecbot/gorocksdb
cow.go
Get
func (c *COWList) Get(index int) interface{} { list := c.v.Load().([]interface{}) return list[index] }
go
func (c *COWList) Get(index int) interface{} { list := c.v.Load().([]interface{}) return list[index] }
[ "func", "(", "c", "*", "COWList", ")", "Get", "(", "index", "int", ")", "interface", "{", "}", "{", "list", ":=", "c", ".", "v", ".", "Load", "(", ")", ".", "(", "[", "]", "interface", "{", "}", ")", "\n", "return", "list", "[", "index", "]", "\n", "}" ]
// Get gets the item at index.
[ "Get", "gets", "the", "item", "at", "index", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/cow.go#L39-L42
151,468
tecbot/gorocksdb
env.go
SetHighPriorityBackgroundThreads
func (env *Env) SetHighPriorityBackgroundThreads(n int) { C.rocksdb_env_set_high_priority_background_threads(env.c, C.int(n)) }
go
func (env *Env) SetHighPriorityBackgroundThreads(n int) { C.rocksdb_env_set_high_priority_background_threads(env.c, C.int(n)) }
[ "func", "(", "env", "*", "Env", ")", "SetHighPriorityBackgroundThreads", "(", "n", "int", ")", "{", "C", ".", "rocksdb_env_set_high_priority_background_threads", "(", "env", ".", "c", ",", "C", ".", "int", "(", "n", ")", ")", "\n", "}" ]
// SetHighPriorityBackgroundThreads sets the size of the high priority // thread pool that can be used to prevent compactions from stalling // memtable flushes.
[ "SetHighPriorityBackgroundThreads", "sets", "the", "size", "of", "the", "high", "priority", "thread", "pool", "that", "can", "be", "used", "to", "prevent", "compactions", "from", "stalling", "memtable", "flushes", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/env.go#L32-L34
151,469
tecbot/gorocksdb
env.go
Destroy
func (env *Env) Destroy() { C.rocksdb_env_destroy(env.c) env.c = nil }
go
func (env *Env) Destroy() { C.rocksdb_env_destroy(env.c) env.c = nil }
[ "func", "(", "env", "*", "Env", ")", "Destroy", "(", ")", "{", "C", ".", "rocksdb_env_destroy", "(", "env", ".", "c", ")", "\n", "env", ".", "c", "=", "nil", "\n", "}" ]
// Destroy deallocates the Env object.
[ "Destroy", "deallocates", "the", "Env", "object", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/env.go#L37-L40
151,470
tecbot/gorocksdb
db.go
OpenDb
func OpenDb(opts *Options, name string) (*DB, error) { var ( cErr *C.char cName = C.CString(name) ) defer C.free(unsafe.Pointer(cName)) db := C.rocksdb_open(opts.c, cName, &cErr) if cErr != nil { defer C.free(unsafe.Pointer(cErr)) return nil, errors.New(C.GoString(cErr)) } return &DB{ name: name, c: db, opts: opts, }, nil }
go
func OpenDb(opts *Options, name string) (*DB, error) { var ( cErr *C.char cName = C.CString(name) ) defer C.free(unsafe.Pointer(cName)) db := C.rocksdb_open(opts.c, cName, &cErr) if cErr != nil { defer C.free(unsafe.Pointer(cErr)) return nil, errors.New(C.GoString(cErr)) } return &DB{ name: name, c: db, opts: opts, }, nil }
[ "func", "OpenDb", "(", "opts", "*", "Options", ",", "name", "string", ")", "(", "*", "DB", ",", "error", ")", "{", "var", "(", "cErr", "*", "C", ".", "char", "\n", "cName", "=", "C", ".", "CString", "(", "name", ")", "\n", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cName", ")", ")", "\n", "db", ":=", "C", ".", "rocksdb_open", "(", "opts", ".", "c", ",", "cName", ",", "&", "cErr", ")", "\n", "if", "cErr", "!=", "nil", "{", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cErr", ")", ")", "\n", "return", "nil", ",", "errors", ".", "New", "(", "C", ".", "GoString", "(", "cErr", ")", ")", "\n", "}", "\n", "return", "&", "DB", "{", "name", ":", "name", ",", "c", ":", "db", ",", "opts", ":", "opts", ",", "}", ",", "nil", "\n", "}" ]
// OpenDb opens a database with the specified options.
[ "OpenDb", "opens", "a", "database", "with", "the", "specified", "options", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/db.go#L27-L43
151,471
tecbot/gorocksdb
db.go
OpenDbForReadOnly
func OpenDbForReadOnly(opts *Options, name string, errorIfLogFileExist bool) (*DB, error) { var ( cErr *C.char cName = C.CString(name) ) defer C.free(unsafe.Pointer(cName)) db := C.rocksdb_open_for_read_only(opts.c, cName, boolToChar(errorIfLogFileExist), &cErr) if cErr != nil { defer C.free(unsafe.Pointer(cErr)) return nil, errors.New(C.GoString(cErr)) } return &DB{ name: name, c: db, opts: opts, }, nil }
go
func OpenDbForReadOnly(opts *Options, name string, errorIfLogFileExist bool) (*DB, error) { var ( cErr *C.char cName = C.CString(name) ) defer C.free(unsafe.Pointer(cName)) db := C.rocksdb_open_for_read_only(opts.c, cName, boolToChar(errorIfLogFileExist), &cErr) if cErr != nil { defer C.free(unsafe.Pointer(cErr)) return nil, errors.New(C.GoString(cErr)) } return &DB{ name: name, c: db, opts: opts, }, nil }
[ "func", "OpenDbForReadOnly", "(", "opts", "*", "Options", ",", "name", "string", ",", "errorIfLogFileExist", "bool", ")", "(", "*", "DB", ",", "error", ")", "{", "var", "(", "cErr", "*", "C", ".", "char", "\n", "cName", "=", "C", ".", "CString", "(", "name", ")", "\n", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cName", ")", ")", "\n", "db", ":=", "C", ".", "rocksdb_open_for_read_only", "(", "opts", ".", "c", ",", "cName", ",", "boolToChar", "(", "errorIfLogFileExist", ")", ",", "&", "cErr", ")", "\n", "if", "cErr", "!=", "nil", "{", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cErr", ")", ")", "\n", "return", "nil", ",", "errors", ".", "New", "(", "C", ".", "GoString", "(", "cErr", ")", ")", "\n", "}", "\n", "return", "&", "DB", "{", "name", ":", "name", ",", "c", ":", "db", ",", "opts", ":", "opts", ",", "}", ",", "nil", "\n", "}" ]
// OpenDbForReadOnly opens a database with the specified options for readonly usage.
[ "OpenDbForReadOnly", "opens", "a", "database", "with", "the", "specified", "options", "for", "readonly", "usage", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/db.go#L46-L62
151,472
tecbot/gorocksdb
db.go
OpenDbColumnFamilies
func OpenDbColumnFamilies( opts *Options, name string, cfNames []string, cfOpts []*Options, ) (*DB, []*ColumnFamilyHandle, error) { numColumnFamilies := len(cfNames) if numColumnFamilies != len(cfOpts) { return nil, nil, errors.New("must provide the same number of column family names and options") } cName := C.CString(name) defer C.free(unsafe.Pointer(cName)) cNames := make([]*C.char, numColumnFamilies) for i, s := range cfNames { cNames[i] = C.CString(s) } defer func() { for _, s := range cNames { C.free(unsafe.Pointer(s)) } }() cOpts := make([]*C.rocksdb_options_t, numColumnFamilies) for i, o := range cfOpts { cOpts[i] = o.c } cHandles := make([]*C.rocksdb_column_family_handle_t, numColumnFamilies) var cErr *C.char db := C.rocksdb_open_column_families( opts.c, cName, C.int(numColumnFamilies), &cNames[0], &cOpts[0], &cHandles[0], &cErr, ) if cErr != nil { defer C.free(unsafe.Pointer(cErr)) return nil, nil, errors.New(C.GoString(cErr)) } cfHandles := make([]*ColumnFamilyHandle, numColumnFamilies) for i, c := range cHandles { cfHandles[i] = NewNativeColumnFamilyHandle(c) } return &DB{ name: name, c: db, opts: opts, }, cfHandles, nil }
go
func OpenDbColumnFamilies( opts *Options, name string, cfNames []string, cfOpts []*Options, ) (*DB, []*ColumnFamilyHandle, error) { numColumnFamilies := len(cfNames) if numColumnFamilies != len(cfOpts) { return nil, nil, errors.New("must provide the same number of column family names and options") } cName := C.CString(name) defer C.free(unsafe.Pointer(cName)) cNames := make([]*C.char, numColumnFamilies) for i, s := range cfNames { cNames[i] = C.CString(s) } defer func() { for _, s := range cNames { C.free(unsafe.Pointer(s)) } }() cOpts := make([]*C.rocksdb_options_t, numColumnFamilies) for i, o := range cfOpts { cOpts[i] = o.c } cHandles := make([]*C.rocksdb_column_family_handle_t, numColumnFamilies) var cErr *C.char db := C.rocksdb_open_column_families( opts.c, cName, C.int(numColumnFamilies), &cNames[0], &cOpts[0], &cHandles[0], &cErr, ) if cErr != nil { defer C.free(unsafe.Pointer(cErr)) return nil, nil, errors.New(C.GoString(cErr)) } cfHandles := make([]*ColumnFamilyHandle, numColumnFamilies) for i, c := range cHandles { cfHandles[i] = NewNativeColumnFamilyHandle(c) } return &DB{ name: name, c: db, opts: opts, }, cfHandles, nil }
[ "func", "OpenDbColumnFamilies", "(", "opts", "*", "Options", ",", "name", "string", ",", "cfNames", "[", "]", "string", ",", "cfOpts", "[", "]", "*", "Options", ",", ")", "(", "*", "DB", ",", "[", "]", "*", "ColumnFamilyHandle", ",", "error", ")", "{", "numColumnFamilies", ":=", "len", "(", "cfNames", ")", "\n", "if", "numColumnFamilies", "!=", "len", "(", "cfOpts", ")", "{", "return", "nil", ",", "nil", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "cName", ":=", "C", ".", "CString", "(", "name", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cName", ")", ")", "\n\n", "cNames", ":=", "make", "(", "[", "]", "*", "C", ".", "char", ",", "numColumnFamilies", ")", "\n", "for", "i", ",", "s", ":=", "range", "cfNames", "{", "cNames", "[", "i", "]", "=", "C", ".", "CString", "(", "s", ")", "\n", "}", "\n", "defer", "func", "(", ")", "{", "for", "_", ",", "s", ":=", "range", "cNames", "{", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "s", ")", ")", "\n", "}", "\n", "}", "(", ")", "\n\n", "cOpts", ":=", "make", "(", "[", "]", "*", "C", ".", "rocksdb_options_t", ",", "numColumnFamilies", ")", "\n", "for", "i", ",", "o", ":=", "range", "cfOpts", "{", "cOpts", "[", "i", "]", "=", "o", ".", "c", "\n", "}", "\n\n", "cHandles", ":=", "make", "(", "[", "]", "*", "C", ".", "rocksdb_column_family_handle_t", ",", "numColumnFamilies", ")", "\n\n", "var", "cErr", "*", "C", ".", "char", "\n", "db", ":=", "C", ".", "rocksdb_open_column_families", "(", "opts", ".", "c", ",", "cName", ",", "C", ".", "int", "(", "numColumnFamilies", ")", ",", "&", "cNames", "[", "0", "]", ",", "&", "cOpts", "[", "0", "]", ",", "&", "cHandles", "[", "0", "]", ",", "&", "cErr", ",", ")", "\n", "if", "cErr", "!=", "nil", "{", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cErr", ")", ")", "\n", "return", "nil", ",", "nil", ",", "errors", ".", "New", "(", "C", ".", "GoString", "(", "cErr", ")", ")", "\n", "}", "\n\n", "cfHandles", ":=", "make", "(", "[", "]", "*", "ColumnFamilyHandle", ",", "numColumnFamilies", ")", "\n", "for", "i", ",", "c", ":=", "range", "cHandles", "{", "cfHandles", "[", "i", "]", "=", "NewNativeColumnFamilyHandle", "(", "c", ")", "\n", "}", "\n\n", "return", "&", "DB", "{", "name", ":", "name", ",", "c", ":", "db", ",", "opts", ":", "opts", ",", "}", ",", "cfHandles", ",", "nil", "\n", "}" ]
// OpenDbColumnFamilies opens a database with the specified column families.
[ "OpenDbColumnFamilies", "opens", "a", "database", "with", "the", "specified", "column", "families", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/db.go#L65-L121
151,473
tecbot/gorocksdb
db.go
ListColumnFamilies
func ListColumnFamilies(opts *Options, name string) ([]string, error) { var ( cErr *C.char cLen C.size_t cName = C.CString(name) ) defer C.free(unsafe.Pointer(cName)) cNames := C.rocksdb_list_column_families(opts.c, cName, &cLen, &cErr) if cErr != nil { defer C.free(unsafe.Pointer(cErr)) return nil, errors.New(C.GoString(cErr)) } namesLen := int(cLen) names := make([]string, namesLen) cNamesArr := (*[1 << 30]*C.char)(unsafe.Pointer(cNames))[:namesLen:namesLen] for i, n := range cNamesArr { names[i] = C.GoString(n) } C.rocksdb_list_column_families_destroy(cNames, cLen) return names, nil }
go
func ListColumnFamilies(opts *Options, name string) ([]string, error) { var ( cErr *C.char cLen C.size_t cName = C.CString(name) ) defer C.free(unsafe.Pointer(cName)) cNames := C.rocksdb_list_column_families(opts.c, cName, &cLen, &cErr) if cErr != nil { defer C.free(unsafe.Pointer(cErr)) return nil, errors.New(C.GoString(cErr)) } namesLen := int(cLen) names := make([]string, namesLen) cNamesArr := (*[1 << 30]*C.char)(unsafe.Pointer(cNames))[:namesLen:namesLen] for i, n := range cNamesArr { names[i] = C.GoString(n) } C.rocksdb_list_column_families_destroy(cNames, cLen) return names, nil }
[ "func", "ListColumnFamilies", "(", "opts", "*", "Options", ",", "name", "string", ")", "(", "[", "]", "string", ",", "error", ")", "{", "var", "(", "cErr", "*", "C", ".", "char", "\n", "cLen", "C", ".", "size_t", "\n", "cName", "=", "C", ".", "CString", "(", "name", ")", "\n", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cName", ")", ")", "\n", "cNames", ":=", "C", ".", "rocksdb_list_column_families", "(", "opts", ".", "c", ",", "cName", ",", "&", "cLen", ",", "&", "cErr", ")", "\n", "if", "cErr", "!=", "nil", "{", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cErr", ")", ")", "\n", "return", "nil", ",", "errors", ".", "New", "(", "C", ".", "GoString", "(", "cErr", ")", ")", "\n", "}", "\n", "namesLen", ":=", "int", "(", "cLen", ")", "\n", "names", ":=", "make", "(", "[", "]", "string", ",", "namesLen", ")", "\n", "cNamesArr", ":=", "(", "*", "[", "1", "<<", "30", "]", "*", "C", ".", "char", ")", "(", "unsafe", ".", "Pointer", "(", "cNames", ")", ")", "[", ":", "namesLen", ":", "namesLen", "]", "\n", "for", "i", ",", "n", ":=", "range", "cNamesArr", "{", "names", "[", "i", "]", "=", "C", ".", "GoString", "(", "n", ")", "\n", "}", "\n", "C", ".", "rocksdb_list_column_families_destroy", "(", "cNames", ",", "cLen", ")", "\n", "return", "names", ",", "nil", "\n", "}" ]
// ListColumnFamilies lists the names of the column families in the DB.
[ "ListColumnFamilies", "lists", "the", "names", "of", "the", "column", "families", "in", "the", "DB", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/db.go#L186-L206
151,474
tecbot/gorocksdb
db.go
Get
func (db *DB) Get(opts *ReadOptions, key []byte) (*Slice, error) { var ( cErr *C.char cValLen C.size_t cKey = byteToChar(key) ) cValue := C.rocksdb_get(db.c, opts.c, cKey, C.size_t(len(key)), &cValLen, &cErr) if cErr != nil { defer C.free(unsafe.Pointer(cErr)) return nil, errors.New(C.GoString(cErr)) } return NewSlice(cValue, cValLen), nil }
go
func (db *DB) Get(opts *ReadOptions, key []byte) (*Slice, error) { var ( cErr *C.char cValLen C.size_t cKey = byteToChar(key) ) cValue := C.rocksdb_get(db.c, opts.c, cKey, C.size_t(len(key)), &cValLen, &cErr) if cErr != nil { defer C.free(unsafe.Pointer(cErr)) return nil, errors.New(C.GoString(cErr)) } return NewSlice(cValue, cValLen), nil }
[ "func", "(", "db", "*", "DB", ")", "Get", "(", "opts", "*", "ReadOptions", ",", "key", "[", "]", "byte", ")", "(", "*", "Slice", ",", "error", ")", "{", "var", "(", "cErr", "*", "C", ".", "char", "\n", "cValLen", "C", ".", "size_t", "\n", "cKey", "=", "byteToChar", "(", "key", ")", "\n", ")", "\n", "cValue", ":=", "C", ".", "rocksdb_get", "(", "db", ".", "c", ",", "opts", ".", "c", ",", "cKey", ",", "C", ".", "size_t", "(", "len", "(", "key", ")", ")", ",", "&", "cValLen", ",", "&", "cErr", ")", "\n", "if", "cErr", "!=", "nil", "{", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cErr", ")", ")", "\n", "return", "nil", ",", "errors", ".", "New", "(", "C", ".", "GoString", "(", "cErr", ")", ")", "\n", "}", "\n", "return", "NewSlice", "(", "cValue", ",", "cValLen", ")", ",", "nil", "\n", "}" ]
// Get returns the data associated with the key from the database.
[ "Get", "returns", "the", "data", "associated", "with", "the", "key", "from", "the", "database", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/db.go#L219-L231
151,475
tecbot/gorocksdb
db.go
GetBytes
func (db *DB) GetBytes(opts *ReadOptions, key []byte) ([]byte, error) { var ( cErr *C.char cValLen C.size_t cKey = byteToChar(key) ) cValue := C.rocksdb_get(db.c, opts.c, cKey, C.size_t(len(key)), &cValLen, &cErr) if cErr != nil { defer C.free(unsafe.Pointer(cErr)) return nil, errors.New(C.GoString(cErr)) } if cValue == nil { return nil, nil } defer C.free(unsafe.Pointer(cValue)) return C.GoBytes(unsafe.Pointer(cValue), C.int(cValLen)), nil }
go
func (db *DB) GetBytes(opts *ReadOptions, key []byte) ([]byte, error) { var ( cErr *C.char cValLen C.size_t cKey = byteToChar(key) ) cValue := C.rocksdb_get(db.c, opts.c, cKey, C.size_t(len(key)), &cValLen, &cErr) if cErr != nil { defer C.free(unsafe.Pointer(cErr)) return nil, errors.New(C.GoString(cErr)) } if cValue == nil { return nil, nil } defer C.free(unsafe.Pointer(cValue)) return C.GoBytes(unsafe.Pointer(cValue), C.int(cValLen)), nil }
[ "func", "(", "db", "*", "DB", ")", "GetBytes", "(", "opts", "*", "ReadOptions", ",", "key", "[", "]", "byte", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "var", "(", "cErr", "*", "C", ".", "char", "\n", "cValLen", "C", ".", "size_t", "\n", "cKey", "=", "byteToChar", "(", "key", ")", "\n", ")", "\n", "cValue", ":=", "C", ".", "rocksdb_get", "(", "db", ".", "c", ",", "opts", ".", "c", ",", "cKey", ",", "C", ".", "size_t", "(", "len", "(", "key", ")", ")", ",", "&", "cValLen", ",", "&", "cErr", ")", "\n", "if", "cErr", "!=", "nil", "{", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cErr", ")", ")", "\n", "return", "nil", ",", "errors", ".", "New", "(", "C", ".", "GoString", "(", "cErr", ")", ")", "\n", "}", "\n", "if", "cValue", "==", "nil", "{", "return", "nil", ",", "nil", "\n", "}", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cValue", ")", ")", "\n", "return", "C", ".", "GoBytes", "(", "unsafe", ".", "Pointer", "(", "cValue", ")", ",", "C", ".", "int", "(", "cValLen", ")", ")", ",", "nil", "\n", "}" ]
// GetBytes is like Get but returns a copy of the data.
[ "GetBytes", "is", "like", "Get", "but", "returns", "a", "copy", "of", "the", "data", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/db.go#L234-L250
151,476
tecbot/gorocksdb
db.go
MultiGet
func (db *DB) MultiGet(opts *ReadOptions, keys ...[]byte) (Slices, error) { cKeys, cKeySizes := byteSlicesToCSlices(keys) defer cKeys.Destroy() vals := make(charsSlice, len(keys)) valSizes := make(sizeTSlice, len(keys)) rocksErrs := make(charsSlice, len(keys)) C.rocksdb_multi_get( db.c, opts.c, C.size_t(len(keys)), cKeys.c(), cKeySizes.c(), vals.c(), valSizes.c(), rocksErrs.c(), ) var errs []error for i, rocksErr := range rocksErrs { if rocksErr != nil { defer C.free(unsafe.Pointer(rocksErr)) err := fmt.Errorf("getting %q failed: %v", string(keys[i]), C.GoString(rocksErr)) errs = append(errs, err) } } if len(errs) > 0 { return nil, fmt.Errorf("failed to get %d keys, first error: %v", len(errs), errs[0]) } slices := make(Slices, len(keys)) for i, val := range vals { slices[i] = NewSlice(val, valSizes[i]) } return slices, nil }
go
func (db *DB) MultiGet(opts *ReadOptions, keys ...[]byte) (Slices, error) { cKeys, cKeySizes := byteSlicesToCSlices(keys) defer cKeys.Destroy() vals := make(charsSlice, len(keys)) valSizes := make(sizeTSlice, len(keys)) rocksErrs := make(charsSlice, len(keys)) C.rocksdb_multi_get( db.c, opts.c, C.size_t(len(keys)), cKeys.c(), cKeySizes.c(), vals.c(), valSizes.c(), rocksErrs.c(), ) var errs []error for i, rocksErr := range rocksErrs { if rocksErr != nil { defer C.free(unsafe.Pointer(rocksErr)) err := fmt.Errorf("getting %q failed: %v", string(keys[i]), C.GoString(rocksErr)) errs = append(errs, err) } } if len(errs) > 0 { return nil, fmt.Errorf("failed to get %d keys, first error: %v", len(errs), errs[0]) } slices := make(Slices, len(keys)) for i, val := range vals { slices[i] = NewSlice(val, valSizes[i]) } return slices, nil }
[ "func", "(", "db", "*", "DB", ")", "MultiGet", "(", "opts", "*", "ReadOptions", ",", "keys", "...", "[", "]", "byte", ")", "(", "Slices", ",", "error", ")", "{", "cKeys", ",", "cKeySizes", ":=", "byteSlicesToCSlices", "(", "keys", ")", "\n", "defer", "cKeys", ".", "Destroy", "(", ")", "\n", "vals", ":=", "make", "(", "charsSlice", ",", "len", "(", "keys", ")", ")", "\n", "valSizes", ":=", "make", "(", "sizeTSlice", ",", "len", "(", "keys", ")", ")", "\n", "rocksErrs", ":=", "make", "(", "charsSlice", ",", "len", "(", "keys", ")", ")", "\n\n", "C", ".", "rocksdb_multi_get", "(", "db", ".", "c", ",", "opts", ".", "c", ",", "C", ".", "size_t", "(", "len", "(", "keys", ")", ")", ",", "cKeys", ".", "c", "(", ")", ",", "cKeySizes", ".", "c", "(", ")", ",", "vals", ".", "c", "(", ")", ",", "valSizes", ".", "c", "(", ")", ",", "rocksErrs", ".", "c", "(", ")", ",", ")", "\n\n", "var", "errs", "[", "]", "error", "\n\n", "for", "i", ",", "rocksErr", ":=", "range", "rocksErrs", "{", "if", "rocksErr", "!=", "nil", "{", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "rocksErr", ")", ")", "\n", "err", ":=", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "string", "(", "keys", "[", "i", "]", ")", ",", "C", ".", "GoString", "(", "rocksErr", ")", ")", "\n", "errs", "=", "append", "(", "errs", ",", "err", ")", "\n", "}", "\n", "}", "\n\n", "if", "len", "(", "errs", ")", ">", "0", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "len", "(", "errs", ")", ",", "errs", "[", "0", "]", ")", "\n", "}", "\n\n", "slices", ":=", "make", "(", "Slices", ",", "len", "(", "keys", ")", ")", "\n", "for", "i", ",", "val", ":=", "range", "vals", "{", "slices", "[", "i", "]", "=", "NewSlice", "(", "val", ",", "valSizes", "[", "i", "]", ")", "\n", "}", "\n\n", "return", "slices", ",", "nil", "\n", "}" ]
// MultiGet returns the data associated with the passed keys from the database
[ "MultiGet", "returns", "the", "data", "associated", "with", "the", "passed", "keys", "from", "the", "database" ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/db.go#L268-L306
151,477
tecbot/gorocksdb
db.go
MultiGetCF
func (db *DB) MultiGetCF(opts *ReadOptions, cf *ColumnFamilyHandle, keys ...[]byte) (Slices, error) { cfs := make(ColumnFamilyHandles, len(keys)) for i := 0; i < len(keys); i++ { cfs[i] = cf } return db.MultiGetCFMultiCF(opts, cfs, keys) }
go
func (db *DB) MultiGetCF(opts *ReadOptions, cf *ColumnFamilyHandle, keys ...[]byte) (Slices, error) { cfs := make(ColumnFamilyHandles, len(keys)) for i := 0; i < len(keys); i++ { cfs[i] = cf } return db.MultiGetCFMultiCF(opts, cfs, keys) }
[ "func", "(", "db", "*", "DB", ")", "MultiGetCF", "(", "opts", "*", "ReadOptions", ",", "cf", "*", "ColumnFamilyHandle", ",", "keys", "...", "[", "]", "byte", ")", "(", "Slices", ",", "error", ")", "{", "cfs", ":=", "make", "(", "ColumnFamilyHandles", ",", "len", "(", "keys", ")", ")", "\n", "for", "i", ":=", "0", ";", "i", "<", "len", "(", "keys", ")", ";", "i", "++", "{", "cfs", "[", "i", "]", "=", "cf", "\n", "}", "\n", "return", "db", ".", "MultiGetCFMultiCF", "(", "opts", ",", "cfs", ",", "keys", ")", "\n", "}" ]
// MultiGetCF returns the data associated with the passed keys from the column family
[ "MultiGetCF", "returns", "the", "data", "associated", "with", "the", "passed", "keys", "from", "the", "column", "family" ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/db.go#L309-L315
151,478
tecbot/gorocksdb
db.go
Put
func (db *DB) Put(opts *WriteOptions, key, value []byte) error { var ( cErr *C.char cKey = byteToChar(key) cValue = byteToChar(value) ) C.rocksdb_put(db.c, opts.c, cKey, C.size_t(len(key)), cValue, C.size_t(len(value)), &cErr) if cErr != nil { defer C.free(unsafe.Pointer(cErr)) return errors.New(C.GoString(cErr)) } return nil }
go
func (db *DB) Put(opts *WriteOptions, key, value []byte) error { var ( cErr *C.char cKey = byteToChar(key) cValue = byteToChar(value) ) C.rocksdb_put(db.c, opts.c, cKey, C.size_t(len(key)), cValue, C.size_t(len(value)), &cErr) if cErr != nil { defer C.free(unsafe.Pointer(cErr)) return errors.New(C.GoString(cErr)) } return nil }
[ "func", "(", "db", "*", "DB", ")", "Put", "(", "opts", "*", "WriteOptions", ",", "key", ",", "value", "[", "]", "byte", ")", "error", "{", "var", "(", "cErr", "*", "C", ".", "char", "\n", "cKey", "=", "byteToChar", "(", "key", ")", "\n", "cValue", "=", "byteToChar", "(", "value", ")", "\n", ")", "\n", "C", ".", "rocksdb_put", "(", "db", ".", "c", ",", "opts", ".", "c", ",", "cKey", ",", "C", ".", "size_t", "(", "len", "(", "key", ")", ")", ",", "cValue", ",", "C", ".", "size_t", "(", "len", "(", "value", ")", ")", ",", "&", "cErr", ")", "\n", "if", "cErr", "!=", "nil", "{", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cErr", ")", ")", "\n", "return", "errors", ".", "New", "(", "C", ".", "GoString", "(", "cErr", ")", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// Put writes data associated with a key to the database.
[ "Put", "writes", "data", "associated", "with", "a", "key", "to", "the", "database", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/db.go#L361-L373
151,479
tecbot/gorocksdb
db.go
Delete
func (db *DB) Delete(opts *WriteOptions, key []byte) error { var ( cErr *C.char cKey = byteToChar(key) ) C.rocksdb_delete(db.c, opts.c, cKey, C.size_t(len(key)), &cErr) if cErr != nil { defer C.free(unsafe.Pointer(cErr)) return errors.New(C.GoString(cErr)) } return nil }
go
func (db *DB) Delete(opts *WriteOptions, key []byte) error { var ( cErr *C.char cKey = byteToChar(key) ) C.rocksdb_delete(db.c, opts.c, cKey, C.size_t(len(key)), &cErr) if cErr != nil { defer C.free(unsafe.Pointer(cErr)) return errors.New(C.GoString(cErr)) } return nil }
[ "func", "(", "db", "*", "DB", ")", "Delete", "(", "opts", "*", "WriteOptions", ",", "key", "[", "]", "byte", ")", "error", "{", "var", "(", "cErr", "*", "C", ".", "char", "\n", "cKey", "=", "byteToChar", "(", "key", ")", "\n", ")", "\n", "C", ".", "rocksdb_delete", "(", "db", ".", "c", ",", "opts", ".", "c", ",", "cKey", ",", "C", ".", "size_t", "(", "len", "(", "key", ")", ")", ",", "&", "cErr", ")", "\n", "if", "cErr", "!=", "nil", "{", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cErr", ")", ")", "\n", "return", "errors", ".", "New", "(", "C", ".", "GoString", "(", "cErr", ")", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// Delete removes the data associated with the key from the database.
[ "Delete", "removes", "the", "data", "associated", "with", "the", "key", "from", "the", "database", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/db.go#L391-L402
151,480
tecbot/gorocksdb
db.go
Write
func (db *DB) Write(opts *WriteOptions, batch *WriteBatch) error { var cErr *C.char C.rocksdb_write(db.c, opts.c, batch.c, &cErr) if cErr != nil { defer C.free(unsafe.Pointer(cErr)) return errors.New(C.GoString(cErr)) } return nil }
go
func (db *DB) Write(opts *WriteOptions, batch *WriteBatch) error { var cErr *C.char C.rocksdb_write(db.c, opts.c, batch.c, &cErr) if cErr != nil { defer C.free(unsafe.Pointer(cErr)) return errors.New(C.GoString(cErr)) } return nil }
[ "func", "(", "db", "*", "DB", ")", "Write", "(", "opts", "*", "WriteOptions", ",", "batch", "*", "WriteBatch", ")", "error", "{", "var", "cErr", "*", "C", ".", "char", "\n", "C", ".", "rocksdb_write", "(", "db", ".", "c", ",", "opts", ".", "c", ",", "batch", ".", "c", ",", "&", "cErr", ")", "\n", "if", "cErr", "!=", "nil", "{", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cErr", ")", ")", "\n", "return", "errors", ".", "New", "(", "C", ".", "GoString", "(", "cErr", ")", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// Write writes a WriteBatch to the database
[ "Write", "writes", "a", "WriteBatch", "to", "the", "database" ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/db.go#L450-L458
151,481
tecbot/gorocksdb
db.go
NewIterator
func (db *DB) NewIterator(opts *ReadOptions) *Iterator { cIter := C.rocksdb_create_iterator(db.c, opts.c) return NewNativeIterator(unsafe.Pointer(cIter)) }
go
func (db *DB) NewIterator(opts *ReadOptions) *Iterator { cIter := C.rocksdb_create_iterator(db.c, opts.c) return NewNativeIterator(unsafe.Pointer(cIter)) }
[ "func", "(", "db", "*", "DB", ")", "NewIterator", "(", "opts", "*", "ReadOptions", ")", "*", "Iterator", "{", "cIter", ":=", "C", ".", "rocksdb_create_iterator", "(", "db", ".", "c", ",", "opts", ".", "c", ")", "\n", "return", "NewNativeIterator", "(", "unsafe", ".", "Pointer", "(", "cIter", ")", ")", "\n", "}" ]
// NewIterator returns an Iterator over the the database that uses the // ReadOptions given.
[ "NewIterator", "returns", "an", "Iterator", "over", "the", "the", "database", "that", "uses", "the", "ReadOptions", "given", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/db.go#L462-L465
151,482
tecbot/gorocksdb
db.go
NewIteratorCF
func (db *DB) NewIteratorCF(opts *ReadOptions, cf *ColumnFamilyHandle) *Iterator { cIter := C.rocksdb_create_iterator_cf(db.c, opts.c, cf.c) return NewNativeIterator(unsafe.Pointer(cIter)) }
go
func (db *DB) NewIteratorCF(opts *ReadOptions, cf *ColumnFamilyHandle) *Iterator { cIter := C.rocksdb_create_iterator_cf(db.c, opts.c, cf.c) return NewNativeIterator(unsafe.Pointer(cIter)) }
[ "func", "(", "db", "*", "DB", ")", "NewIteratorCF", "(", "opts", "*", "ReadOptions", ",", "cf", "*", "ColumnFamilyHandle", ")", "*", "Iterator", "{", "cIter", ":=", "C", ".", "rocksdb_create_iterator_cf", "(", "db", ".", "c", ",", "opts", ".", "c", ",", "cf", ".", "c", ")", "\n", "return", "NewNativeIterator", "(", "unsafe", ".", "Pointer", "(", "cIter", ")", ")", "\n", "}" ]
// NewIteratorCF returns an Iterator over the the database and column family // that uses the ReadOptions given.
[ "NewIteratorCF", "returns", "an", "Iterator", "over", "the", "the", "database", "and", "column", "family", "that", "uses", "the", "ReadOptions", "given", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/db.go#L469-L472
151,483
tecbot/gorocksdb
db.go
NewSnapshot
func (db *DB) NewSnapshot() *Snapshot { cSnap := C.rocksdb_create_snapshot(db.c) return NewNativeSnapshot(cSnap) }
go
func (db *DB) NewSnapshot() *Snapshot { cSnap := C.rocksdb_create_snapshot(db.c) return NewNativeSnapshot(cSnap) }
[ "func", "(", "db", "*", "DB", ")", "NewSnapshot", "(", ")", "*", "Snapshot", "{", "cSnap", ":=", "C", ".", "rocksdb_create_snapshot", "(", "db", ".", "c", ")", "\n", "return", "NewNativeSnapshot", "(", "cSnap", ")", "\n", "}" ]
// NewSnapshot creates a new snapshot of the database.
[ "NewSnapshot", "creates", "a", "new", "snapshot", "of", "the", "database", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/db.go#L475-L478
151,484
tecbot/gorocksdb
db.go
GetProperty
func (db *DB) GetProperty(propName string) string { cprop := C.CString(propName) defer C.free(unsafe.Pointer(cprop)) cValue := C.rocksdb_property_value(db.c, cprop) defer C.free(unsafe.Pointer(cValue)) return C.GoString(cValue) }
go
func (db *DB) GetProperty(propName string) string { cprop := C.CString(propName) defer C.free(unsafe.Pointer(cprop)) cValue := C.rocksdb_property_value(db.c, cprop) defer C.free(unsafe.Pointer(cValue)) return C.GoString(cValue) }
[ "func", "(", "db", "*", "DB", ")", "GetProperty", "(", "propName", "string", ")", "string", "{", "cprop", ":=", "C", ".", "CString", "(", "propName", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cprop", ")", ")", "\n", "cValue", ":=", "C", ".", "rocksdb_property_value", "(", "db", ".", "c", ",", "cprop", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cValue", ")", ")", "\n", "return", "C", ".", "GoString", "(", "cValue", ")", "\n", "}" ]
// GetProperty returns the value of a database property.
[ "GetProperty", "returns", "the", "value", "of", "a", "database", "property", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/db.go#L487-L493
151,485
tecbot/gorocksdb
db.go
GetPropertyCF
func (db *DB) GetPropertyCF(propName string, cf *ColumnFamilyHandle) string { cProp := C.CString(propName) defer C.free(unsafe.Pointer(cProp)) cValue := C.rocksdb_property_value_cf(db.c, cf.c, cProp) defer C.free(unsafe.Pointer(cValue)) return C.GoString(cValue) }
go
func (db *DB) GetPropertyCF(propName string, cf *ColumnFamilyHandle) string { cProp := C.CString(propName) defer C.free(unsafe.Pointer(cProp)) cValue := C.rocksdb_property_value_cf(db.c, cf.c, cProp) defer C.free(unsafe.Pointer(cValue)) return C.GoString(cValue) }
[ "func", "(", "db", "*", "DB", ")", "GetPropertyCF", "(", "propName", "string", ",", "cf", "*", "ColumnFamilyHandle", ")", "string", "{", "cProp", ":=", "C", ".", "CString", "(", "propName", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cProp", ")", ")", "\n", "cValue", ":=", "C", ".", "rocksdb_property_value_cf", "(", "db", ".", "c", ",", "cf", ".", "c", ",", "cProp", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cValue", ")", ")", "\n", "return", "C", ".", "GoString", "(", "cValue", ")", "\n", "}" ]
// GetPropertyCF returns the value of a database property.
[ "GetPropertyCF", "returns", "the", "value", "of", "a", "database", "property", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/db.go#L496-L502
151,486
tecbot/gorocksdb
db.go
CreateColumnFamily
func (db *DB) CreateColumnFamily(opts *Options, name string) (*ColumnFamilyHandle, error) { var ( cErr *C.char cName = C.CString(name) ) defer C.free(unsafe.Pointer(cName)) cHandle := C.rocksdb_create_column_family(db.c, opts.c, cName, &cErr) if cErr != nil { defer C.free(unsafe.Pointer(cErr)) return nil, errors.New(C.GoString(cErr)) } return NewNativeColumnFamilyHandle(cHandle), nil }
go
func (db *DB) CreateColumnFamily(opts *Options, name string) (*ColumnFamilyHandle, error) { var ( cErr *C.char cName = C.CString(name) ) defer C.free(unsafe.Pointer(cName)) cHandle := C.rocksdb_create_column_family(db.c, opts.c, cName, &cErr) if cErr != nil { defer C.free(unsafe.Pointer(cErr)) return nil, errors.New(C.GoString(cErr)) } return NewNativeColumnFamilyHandle(cHandle), nil }
[ "func", "(", "db", "*", "DB", ")", "CreateColumnFamily", "(", "opts", "*", "Options", ",", "name", "string", ")", "(", "*", "ColumnFamilyHandle", ",", "error", ")", "{", "var", "(", "cErr", "*", "C", ".", "char", "\n", "cName", "=", "C", ".", "CString", "(", "name", ")", "\n", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cName", ")", ")", "\n", "cHandle", ":=", "C", ".", "rocksdb_create_column_family", "(", "db", ".", "c", ",", "opts", ".", "c", ",", "cName", ",", "&", "cErr", ")", "\n", "if", "cErr", "!=", "nil", "{", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cErr", ")", ")", "\n", "return", "nil", ",", "errors", ".", "New", "(", "C", ".", "GoString", "(", "cErr", ")", ")", "\n", "}", "\n", "return", "NewNativeColumnFamilyHandle", "(", "cHandle", ")", ",", "nil", "\n", "}" ]
// CreateColumnFamily create a new column family.
[ "CreateColumnFamily", "create", "a", "new", "column", "family", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/db.go#L505-L517
151,487
tecbot/gorocksdb
db.go
DropColumnFamily
func (db *DB) DropColumnFamily(c *ColumnFamilyHandle) error { var cErr *C.char C.rocksdb_drop_column_family(db.c, c.c, &cErr) if cErr != nil { defer C.free(unsafe.Pointer(cErr)) return errors.New(C.GoString(cErr)) } return nil }
go
func (db *DB) DropColumnFamily(c *ColumnFamilyHandle) error { var cErr *C.char C.rocksdb_drop_column_family(db.c, c.c, &cErr) if cErr != nil { defer C.free(unsafe.Pointer(cErr)) return errors.New(C.GoString(cErr)) } return nil }
[ "func", "(", "db", "*", "DB", ")", "DropColumnFamily", "(", "c", "*", "ColumnFamilyHandle", ")", "error", "{", "var", "cErr", "*", "C", ".", "char", "\n", "C", ".", "rocksdb_drop_column_family", "(", "db", ".", "c", ",", "c", ".", "c", ",", "&", "cErr", ")", "\n", "if", "cErr", "!=", "nil", "{", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cErr", ")", ")", "\n", "return", "errors", ".", "New", "(", "C", ".", "GoString", "(", "cErr", ")", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// DropColumnFamily drops a column family.
[ "DropColumnFamily", "drops", "a", "column", "family", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/db.go#L520-L528
151,488
tecbot/gorocksdb
db.go
GetApproximateSizesCF
func (db *DB) GetApproximateSizesCF(cf *ColumnFamilyHandle, ranges []Range) []uint64 { sizes := make([]uint64, len(ranges)) if len(ranges) == 0 { return sizes } cStarts := make([]*C.char, len(ranges)) cLimits := make([]*C.char, len(ranges)) cStartLens := make([]C.size_t, len(ranges)) cLimitLens := make([]C.size_t, len(ranges)) for i, r := range ranges { cStarts[i] = byteToChar(r.Start) cStartLens[i] = C.size_t(len(r.Start)) cLimits[i] = byteToChar(r.Limit) cLimitLens[i] = C.size_t(len(r.Limit)) } C.rocksdb_approximate_sizes_cf( db.c, cf.c, C.int(len(ranges)), &cStarts[0], &cStartLens[0], &cLimits[0], &cLimitLens[0], (*C.uint64_t)(&sizes[0])) return sizes }
go
func (db *DB) GetApproximateSizesCF(cf *ColumnFamilyHandle, ranges []Range) []uint64 { sizes := make([]uint64, len(ranges)) if len(ranges) == 0 { return sizes } cStarts := make([]*C.char, len(ranges)) cLimits := make([]*C.char, len(ranges)) cStartLens := make([]C.size_t, len(ranges)) cLimitLens := make([]C.size_t, len(ranges)) for i, r := range ranges { cStarts[i] = byteToChar(r.Start) cStartLens[i] = C.size_t(len(r.Start)) cLimits[i] = byteToChar(r.Limit) cLimitLens[i] = C.size_t(len(r.Limit)) } C.rocksdb_approximate_sizes_cf( db.c, cf.c, C.int(len(ranges)), &cStarts[0], &cStartLens[0], &cLimits[0], &cLimitLens[0], (*C.uint64_t)(&sizes[0])) return sizes }
[ "func", "(", "db", "*", "DB", ")", "GetApproximateSizesCF", "(", "cf", "*", "ColumnFamilyHandle", ",", "ranges", "[", "]", "Range", ")", "[", "]", "uint64", "{", "sizes", ":=", "make", "(", "[", "]", "uint64", ",", "len", "(", "ranges", ")", ")", "\n", "if", "len", "(", "ranges", ")", "==", "0", "{", "return", "sizes", "\n", "}", "\n\n", "cStarts", ":=", "make", "(", "[", "]", "*", "C", ".", "char", ",", "len", "(", "ranges", ")", ")", "\n", "cLimits", ":=", "make", "(", "[", "]", "*", "C", ".", "char", ",", "len", "(", "ranges", ")", ")", "\n", "cStartLens", ":=", "make", "(", "[", "]", "C", ".", "size_t", ",", "len", "(", "ranges", ")", ")", "\n", "cLimitLens", ":=", "make", "(", "[", "]", "C", ".", "size_t", ",", "len", "(", "ranges", ")", ")", "\n", "for", "i", ",", "r", ":=", "range", "ranges", "{", "cStarts", "[", "i", "]", "=", "byteToChar", "(", "r", ".", "Start", ")", "\n", "cStartLens", "[", "i", "]", "=", "C", ".", "size_t", "(", "len", "(", "r", ".", "Start", ")", ")", "\n", "cLimits", "[", "i", "]", "=", "byteToChar", "(", "r", ".", "Limit", ")", "\n", "cLimitLens", "[", "i", "]", "=", "C", ".", "size_t", "(", "len", "(", "r", ".", "Limit", ")", ")", "\n", "}", "\n\n", "C", ".", "rocksdb_approximate_sizes_cf", "(", "db", ".", "c", ",", "cf", ".", "c", ",", "C", ".", "int", "(", "len", "(", "ranges", ")", ")", ",", "&", "cStarts", "[", "0", "]", ",", "&", "cStartLens", "[", "0", "]", ",", "&", "cLimits", "[", "0", "]", ",", "&", "cLimitLens", "[", "0", "]", ",", "(", "*", "C", ".", "uint64_t", ")", "(", "&", "sizes", "[", "0", "]", ")", ")", "\n\n", "return", "sizes", "\n", "}" ]
// GetApproximateSizesCF returns the approximate number of bytes of file system // space used by one or more key ranges in the column family. // // The keys counted will begin at Range.Start and end on the key before // Range.Limit.
[ "GetApproximateSizesCF", "returns", "the", "approximate", "number", "of", "bytes", "of", "file", "system", "space", "used", "by", "one", "or", "more", "key", "ranges", "in", "the", "column", "family", ".", "The", "keys", "counted", "will", "begin", "at", "Range", ".", "Start", "and", "end", "on", "the", "key", "before", "Range", ".", "Limit", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/db.go#L569-L597
151,489
tecbot/gorocksdb
db.go
GetLiveFilesMetaData
func (db *DB) GetLiveFilesMetaData() []LiveFileMetadata { lf := C.rocksdb_livefiles(db.c) defer C.rocksdb_livefiles_destroy(lf) count := C.rocksdb_livefiles_count(lf) liveFiles := make([]LiveFileMetadata, int(count)) for i := C.int(0); i < count; i++ { var liveFile LiveFileMetadata liveFile.Name = C.GoString(C.rocksdb_livefiles_name(lf, i)) liveFile.Level = int(C.rocksdb_livefiles_level(lf, i)) liveFile.Size = int64(C.rocksdb_livefiles_size(lf, i)) var cSize C.size_t key := C.rocksdb_livefiles_smallestkey(lf, i, &cSize) liveFile.SmallestKey = C.GoBytes(unsafe.Pointer(key), C.int(cSize)) key = C.rocksdb_livefiles_largestkey(lf, i, &cSize) liveFile.LargestKey = C.GoBytes(unsafe.Pointer(key), C.int(cSize)) liveFiles[int(i)] = liveFile } return liveFiles }
go
func (db *DB) GetLiveFilesMetaData() []LiveFileMetadata { lf := C.rocksdb_livefiles(db.c) defer C.rocksdb_livefiles_destroy(lf) count := C.rocksdb_livefiles_count(lf) liveFiles := make([]LiveFileMetadata, int(count)) for i := C.int(0); i < count; i++ { var liveFile LiveFileMetadata liveFile.Name = C.GoString(C.rocksdb_livefiles_name(lf, i)) liveFile.Level = int(C.rocksdb_livefiles_level(lf, i)) liveFile.Size = int64(C.rocksdb_livefiles_size(lf, i)) var cSize C.size_t key := C.rocksdb_livefiles_smallestkey(lf, i, &cSize) liveFile.SmallestKey = C.GoBytes(unsafe.Pointer(key), C.int(cSize)) key = C.rocksdb_livefiles_largestkey(lf, i, &cSize) liveFile.LargestKey = C.GoBytes(unsafe.Pointer(key), C.int(cSize)) liveFiles[int(i)] = liveFile } return liveFiles }
[ "func", "(", "db", "*", "DB", ")", "GetLiveFilesMetaData", "(", ")", "[", "]", "LiveFileMetadata", "{", "lf", ":=", "C", ".", "rocksdb_livefiles", "(", "db", ".", "c", ")", "\n", "defer", "C", ".", "rocksdb_livefiles_destroy", "(", "lf", ")", "\n\n", "count", ":=", "C", ".", "rocksdb_livefiles_count", "(", "lf", ")", "\n", "liveFiles", ":=", "make", "(", "[", "]", "LiveFileMetadata", ",", "int", "(", "count", ")", ")", "\n", "for", "i", ":=", "C", ".", "int", "(", "0", ")", ";", "i", "<", "count", ";", "i", "++", "{", "var", "liveFile", "LiveFileMetadata", "\n", "liveFile", ".", "Name", "=", "C", ".", "GoString", "(", "C", ".", "rocksdb_livefiles_name", "(", "lf", ",", "i", ")", ")", "\n", "liveFile", ".", "Level", "=", "int", "(", "C", ".", "rocksdb_livefiles_level", "(", "lf", ",", "i", ")", ")", "\n", "liveFile", ".", "Size", "=", "int64", "(", "C", ".", "rocksdb_livefiles_size", "(", "lf", ",", "i", ")", ")", "\n\n", "var", "cSize", "C", ".", "size_t", "\n", "key", ":=", "C", ".", "rocksdb_livefiles_smallestkey", "(", "lf", ",", "i", ",", "&", "cSize", ")", "\n", "liveFile", ".", "SmallestKey", "=", "C", ".", "GoBytes", "(", "unsafe", ".", "Pointer", "(", "key", ")", ",", "C", ".", "int", "(", "cSize", ")", ")", "\n\n", "key", "=", "C", ".", "rocksdb_livefiles_largestkey", "(", "lf", ",", "i", ",", "&", "cSize", ")", "\n", "liveFile", ".", "LargestKey", "=", "C", ".", "GoBytes", "(", "unsafe", ".", "Pointer", "(", "key", ")", ",", "C", ".", "int", "(", "cSize", ")", ")", "\n", "liveFiles", "[", "int", "(", "i", ")", "]", "=", "liveFile", "\n", "}", "\n", "return", "liveFiles", "\n", "}" ]
// GetLiveFilesMetaData returns a list of all table files with their // level, start key and end key.
[ "GetLiveFilesMetaData", "returns", "a", "list", "of", "all", "table", "files", "with", "their", "level", "start", "key", "and", "end", "key", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/db.go#L610-L631
151,490
tecbot/gorocksdb
db.go
CompactRangeCF
func (db *DB) CompactRangeCF(cf *ColumnFamilyHandle, r Range) { cStart := byteToChar(r.Start) cLimit := byteToChar(r.Limit) C.rocksdb_compact_range_cf(db.c, cf.c, cStart, C.size_t(len(r.Start)), cLimit, C.size_t(len(r.Limit))) }
go
func (db *DB) CompactRangeCF(cf *ColumnFamilyHandle, r Range) { cStart := byteToChar(r.Start) cLimit := byteToChar(r.Limit) C.rocksdb_compact_range_cf(db.c, cf.c, cStart, C.size_t(len(r.Start)), cLimit, C.size_t(len(r.Limit))) }
[ "func", "(", "db", "*", "DB", ")", "CompactRangeCF", "(", "cf", "*", "ColumnFamilyHandle", ",", "r", "Range", ")", "{", "cStart", ":=", "byteToChar", "(", "r", ".", "Start", ")", "\n", "cLimit", ":=", "byteToChar", "(", "r", ".", "Limit", ")", "\n", "C", ".", "rocksdb_compact_range_cf", "(", "db", ".", "c", ",", "cf", ".", "c", ",", "cStart", ",", "C", ".", "size_t", "(", "len", "(", "r", ".", "Start", ")", ")", ",", "cLimit", ",", "C", ".", "size_t", "(", "len", "(", "r", ".", "Limit", ")", ")", ")", "\n", "}" ]
// CompactRangeCF runs a manual compaction on the Range of keys given on the // given column family. This is not likely to be needed for typical usage.
[ "CompactRangeCF", "runs", "a", "manual", "compaction", "on", "the", "Range", "of", "keys", "given", "on", "the", "given", "column", "family", ".", "This", "is", "not", "likely", "to", "be", "needed", "for", "typical", "usage", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/db.go#L643-L647
151,491
tecbot/gorocksdb
db.go
Flush
func (db *DB) Flush(opts *FlushOptions) error { var cErr *C.char C.rocksdb_flush(db.c, opts.c, &cErr) if cErr != nil { defer C.free(unsafe.Pointer(cErr)) return errors.New(C.GoString(cErr)) } return nil }
go
func (db *DB) Flush(opts *FlushOptions) error { var cErr *C.char C.rocksdb_flush(db.c, opts.c, &cErr) if cErr != nil { defer C.free(unsafe.Pointer(cErr)) return errors.New(C.GoString(cErr)) } return nil }
[ "func", "(", "db", "*", "DB", ")", "Flush", "(", "opts", "*", "FlushOptions", ")", "error", "{", "var", "cErr", "*", "C", ".", "char", "\n", "C", ".", "rocksdb_flush", "(", "db", ".", "c", ",", "opts", ".", "c", ",", "&", "cErr", ")", "\n", "if", "cErr", "!=", "nil", "{", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cErr", ")", ")", "\n", "return", "errors", ".", "New", "(", "C", ".", "GoString", "(", "cErr", ")", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// Flush triggers a manuel flush for the database.
[ "Flush", "triggers", "a", "manuel", "flush", "for", "the", "database", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/db.go#L650-L658
151,492
tecbot/gorocksdb
db.go
DisableFileDeletions
func (db *DB) DisableFileDeletions() error { var cErr *C.char C.rocksdb_disable_file_deletions(db.c, &cErr) if cErr != nil { defer C.free(unsafe.Pointer(cErr)) return errors.New(C.GoString(cErr)) } return nil }
go
func (db *DB) DisableFileDeletions() error { var cErr *C.char C.rocksdb_disable_file_deletions(db.c, &cErr) if cErr != nil { defer C.free(unsafe.Pointer(cErr)) return errors.New(C.GoString(cErr)) } return nil }
[ "func", "(", "db", "*", "DB", ")", "DisableFileDeletions", "(", ")", "error", "{", "var", "cErr", "*", "C", ".", "char", "\n", "C", ".", "rocksdb_disable_file_deletions", "(", "db", ".", "c", ",", "&", "cErr", ")", "\n", "if", "cErr", "!=", "nil", "{", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cErr", ")", ")", "\n", "return", "errors", ".", "New", "(", "C", ".", "GoString", "(", "cErr", ")", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// DisableFileDeletions disables file deletions and should be used when backup the database.
[ "DisableFileDeletions", "disables", "file", "deletions", "and", "should", "be", "used", "when", "backup", "the", "database", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/db.go#L661-L669
151,493
tecbot/gorocksdb
db.go
EnableFileDeletions
func (db *DB) EnableFileDeletions(force bool) error { var cErr *C.char C.rocksdb_enable_file_deletions(db.c, boolToChar(force), &cErr) if cErr != nil { defer C.free(unsafe.Pointer(cErr)) return errors.New(C.GoString(cErr)) } return nil }
go
func (db *DB) EnableFileDeletions(force bool) error { var cErr *C.char C.rocksdb_enable_file_deletions(db.c, boolToChar(force), &cErr) if cErr != nil { defer C.free(unsafe.Pointer(cErr)) return errors.New(C.GoString(cErr)) } return nil }
[ "func", "(", "db", "*", "DB", ")", "EnableFileDeletions", "(", "force", "bool", ")", "error", "{", "var", "cErr", "*", "C", ".", "char", "\n", "C", ".", "rocksdb_enable_file_deletions", "(", "db", ".", "c", ",", "boolToChar", "(", "force", ")", ",", "&", "cErr", ")", "\n", "if", "cErr", "!=", "nil", "{", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cErr", ")", ")", "\n", "return", "errors", ".", "New", "(", "C", ".", "GoString", "(", "cErr", ")", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// EnableFileDeletions enables file deletions for the database.
[ "EnableFileDeletions", "enables", "file", "deletions", "for", "the", "database", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/db.go#L672-L680
151,494
tecbot/gorocksdb
db.go
IngestExternalFile
func (db *DB) IngestExternalFile(filePaths []string, opts *IngestExternalFileOptions) error { cFilePaths := make([]*C.char, len(filePaths)) for i, s := range filePaths { cFilePaths[i] = C.CString(s) } defer func() { for _, s := range cFilePaths { C.free(unsafe.Pointer(s)) } }() var cErr *C.char C.rocksdb_ingest_external_file( db.c, &cFilePaths[0], C.size_t(len(filePaths)), opts.c, &cErr, ) if cErr != nil { defer C.free(unsafe.Pointer(cErr)) return errors.New(C.GoString(cErr)) } return nil }
go
func (db *DB) IngestExternalFile(filePaths []string, opts *IngestExternalFileOptions) error { cFilePaths := make([]*C.char, len(filePaths)) for i, s := range filePaths { cFilePaths[i] = C.CString(s) } defer func() { for _, s := range cFilePaths { C.free(unsafe.Pointer(s)) } }() var cErr *C.char C.rocksdb_ingest_external_file( db.c, &cFilePaths[0], C.size_t(len(filePaths)), opts.c, &cErr, ) if cErr != nil { defer C.free(unsafe.Pointer(cErr)) return errors.New(C.GoString(cErr)) } return nil }
[ "func", "(", "db", "*", "DB", ")", "IngestExternalFile", "(", "filePaths", "[", "]", "string", ",", "opts", "*", "IngestExternalFileOptions", ")", "error", "{", "cFilePaths", ":=", "make", "(", "[", "]", "*", "C", ".", "char", ",", "len", "(", "filePaths", ")", ")", "\n", "for", "i", ",", "s", ":=", "range", "filePaths", "{", "cFilePaths", "[", "i", "]", "=", "C", ".", "CString", "(", "s", ")", "\n", "}", "\n", "defer", "func", "(", ")", "{", "for", "_", ",", "s", ":=", "range", "cFilePaths", "{", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "s", ")", ")", "\n", "}", "\n", "}", "(", ")", "\n\n", "var", "cErr", "*", "C", ".", "char", "\n\n", "C", ".", "rocksdb_ingest_external_file", "(", "db", ".", "c", ",", "&", "cFilePaths", "[", "0", "]", ",", "C", ".", "size_t", "(", "len", "(", "filePaths", ")", ")", ",", "opts", ".", "c", ",", "&", "cErr", ",", ")", "\n\n", "if", "cErr", "!=", "nil", "{", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cErr", ")", ")", "\n", "return", "errors", ".", "New", "(", "C", ".", "GoString", "(", "cErr", ")", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// IngestExternalFile loads a list of external SST files.
[ "IngestExternalFile", "loads", "a", "list", "of", "external", "SST", "files", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/db.go#L692-L718
151,495
tecbot/gorocksdb
db.go
DestroyDb
func DestroyDb(name string, opts *Options) error { var ( cErr *C.char cName = C.CString(name) ) defer C.free(unsafe.Pointer(cName)) C.rocksdb_destroy_db(opts.c, cName, &cErr) if cErr != nil { defer C.free(unsafe.Pointer(cErr)) return errors.New(C.GoString(cErr)) } return nil }
go
func DestroyDb(name string, opts *Options) error { var ( cErr *C.char cName = C.CString(name) ) defer C.free(unsafe.Pointer(cName)) C.rocksdb_destroy_db(opts.c, cName, &cErr) if cErr != nil { defer C.free(unsafe.Pointer(cErr)) return errors.New(C.GoString(cErr)) } return nil }
[ "func", "DestroyDb", "(", "name", "string", ",", "opts", "*", "Options", ")", "error", "{", "var", "(", "cErr", "*", "C", ".", "char", "\n", "cName", "=", "C", ".", "CString", "(", "name", ")", "\n", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cName", ")", ")", "\n", "C", ".", "rocksdb_destroy_db", "(", "opts", ".", "c", ",", "cName", ",", "&", "cErr", ")", "\n", "if", "cErr", "!=", "nil", "{", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cErr", ")", ")", "\n", "return", "errors", ".", "New", "(", "C", ".", "GoString", "(", "cErr", ")", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// DestroyDb removes a database entirely, removing everything from the // filesystem.
[ "DestroyDb", "removes", "a", "database", "entirely", "removing", "everything", "from", "the", "filesystem", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/db.go#L773-L785
151,496
tecbot/gorocksdb
options_write.go
Destroy
func (opts *WriteOptions) Destroy() { C.rocksdb_writeoptions_destroy(opts.c) opts.c = nil }
go
func (opts *WriteOptions) Destroy() { C.rocksdb_writeoptions_destroy(opts.c) opts.c = nil }
[ "func", "(", "opts", "*", "WriteOptions", ")", "Destroy", "(", ")", "{", "C", ".", "rocksdb_writeoptions_destroy", "(", "opts", ".", "c", ")", "\n", "opts", ".", "c", "=", "nil", "\n", "}" ]
// Destroy deallocates the WriteOptions object.
[ "Destroy", "deallocates", "the", "WriteOptions", "object", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/options_write.go#L39-L42
151,497
tecbot/gorocksdb
options_compression.go
NewCompressionOptions
func NewCompressionOptions(windowBits, level, strategy, maxDictBytes int) *CompressionOptions { return &CompressionOptions{ WindowBits: windowBits, Level: level, Strategy: strategy, MaxDictBytes: maxDictBytes, } }
go
func NewCompressionOptions(windowBits, level, strategy, maxDictBytes int) *CompressionOptions { return &CompressionOptions{ WindowBits: windowBits, Level: level, Strategy: strategy, MaxDictBytes: maxDictBytes, } }
[ "func", "NewCompressionOptions", "(", "windowBits", ",", "level", ",", "strategy", ",", "maxDictBytes", "int", ")", "*", "CompressionOptions", "{", "return", "&", "CompressionOptions", "{", "WindowBits", ":", "windowBits", ",", "Level", ":", "level", ",", "Strategy", ":", "strategy", ",", "MaxDictBytes", ":", "maxDictBytes", ",", "}", "\n", "}" ]
// NewCompressionOptions creates a CompressionOptions object.
[ "NewCompressionOptions", "creates", "a", "CompressionOptions", "object", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/options_compression.go#L17-L24
151,498
tecbot/gorocksdb
checkpoint.go
Destroy
func (checkpoint *Checkpoint) Destroy() { C.rocksdb_checkpoint_object_destroy(checkpoint.c) checkpoint.c = nil }
go
func (checkpoint *Checkpoint) Destroy() { C.rocksdb_checkpoint_object_destroy(checkpoint.c) checkpoint.c = nil }
[ "func", "(", "checkpoint", "*", "Checkpoint", ")", "Destroy", "(", ")", "{", "C", ".", "rocksdb_checkpoint_object_destroy", "(", "checkpoint", ".", "c", ")", "\n", "checkpoint", ".", "c", "=", "nil", "\n", "}" ]
// Destroy deallocates the Checkpoint object.
[ "Destroy", "deallocates", "the", "Checkpoint", "object", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/checkpoint.go#L53-L56
151,499
tecbot/gorocksdb
options_flush.go
Destroy
func (opts *FlushOptions) Destroy() { C.rocksdb_flushoptions_destroy(opts.c) opts.c = nil }
go
func (opts *FlushOptions) Destroy() { C.rocksdb_flushoptions_destroy(opts.c) opts.c = nil }
[ "func", "(", "opts", "*", "FlushOptions", ")", "Destroy", "(", ")", "{", "C", ".", "rocksdb_flushoptions_destroy", "(", "opts", ".", "c", ")", "\n", "opts", ".", "c", "=", "nil", "\n", "}" ]
// Destroy deallocates the FlushOptions object.
[ "Destroy", "deallocates", "the", "FlushOptions", "object", "." ]
8752a943348155073ae407010e2b75c40480271a
https://github.com/tecbot/gorocksdb/blob/8752a943348155073ae407010e2b75c40480271a/options_flush.go#L29-L32