Skip to content

Commit

Permalink
Allows for running in arm64 and windows (and maybe other platforms) b…
Browse files Browse the repository at this point in the history
…y allowing to configure MapSize (#32)
  • Loading branch information
girino authored Sep 21, 2024
1 parent 17330d0 commit 67954de
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lmdb/lib.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ var _ eventstore.Store = (*LMDBBackend)(nil)
type LMDBBackend struct {
Path string
MaxLimit int
MapSize int64

lmdbEnv *lmdb.Env

Expand Down Expand Up @@ -49,7 +50,11 @@ func (b *LMDBBackend) Init() error {

env.SetMaxDBs(10)
env.SetMaxReaders(1000)
env.SetMapSize(1 << 38) // ~273GB
if b.MapSize == 0 {
env.SetMapSize(1 << 38) // ~273GB
} else {
env.SetMapSize(b.MapSize)
}

// create directory if it doesn't exist and open it
if err := os.MkdirAll(b.Path, 0755); err != nil {
Expand Down

0 comments on commit 67954de

Please sign in to comment.