Makefile setup & key/value coherent datatypes & refactoring (#98)

* internal/data: comment exported functions

* internal/data: make smaller codec exported api surface

* make key and value sizes serializing bubble up to everything

* Makefile setup & go mod tidy
This commit is contained in:
Ignacio Hagopian
2019-09-12 10:44:26 -03:00
committed by GitHub
parent 7e0fa151f7
commit 5be114adab
14 changed files with 112 additions and 69 deletions

View File

@@ -7,10 +7,10 @@ const (
DefaultMaxDatafileSize = 1 << 20 // 1MB
// DefaultMaxKeySize is the default maximum key size in bytes
DefaultMaxKeySize = 64 // 64 bytes
DefaultMaxKeySize = uint32(64) // 64 bytes
// DefaultMaxValueSize is the default value size in bytes
DefaultMaxValueSize = 1 << 16 // 65KB
DefaultMaxValueSize = uint64(1 << 16) // 65KB
// DefaultSync is the default file synchronization action
DefaultSync = false
@@ -28,7 +28,7 @@ func WithMaxDatafileSize(size int) Option {
}
// WithMaxKeySize sets the maximum key size option
func WithMaxKeySize(size int) Option {
func WithMaxKeySize(size uint32) Option {
return func(cfg *config.Config) error {
cfg.MaxKeySize = size
return nil
@@ -36,7 +36,7 @@ func WithMaxKeySize(size int) Option {
}
// WithMaxValueSize sets the maximum value size option
func WithMaxValueSize(size int) Option {
func WithMaxValueSize(size uint64) Option {
return func(cfg *config.Config) error {
cfg.MaxValueSize = size
return nil