Skip to content

Commit

Permalink
Rename option builder from WithInmemory to WithInMemory. (#1169)
Browse files Browse the repository at this point in the history
The name of the option builder func should be spelled the same as the
option name itself.

The godoc already has the func documented as "WithInMemory".
  • Loading branch information
danielmai authored Dec 23, 2019
1 parent df99253 commit ea01d38
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,13 @@ Please note that Badger obtains a lock on the directories so multiple processes
cannot open the same database at the same time.

#### In-Memory Mode/Diskless Mode
By default, badger ensures all the data is presisted to the disk. It also supports a pure
`In-Memory` mode. When Badger is running in `in-memory` mode, all the data is stored in the memory.
The read/writes are much faster in `in-memory` mode but all the data stored in badger will be lost
in case of a crash or close. To open badger in `in-memory` mode, set the `InMemory` option.
By default, Badger ensures all the data is persisted to the disk. It also supports a pure
in-memory mode. When Badger is running in in-memory mode, all the data is stored in the memory.
Reads and writes are much faster in in-memory mode, but all the data stored in Badger will be lost
in case of a crash or close. To open badger in in-memory mode, set the `InMemory` option.

```
opt := badger.DefaultOptions("").WithInmemory(true)
opt := badger.DefaultOptions("").WithInMemory(true)
```

### Transactions
Expand Down
10 changes: 5 additions & 5 deletions db_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ func TestGet(t *testing.T) {
})
})
t.Run("InMemory mode", func(t *testing.T) {
opts := DefaultOptions("").WithInmemory(true)
opts := DefaultOptions("").WithInMemory(true)
db, err := Open(opts)
require.NoError(t, err)
test(t, db)
Expand Down Expand Up @@ -543,7 +543,7 @@ func TestExistsMore(t *testing.T) {
})
})
t.Run("InMemory mode", func(t *testing.T) {
opt := DefaultOptions("").WithInmemory(true)
opt := DefaultOptions("").WithInMemory(true)
db, err := Open(opt)
require.NoError(t, err)
test(t, db)
Expand Down Expand Up @@ -617,7 +617,7 @@ func TestIterate2Basic(t *testing.T) {
})
})
t.Run("InMemory mode", func(t *testing.T) {
opt := DefaultOptions("").WithInmemory(true)
opt := DefaultOptions("").WithInMemory(true)
db, err := Open(opt)
require.NoError(t, err)
test(t, db)
Expand Down Expand Up @@ -1662,7 +1662,7 @@ func TestGoroutineLeak(t *testing.T) {
test(t, nil)
})
t.Run("InMemory mode", func(t *testing.T) {
opt := DefaultOptions("").WithInmemory(true)
opt := DefaultOptions("").WithInMemory(true)
test(t, &opt)
})
}
Expand Down Expand Up @@ -2034,7 +2034,7 @@ func removeDir(dir string) {
}

func TestWriteInemory(t *testing.T) {
opt := DefaultOptions("").WithInmemory(true)
opt := DefaultOptions("").WithInMemory(true)
db, err := Open(opt)
require.NoError(t, err)
defer func() {
Expand Down
2 changes: 1 addition & 1 deletion options.go
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ func (opt Options) WithMaxCacheSize(size int64) Options {
//
// When badger is running in InMemory mode, everything is stored in memory. No value/sst files are
// created. In case of a crash all data will be lost.
func (opt Options) WithInmemory(b bool) Options {
func (opt Options) WithInMemory(b bool) Options {
opt.InMemory = b
return opt
}
Expand Down

0 comments on commit ea01d38

Please sign in to comment.