Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
8fe7965
Add support for checkpoints
JelteF May 11, 2017
e0dec52
Merge branch 'checkpoint'
JelteF May 18, 2017
e06553f
Revert "Merge branch 'checkpoint'"
JelteF Sep 26, 2017
6fb97b4
Merge remote-tracking branch 'upstream/master'
JelteF Sep 26, 2017
cbe0e21
Start with putv
JelteF Sep 29, 2017
42cb556
Add ManyKeys functionality
JelteF Sep 29, 2017
7c8e018
ANSI C WOOOHOOO
JelteF Sep 29, 2017
77769d6
wip
mgom Sep 30, 2017
38a896e
add iter many keys with filtering
mgom Sep 30, 2017
58af85d
cleanup
mgom Sep 30, 2017
ae6b37f
add NextManyKeys.Values()
mgom Oct 1, 2017
83f8a8e
add CGO ManySearchKeys
mgom Oct 2, 2017
fef8892
add limit config to search
mgom Oct 2, 2017
3d951f2
dynamic allocation + handle infinite limit
mgom Oct 3, 2017
82118bf
add ManyKeysPageAllocSize
mgom Oct 3, 2017
e901e9b
add ManyKeys.Each function
mgom Oct 3, 2017
f3ae3b9
add Each index
mgom Oct 3, 2017
8d9db7c
add should continue
mgom Oct 3, 2017
76b2f4a
Each returns if all have been processsed or no
mgom Oct 3, 2017
8608637
cgo calls saver
mgom Oct 4, 2017
2055f46
cgo calls saver
mgom Oct 4, 2017
21b73ec
ManySearchKeysExp
mgom Oct 4, 2017
40e1323
Merge remote-tracking branch 'origin' into putv
JelteF Oct 5, 2017
ebee241
Add PutMany C API
JelteF Oct 5, 2017
df97ddb
Merge pull request #1 from GetStream/putv
mgom Oct 9, 2017
2c71dcf
cleanup, fix key_end+next, add prev
mgom Oct 10, 2017
8612af4
cleanup + add reverse to ManySearchKeys
mgom Oct 10, 2017
633ea42
add ExcludeKeyFrom option for ManySearchKeys
mgom Oct 10, 2017
bf68d76
fix / call rocksdb_iter_seek_for_prev when prev is used
mgom Oct 10, 2017
bee9853
elaborate tests
mgom Oct 10, 2017
0257acd
ManySearch accepting enpty KeyFrom
mgom Oct 11, 2017
15ea28d
Free memory earlier for PutMany operation
JelteF Jan 9, 2018
cbf9512
Merge pull request #2 from GetStream/fix-memory-leak
JelteF Jan 31, 2018
45daa38
Add an Exists method to Slice to make it possible to make code clearer
JelteF Jan 31, 2018
dd409ef
Gitignore: Ignore .rocksdb-dir
JelteF Jan 31, 2018
e5116c9
Make bytesSliceToArray acknowledge CGO rules of not passing Go pointe…
JelteF Jan 31, 2018
7f3d89b
Merge pull request #3 from GetStream/exists-method
mgom Jan 31, 2018
787b875
Implement multiget
JelteF Jan 31, 2018
e2cedde
Simplify slices of c element handling
JelteF Jan 31, 2018
50fd44b
Revert early freeing of byte slices in PutMany to be safer
JelteF Jan 31, 2018
c52f0a2
Implement MultiGet for column families
JelteF Jan 31, 2018
dfb6148
Only build go 1.9
JelteF Jan 31, 2018
048fbcf
Merge pull request #5 from GetStream/multiget
JelteF Jan 31, 2018
dcebded
Test using cgocheck=2 and fix compaction_filter test for that
JelteF Jan 31, 2018
282102a
Travis: Test with rocksdb v5.7.3
JelteF Feb 1, 2018
db8b24c
Merge pull request #6 from GetStream/use-cgocheck2-fork
JelteF Feb 1, 2018
f8aef89
Add bindings for lowering CPU and IO priority of thread pools
JelteF May 6, 2019
aeb2da8
Merge branch 'upstream' into merge-upstream
JelteF Jun 25, 2019
ee9d1f3
Use newer version of rocksdb on travis
JelteF Jun 25, 2019
2653ff4
Use newer version of rocksdb on travis
JelteF Jun 25, 2019
e8d9b90
Fix tests after merge
JelteF Jun 25, 2019
f498bc6
Fix tests
JelteF Jun 25, 2019
a92543c
Merge pull request #7 from GetStream/merge-upstream
JelteF Jun 25, 2019
d96f825
Merge pull request #8 from GetStream/add-lower-priority-c-bindings
JelteF Jun 25, 2019
c16f09d
Use a malloc allocated bytes for set_iterate_upper_bound
JelteF Jun 25, 2019
42987db
Merge pull request #9 from GetStream/fix-SetIterateUpperBound
JelteF Jun 25, 2019
16bd824
Merge branch 'master' of github.com:tecbot/gorocksdb
thesyncim Feb 25, 2020
7423e0b
Revert "Merge branch 'master' of github.com:tecbot/gorocksdb"
thesyncim Feb 25, 2020
e5b7196
DeleteRange DeleteRangeCF
Apr 25, 2019
d5717da
DeleteFileInRange
May 24, 2019
561e7ca
DeleteFileInRange and comments
Jun 3, 2019
4cccc90
add test for DeleteRange
Jun 3, 2019
f708deb
Add test dockerfile
driver-devel Aug 16, 2021
e415694
Add go mods and compose
driver-devel Aug 17, 2021
03e6808
Add new line
driver-devel Aug 17, 2021
1512bd4
Fix makefile
driver-devel Aug 17, 2021
ac984c8
Add cgocheck=2
driver-devel Aug 17, 2021
7bb4d0c
Merge pull request #11 from GetStream/delete-range
Aug 17, 2021
fafa98c
update lib
itsmeadi May 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/.rocksdb-repo
.idea
10 changes: 5 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
dist: xenial
language: go
go:
- 1.12.x
- 1.13.x
- '1.10'
- 1.11
- tip

before_install:
Expand All @@ -17,8 +16,9 @@ before_install:
- sudo dpkg -i libgflags-dev_2.0-1.1ubuntu1_amd64.deb

install:
- git clone https://github.com/facebook/rocksdb.git /tmp/rocksdb
- git clone https://github.com/GetStream/rocksdb.git /tmp/rocksdb
- pushd /tmp/rocksdb
- git checkout add-lower-priority-c-bindings
- make clean
- make shared_lib -j`nproc`
- sudo cp --preserve=links ./librocksdb.* /usr/lib/
Expand All @@ -27,7 +27,7 @@ install:
- go get -t ./...

script:
- go test -v ./
- GODEBUG=cgocheck=2 go test -v ./

notifications:
email:
Expand Down
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.PHONY: docker-clean
docker-clean:
@docker compose down -v --remove-orphans

.PHONY: docker-test
docker-test:
@docker compose build test && docker compose run --rm -e GODEBUG=cgocheck=2 test go test -race=1 -v ./...
29 changes: 6 additions & 23 deletions backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func OpenBackupEngine(opts *Options, path string) (*BackupEngine, error) {

be := C.rocksdb_backup_engine_open(opts.c, cpath, &cErr)
if cErr != nil {
defer C.rocksdb_free(unsafe.Pointer(cErr))
defer C.free(unsafe.Pointer(cErr))
return nil, errors.New(C.GoString(cErr))
}
return &BackupEngine{
Expand All @@ -104,25 +104,19 @@ func (b *BackupEngine) UnsafeGetBackupEngine() unsafe.Pointer {
return unsafe.Pointer(b.c)
}

// CreateNewBackupFlush takes a new backup from db. If flush is set to true,
// it flushes the WAL before taking the backup.
func (b *BackupEngine) CreateNewBackupFlush(db *DB, flush bool) error {
// CreateNewBackup takes a new backup from db.
func (b *BackupEngine) CreateNewBackup(db *DB) error {
var cErr *C.char

C.rocksdb_backup_engine_create_new_backup_flush(b.c, db.c, boolToChar(flush), &cErr)
C.rocksdb_backup_engine_create_new_backup(b.c, db.c, &cErr)
if cErr != nil {
defer C.rocksdb_free(unsafe.Pointer(cErr))
defer C.free(unsafe.Pointer(cErr))
return errors.New(C.GoString(cErr))
}

return nil
}

// CreateNewBackup takes a new backup from db.
func (b *BackupEngine) CreateNewBackup(db *DB) error {
return b.CreateNewBackupFlush(db, false)
}

// GetInfo gets an object that gives information about
// the backups that have already been taken
func (b *BackupEngine) GetInfo() *BackupEngineInfo {
Expand All @@ -144,18 +138,7 @@ func (b *BackupEngine) RestoreDBFromLatestBackup(dbDir, walDir string, ro *Resto

C.rocksdb_backup_engine_restore_db_from_latest_backup(b.c, cDbDir, cWalDir, ro.c, &cErr)
if cErr != nil {
defer C.rocksdb_free(unsafe.Pointer(cErr))
return errors.New(C.GoString(cErr))
}
return nil
}

// PurgeOldBackups deletes all backups older than the latest 'n' backups
func (b *BackupEngine) PurgeOldBackups(n uint32) error {
var cErr *C.char
C.rocksdb_backup_engine_purge_old_backups(b.c, C.uint32_t(n), &cErr)
if cErr != nil {
defer C.rocksdb_free(unsafe.Pointer(cErr))
defer C.free(unsafe.Pointer(cErr))
return errors.New(C.GoString(cErr))
}
return nil
Expand Down
10 changes: 5 additions & 5 deletions cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ type Cache struct {
}

// NewLRUCache creates a new LRU Cache object with the capacity given.
func NewLRUCache(capacity uint64) *Cache {
func NewLRUCache(capacity int) *Cache {
return NewNativeCache(C.rocksdb_cache_create_lru(C.size_t(capacity)))
}

Expand All @@ -19,13 +19,13 @@ func NewNativeCache(c *C.rocksdb_cache_t) *Cache {
}

// GetUsage returns the Cache memory usage.
func (c *Cache) GetUsage() uint64 {
return uint64(C.rocksdb_cache_get_usage(c.c))
func (c *Cache) GetUsage() int {
return int(C.rocksdb_cache_get_usage(c.c))
}

// GetPinnedUsage returns the Cache pinned memory usage.
func (c *Cache) GetPinnedUsage() uint64 {
return uint64(C.rocksdb_cache_get_pinned_usage(c.c))
func (c *Cache) GetPinnedUsage() int {
return int(C.rocksdb_cache_get_pinned_usage(c.c))
}

// Destroy deallocates the Cache object.
Expand Down
2 changes: 1 addition & 1 deletion checkpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func (checkpoint *Checkpoint) CreateCheckpoint(checkpoint_dir string, log_size_f

C.rocksdb_checkpoint_create(checkpoint.c, cDir, C.uint64_t(log_size_for_flush), &cErr)
if cErr != nil {
defer C.rocksdb_free(unsafe.Pointer(cErr))
defer C.free(unsafe.Pointer(cErr))
return errors.New(C.GoString(cErr))
}
return nil
Expand Down
3 changes: 1 addition & 2 deletions checkpoint_test.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package gorocksdb

import (
"github.com/facebookgo/ensure"
"io/ioutil"
"os"
"testing"

"github.com/facebookgo/ensure"
)

func TestCheckpoint(t *testing.T) {
Expand Down
5 changes: 4 additions & 1 deletion compaction_filter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@ func TestCompactionFilter(t *testing.T) {
var (
changeKey = []byte("change")
changeValOld = []byte("old")
changeValNew = []byte("new")
changeValNew = cBackedBytes([]byte("new"))
deleteKey = []byte("delete")
)

defer freeCBackedBytes(changeValNew)

db := newTestDB(t, "TestCompactionFilter", func(opts *Options) {
opts.SetCompactionFilter(&mockCompactionFilter{
filter: func(level int, key, val []byte) (remove bool, newVal []byte) {
Expand Down
Loading