diff --git a/.travis/Makefile b/.travis/Makefile index c42d2ed..a8bea2e 100644 --- a/.travis/Makefile +++ b/.travis/Makefile @@ -1,13 +1,13 @@ all: test -LEVELDB_VERSION ?= v1.18 +LEVELDB_VERSION ?= 1.22 SNAPPY_VERSION ?= 1.1.7 export CFLAGS ?= -I$(PWD)/root/snappy-$(SNAPPY_VERSION)/include export CXXFLAGS ?= -I$(PWD)/root/snappy-$(SNAPPY_VERSION)/build export LDFLAGS ?= -L$(PWD)/root/snappy-$(SNAPPY_VERSION)/build export CGO_CFLAGS ?= -I$(PWD)/root/snappy-$(SNAPPY_VERSION)/build -I$(PWD)/root/leveldb/include -export CGO_LDFLAGS ?= -L$(PWD)/root/snappy-$(SNAPPY_VERSION)/build -L$(PWD)/root/leveldb -lsnappy +export CGO_LDFLAGS ?= -L$(PWD)/root/snappy-$(SNAPPY_VERSION)/build -L$(PWD)/root/leveldb/build -lsnappy export GOPATH ?= $(PWD)/root/go export LD_LIBRARY_PATH := $(PWD)/root/snappy-$(SNAPPY_VERSION)/build:$(PWD)/root/leveldb:$(LD_LIBRARY_PATH) @@ -30,7 +30,8 @@ root/leveldb: root root/leveldb/STAMP: root/leveldb root/snappy-$(SNAPPY_VERSION)/STAMP cd root/leveldb && git checkout $(LEVELDB_VERSION) - $(MAKE) -C root/leveldb + cmake --DCMAKE_BUILD_TYPE=Release -S root/leveldb -B root/leveldb/build + cmake --build root/leveldb/build touch $@ root/snappy-$(SNAPPY_VERSION): archives/snappy-$(SNAPPY_VERSION).tar.gz root diff --git a/go.mod b/go.mod index 95d9fc3..e56856c 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ -module github.com/jmhodges/levigo +module github.com/sattler/levigo go 1.13 diff --git a/leveldb_test.go b/leveldb_test.go index f4537fd..50bbd54 100644 --- a/leveldb_test.go +++ b/leveldb_test.go @@ -35,6 +35,7 @@ func TestC(t *testing.T) { options.SetParanoidChecks(true) options.SetMaxOpenFiles(10) options.SetBlockSize(1024) + options.SetMaxFileSize(4 << 20) options.SetBlockRestartInterval(8) options.SetCompression(NoCompression) diff --git a/options.go b/options.go index dae187b..e191778 100644 --- a/options.go +++ b/options.go @@ -134,6 +134,14 @@ func (o *Options) SetBlockSize(s int) { C.leveldb_options_set_block_size(o.Opt, C.size_t(s)) } +// SetMaxFileSize sets the maximum size of a file on the file system. +// +// The default is 4MB. A better setting depends on +// your use case. See the LevelDB documentation for details. +func (o *Options) SetMaxFileSize(s int) { + C.leveldb_options_set_max_file_size(o.Opt, C.size_t(s)) +} + // SetBlockRestartInterval is the number of keys between restarts points for // delta encoding keys. //