-
Notifications
You must be signed in to change notification settings - Fork 7
/
interface.go
35 lines (30 loc) · 874 Bytes
/
interface.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Package rdbstore implements CFR storage components that keep data
// in a RocksDB database, rather than in memory datastructures.
//
// These implementations are substantially slower than the corresponding in-memory
// components but can scale to games that do not fit in memory.
package rdbstore
import (
rocksdb "github.com/tecbot/gorocksdb"
)
type Params struct {
Path string
Options *rocksdb.Options
ReadOptions *rocksdb.ReadOptions
WriteOptions *rocksdb.WriteOptions
}
func DefaultParams(path string) Params {
opts := rocksdb.NewDefaultOptions()
opts.SetCreateIfMissing(true)
return Params{
Path: path,
Options: opts,
ReadOptions: rocksdb.NewDefaultReadOptions(),
WriteOptions: rocksdb.NewDefaultWriteOptions(),
}
}
func (p Params) Close() {
p.Options.Destroy()
p.ReadOptions.Destroy()
p.WriteOptions.Destroy()
}