From 6a6bc6128d4cefb54ddfd6c8eaa9524026d96399 Mon Sep 17 00:00:00 2001 From: Patrick Sattler Date: Mon, 8 Jun 2020 21:32:25 +0200 Subject: [PATCH 1/4] add max file size option --- leveldb_test.go | 1 + options.go | 8 ++++++++ 2 files changed, 9 insertions(+) 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. // From d490f810ee8032cbdace950b94c860776871b361 Mon Sep 17 00:00:00 2001 From: Patrick Sattler Date: Tue, 9 Jun 2020 11:26:12 +0200 Subject: [PATCH 2/4] update makefile for new LevelDB version --- .travis/Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis/Makefile b/.travis/Makefile index c42d2ed..c617e56 100644 --- a/.travis/Makefile +++ b/.travis/Makefile @@ -7,7 +7,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 From c0af1f2bbe56ecb4a3a78c188ae43f08de5f4ded Mon Sep 17 00:00:00 2001 From: Patrick Sattler Date: Tue, 9 Jun 2020 11:29:38 +0200 Subject: [PATCH 3/4] fix leveldb version --- .travis/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis/Makefile b/.travis/Makefile index c617e56..a8bea2e 100644 --- a/.travis/Makefile +++ b/.travis/Makefile @@ -1,6 +1,6 @@ all: test -LEVELDB_VERSION ?= v1.18 +LEVELDB_VERSION ?= 1.22 SNAPPY_VERSION ?= 1.1.7 export CFLAGS ?= -I$(PWD)/root/snappy-$(SNAPPY_VERSION)/include From 29f130d10078211ba78667b95d1c07835c6874d1 Mon Sep 17 00:00:00 2001 From: Patrick Sattler Date: Tue, 9 Jun 2020 17:17:57 +0200 Subject: [PATCH 4/4] change go mod to enable import for others --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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