Skip to content

Commit

Permalink
Added RocksDBOptions struct
Browse files Browse the repository at this point in the history
  • Loading branch information
evgeniy-scherbina committed Jul 17, 2024
1 parent 15bb6b0 commit 03f7174
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions opendb_rocksdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,21 @@ const (
asyncIOReadOptName = "rocksdb.read-async-io"
)

type RocksDBOptions struct {
appOpts AppOptions
dbName string
}

func (opts *RocksDBOptions) Get(key string) interface{} {
dbSpecificKey := fmt.Sprintf("rocksdb.%v.%v", opts.dbName, key)
if opts.appOpts.Get(dbSpecificKey) != nil {
return opts.appOpts.Get(dbSpecificKey)
}

fallbackKey := fmt.Sprintf("rocksdb.%v", key)
return opts.appOpts.Get(fallbackKey)
}

// AppOptions is the same interface as provided by cosmos-sdk, see for details:
// https://github.com/cosmos/cosmos-sdk/blob/10465a6aabdfc9119ff187ac3ef229f33c06ab45/server/types/app.go#L29-L31
// We added it here to avoid cosmos-sdk dependency.
Expand Down

0 comments on commit 03f7174

Please sign in to comment.