MCPcopy
hub / github.com/nats-io/nats.go / DeleteKeyValue

Method DeleteKeyValue

jetstream/kv.go:731–743  ·  view source on GitHub ↗

DeleteKeyValue will delete this KeyValue store (JetStream stream).

(ctx context.Context, bucket string)

Source from the content-addressed store, hash-verified

729
730// DeleteKeyValue will delete this KeyValue store (JetStream stream).
731func (js *jetStream) DeleteKeyValue(ctx context.Context, bucket string) error {
732 if !bucketValid(bucket) {
733 return ErrInvalidBucketName
734 }
735 stream := fmt.Sprintf(kvBucketNameTmpl, bucket)
736 if err := js.DeleteStream(ctx, stream); err != nil {
737 if errors.Is(err, ErrStreamNotFound) {
738 err = errors.Join(fmt.Errorf("%w: %s", ErrBucketNotFound, bucket), err)
739 }
740 return err
741 }
742 return nil
743}
744
745// KeyValueStoreNames is used to retrieve a list of key value store names
746func (js *jetStream) KeyValueStoreNames(ctx context.Context) KeyValueNamesLister {

Callers

nothing calls this directly

Calls 4

DeleteStreamMethod · 0.95
ErrorfMethod · 0.80
bucketValidFunction · 0.70
IsMethod · 0.45

Tested by

no test coverage detected