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

Method UpdateObjectStore

jetstream/object.go:514–534  ·  view source on GitHub ↗
(ctx context.Context, cfg ObjectStoreConfig)

Source from the content-addressed store, hash-verified

512}
513
514func (js *jetStream) UpdateObjectStore(ctx context.Context, cfg ObjectStoreConfig) (ObjectStore, error) {
515 scfg, err := js.prepareObjectStoreConfig(cfg)
516 if err != nil {
517 return nil, err
518 }
519
520 // Attempt to update the stream.
521 stream, err := js.UpdateStream(ctx, scfg)
522 if err != nil {
523 if errors.Is(err, ErrStreamNotFound) {
524 return nil, fmt.Errorf("%w: %s", ErrBucketNotFound, cfg.Bucket)
525 }
526 return nil, err
527 }
528 pushJS, err := js.legacyJetStream()
529 if err != nil {
530 return nil, err
531 }
532
533 return mapStreamToObjectStore(js, pushJS, cfg.Bucket, stream), nil
534}
535
536func (js *jetStream) CreateOrUpdateObjectStore(ctx context.Context, cfg ObjectStoreConfig) (ObjectStore, error) {
537 scfg, err := js.prepareObjectStoreConfig(cfg)

Callers

nothing calls this directly

Calls 6

UpdateStreamMethod · 0.95
legacyJetStreamMethod · 0.95
mapStreamToObjectStoreFunction · 0.85
ErrorfMethod · 0.80
IsMethod · 0.45

Tested by

no test coverage detected