1
0
mirror of https://github.com/astaxie/beego.git synced 2024-12-25 18:10:50 +00:00
Beego/vendor/github.com/siddontang/ledisdb/store/rocksdb/env.go

28 lines
518 B
Go
Raw Normal View History

2018-07-30 04:05:51 +00:00
// +build rocksdb
package rocksdb
// #cgo LDFLAGS: -lrocksdb
// #include "rocksdb/c.h"
import "C"
type Env struct {
Env *C.rocksdb_env_t
}
func NewDefaultEnv() *Env {
return &Env{C.rocksdb_create_default_env()}
}
func (env *Env) SetHighPriorityBackgroundThreads(n int) {
C.rocksdb_env_set_high_priority_background_threads(env.Env, C.int(n))
}
func (env *Env) SetBackgroundThreads(n int) {
C.rocksdb_env_set_background_threads(env.Env, C.int(n))
}
func (env *Env) Close() {
C.rocksdb_env_destroy(env.Env)
}