Exemplo n.º 1
0
func Repair(dbname string) error {
	opts := gorocks.NewOptions()
	defer opts.Close()
	opts.SetCache(gorocks.NewLRUCache(128 * 1024 * 1024))
	opts.SetCompression(gorocks.SnappyCompression)
	opts.SetBlockSize(32 * 1024)
	opts.SetMaxBackgroundCompactions(6)
	opts.SetWriteBufferSize(128 * 1024 * 1024)
	opts.SetMaxOpenFiles(100000)
	opts.SetCreateIfMissing(true)
	env := gorocks.NewDefaultEnv()
	defer env.Close()
	env.SetBackgroundThreads(6)
	env.SetHighPriorityBackgroundThreads(2)
	opts.SetEnv(env)

	return gorocks.RepairDatabase(dbname, opts)
}
Exemplo n.º 2
0
func NewLRUCache(capacity int) *gorocks.Cache {
	return gorocks.NewLRUCache(capacity)
}