forked from tecbot/gorocksdb
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathoptions_ingest.go
53 lines (44 loc) · 2.19 KB
/
options_ingest.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package gorocksdb
// #include "rocksdb/c.h"
import "C"
// IngestExternalFileOptions represents available options when ingesting external files.
type IngestExternalFileOptions struct {
c *C.rocksdb_ingestexternalfileoptions_t
}
// NewDefaultIngestExternalFileOptions creates a default IngestExternalFileOptions object.
func NewDefaultIngestExternalFileOptions() *IngestExternalFileOptions {
return NewNativeIngestExternalFileOptions(C.rocksdb_ingestexternalfileoptions_create())
}
// NewNativeIngestExternalFileOptions creates a IngestExternalFileOptions object.
func NewNativeIngestExternalFileOptions(c *C.rocksdb_ingestexternalfileoptions_t) *IngestExternalFileOptions {
return &IngestExternalFileOptions{c: c}
}
// SetMoveFiles specifies if it should move the files instead of copying them.
// Default to false.
func (opts *IngestExternalFileOptions) SetMoveFiles(flag bool) {
C.rocksdb_ingestexternalfileoptions_set_move_files(opts.c, boolToChar(flag))
}
// SetSnapshotConsistency if specifies the consistency.
// If set to false, an ingested file key could appear in existing snapshots that were created before the
// file was ingested.
// Default to true.
func (opts *IngestExternalFileOptions) SetSnapshotConsistency(flag bool) {
C.rocksdb_ingestexternalfileoptions_set_snapshot_consistency(opts.c, boolToChar(flag))
}
// SetAllowGlobalSeqNo sets allow_global_seqno. If set to false,IngestExternalFile() will fail if the file key
// range overlaps with existing keys or tombstones in the DB.
// Default true.
func (opts *IngestExternalFileOptions) SetAllowGlobalSeqNo(flag bool) {
C.rocksdb_ingestexternalfileoptions_set_allow_global_seqno(opts.c, boolToChar(flag))
}
// SetAllowBlockingFlush sets allow_blocking_flush. If set to false and the file key range overlaps with
// the memtable key range (memtable flush required), IngestExternalFile will fail.
// Default to true.
func (opts *IngestExternalFileOptions) SetAllowBlockingFlush(flag bool) {
C.rocksdb_ingestexternalfileoptions_set_allow_blocking_flush(opts.c, boolToChar(flag))
}
// Destroy deallocates the IngestExternalFileOptions object.
func (opts *IngestExternalFileOptions) Destroy() {
C.rocksdb_ingestexternalfileoptions_destroy(opts.c)
opts.c = nil
}