-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsave_ingest.go
More file actions
41 lines (38 loc) · 862 Bytes
/
save_ingest.go
File metadata and controls
41 lines (38 loc) · 862 Bytes
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
package gonemo
// #include "nemo_c.h"
// #include <stdlib.h>
import "C"
import (
"errors"
"unsafe"
)
// RawScanSaveRange Save range to sst file
func (nemo *NEMO) RawScanSaveRange(path string, start []byte, end []byte, UseSnapshot bool) error {
var cErr *C.char
cPath := C.CString(path)
C.nemo_RawScanSaveAll(nemo.c,
cPath,
goByte2char(start), C.size_t(len(start)),
goByte2char(end), C.size_t(len(end)),
C.bool(UseSnapshot),
&cErr,
)
if cErr != nil {
res := errors.New(C.GoString(cErr))
C.free(unsafe.Pointer(cErr))
return res
}
return nil
}
// IngestFile Ingest sst files from path
func (nemo *NEMO) IngestFile(path string) error {
var cErr *C.char
cPath := C.CString(path)
C.nemo_IngestFile(nemo.c, cPath, &cErr)
if cErr != nil {
res := errors.New(C.GoString(cErr))
C.free(unsafe.Pointer(cErr))
return res
}
return nil
}