Skip to content

Commit

Permalink
Rename SetMemoryStorage to ConsumerMemoryStorage
Browse files Browse the repository at this point in the history
  • Loading branch information
Deepak committed Sep 15, 2022
1 parent 8f89f51 commit b64c208
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion example_test.go
Expand Up @@ -634,7 +634,7 @@ func ExampleSubOpt() {
// Force memory storage while subscribing.
js.Subscribe("foo", func(msg *nats.Msg) {
fmt.Printf("Received a message: %s\n", string(msg.Data))
}, nats.Durable("FOO"), nats.SetMemoryStorage())
}, nats.Durable("FOO"), nats.ConsumerMemoryStorage())
}

func ExampleMaxWait() {
Expand Down
4 changes: 2 additions & 2 deletions js.go
Expand Up @@ -2488,8 +2488,8 @@ func ConsumerReplicas(replicas int) SubOpt {
})
}

// SetMemoryStorage sets the memory storage to true for a consumer.
func SetMemoryStorage() SubOpt {
// ConsumerMemoryStorage sets the memory storage to true for a consumer.
func ConsumerMemoryStorage() SubOpt {
return subOptFn(func(opts *subOpts) error {
opts.cfg.MemoryStorage = true
return nil
Expand Down
8 changes: 4 additions & 4 deletions js_test.go
Expand Up @@ -1097,7 +1097,7 @@ func TestJetStreamConvertDirectMsgResponseToMsg(t *testing.T) {
}
}

func TestJetStreamSetMemoryStorage(t *testing.T) {
func TestJetStreamConsumerMemoryStorage(t *testing.T) {
opts := natsserver.DefaultTestOptions
opts.Port = -1
opts.JetStream = true
Expand All @@ -1112,7 +1112,7 @@ func TestJetStreamSetMemoryStorage(t *testing.T) {
}

// Pull ephemeral consumer with memory storage.
sub, err := js.PullSubscribe("foo", "", SetMemoryStorage())
sub, err := js.PullSubscribe("foo", "", ConsumerMemoryStorage())
if err != nil {
t.Fatalf("Error on subscribe: %v", err)
}
Expand All @@ -1127,7 +1127,7 @@ func TestJetStreamSetMemoryStorage(t *testing.T) {
}

// Create a sync subscription with an in-memory ephemeral consumer.
sub, err = js.SubscribeSync("foo", SetMemoryStorage())
sub, err = js.SubscribeSync("foo", ConsumerMemoryStorage())
if err != nil {
t.Fatalf("Error on subscribe: %v", err)
}
Expand All @@ -1143,7 +1143,7 @@ func TestJetStreamSetMemoryStorage(t *testing.T) {

// Async subscription with an in-memory ephemeral consumer.
cb := func(msg *Msg) {}
sub, err = js.Subscribe("foo", cb, SetMemoryStorage())
sub, err = js.Subscribe("foo", cb, ConsumerMemoryStorage())
if err != nil {
t.Fatalf("Error on subscribe: %v", err)
}
Expand Down

0 comments on commit b64c208

Please sign in to comment.