Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update to leveldb 1.22 and add max file size #56

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .travis/Makefile
Original file line number Diff line number Diff line change
@@ -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)

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module github.com/jmhodges/levigo
module github.com/sattler/levigo

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: undo this?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If a maintainer is willing to merge it I will revert it. Currently the usage of my change is easier with this change


go 1.13
1 change: 1 addition & 0 deletions leveldb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
8 changes: 8 additions & 0 deletions options.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
//
Expand Down