Skip to content

Commit

Permalink
Make file storage the default, implementation for #623
Browse files Browse the repository at this point in the history
Signed-off-by: Derek Collison <derek@nats.io>
  • Loading branch information
derekcollison committed Dec 11, 2020
1 parent b3392c3 commit 94bf95a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
6 changes: 3 additions & 3 deletions js.go
Expand Up @@ -1225,10 +1225,10 @@ func (dp *DiscardPolicy) UnmarshalJSON(data []byte) error {
type StorageType int

const (
// FileStorage specifies on disk storage. It's the default.
FileStorage StorageType = iota
// MemoryStorage specifies in memory only.
MemoryStorage StorageType = iota
// FileStorage specifies on disk, designated by the JetStream config StoreDir.
FileStorage
MemoryStorage
)

const (
Expand Down
7 changes: 6 additions & 1 deletion test/js_test.go
Expand Up @@ -97,13 +97,18 @@ func TestJetStreamPublish(t *testing.T) {
}

// Create the stream using our client API.
_, err = js.AddStream(&nats.StreamConfig{
si, err := js.AddStream(&nats.StreamConfig{
Name: "TEST",
Subjects: []string{"test", "foo", "bar"},
})
if err != nil {
t.Fatalf("Unexpected error: %v", err)
}
// Double check that file-based storage is default.
if si.Config.Storage != nats.FileStorage {
t.Fatalf("Expected FileStorage as default, got %v", si.Config.Storage)
}

// Lookup the stream for testing.
mset, err := s.GlobalAccount().LookupStream("TEST")
if err != nil {
Expand Down

0 comments on commit 94bf95a

Please sign in to comment.