forked from dgraph-io/dgraph
-
Notifications
You must be signed in to change notification settings - Fork 0
/
options.go
35 lines (29 loc) · 977 Bytes
/
options.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 rdb
// #include <stdint.h>
// #include <stdlib.h>
// #include "rdbc.h"
import "C"
// Options represent all of the available options when opening a database with Open.
type Options struct {
c *C.rdb_options_t
bbto *BlockBasedTableOptions
}
// NewDefaultOptions creates the default Options.
func NewDefaultOptions() *Options {
return NewNativeOptions(C.rdb_options_create())
}
// NewNativeOptions creates a Options object.
func NewNativeOptions(c *C.rdb_options_t) *Options {
return &Options{c: c}
}
// SetCreateIfMissing specifies whether the database
// should be created if it is missing.
// Default: false
func (opts *Options) SetCreateIfMissing(value bool) {
C.rdb_options_set_create_if_missing(opts.c, boolToChar(value))
}
// SetBlockBasedTableFactory sets the block based table factory.
func (opts *Options) SetBlockBasedTableFactory(value *BlockBasedTableOptions) {
opts.bbto = value
C.rdb_options_set_block_based_table_factory(opts.c, value.c)
}