We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
` const ( cFNameDefault = "default" //cFNameTest = "test" DB_PATH = "./backup" timestampSize = 8 )
func OpenDB() (*grocksdb.DB, error) { opts := grocksdb.NewDefaultOptions() opts.SetCreateIfMissing(true) db, err := grocksdb.OpenDbForReadOnly(opts, DB_PATH, true) if err != nil { log.Fatalln("OPEN DB error", db, err) db.Close() return nil, errors.New("fail to open db") } else { log.Println("OPEN DB success", db) } return db, nil }
func main() { logrus.Info("rocksdb test begin") db, err := OpenDB() if err != nil { log.Println("fail to open db,", nil, db) }
ro := grocksdb.NewDefaultReadOptions() ro.SetFillCache(false) it := db.NewIterator(ro) defer it.Close() for it.SeekToFirst(); it.Valid(); it.Next() { logrus.Info("table_db item name:", string((it.Key().Data()))) key := it.Key() value := it.Value() fmt.Printf("Key: %v Value: %v\n", key.Data(), value.Data()) key.Free() value.Free() } if err := it.Err(); err != nil { log.Fatalln("Seek DB error", db, err) db.Close() }
} `
The text was updated successfully, but these errors were encountered:
Hi @GpsLypy
Regarding https://github.com/linxGnu/grocksdb/blob/master/c.h (exposed by RocksDB):
Sorry, something went wrong.
No branches or pull requests
`
const (
cFNameDefault = "default"
//cFNameTest = "test"
DB_PATH = "./backup"
timestampSize = 8
)
func OpenDB() (*grocksdb.DB, error) {
opts := grocksdb.NewDefaultOptions()
opts.SetCreateIfMissing(true)
db, err := grocksdb.OpenDbForReadOnly(opts, DB_PATH, true)
if err != nil {
log.Fatalln("OPEN DB error", db, err)
db.Close()
return nil, errors.New("fail to open db")
} else {
log.Println("OPEN DB success", db)
}
return db, nil
}
func main() {
logrus.Info("rocksdb test begin")
db, err := OpenDB()
if err != nil {
log.Println("fail to open db,", nil, db)
}
}
`
The text was updated successfully, but these errors were encountered: