Skip to content

Commit

Permalink
feat: allow full control on rocksdb db opening
Browse files Browse the repository at this point in the history
  • Loading branch information
yihuang committed Mar 15, 2024
1 parent fab0ae0 commit 447969c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## UNRELEASED

* Allow full control in rocksdb opening

## [v1.0.2] - 2024-02-26

* Downgrade Go version in go.mod to 1.19
Expand Down
7 changes: 6 additions & 1 deletion rocksdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,12 @@ func NewRocksDBWithOptions(name string, dir string, opts *grocksdb.Options) (*Ro
wo := grocksdb.NewDefaultWriteOptions()
woSync := grocksdb.NewDefaultWriteOptions()
woSync.SetSync(true)
return NewRocksDBWithRaw(db, ro, wo, woSync), nil
return NewRocksDBWithRawDB(db, ro, wo, woSync)

Check failure on line 74 in rocksdb.go

View workflow job for this annotation

GitHub Actions / Test

not enough return values

Check failure on line 74 in rocksdb.go

View workflow job for this annotation

GitHub Actions / golangci

not enough return values
}

// NewRocksDBWithRawDB lets caller has full control on how the db instance is constructed
func NewRocksDBWithRawDB(db *grocksdb.DB, ro *grocksdb.ReadOptions, wo *grocksdb.WriteOptions, woSync *grocksdb.WriteOptions) *RocksDB {
return NewRocksDBWithRaw(db, ro, wo, woSync)
}

// NewRocksDBWithRaw is useful if user want to create the db in read-only or seconday-standby mode,
Expand Down

0 comments on commit 447969c

Please sign in to comment.