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

Method CreateObjectStore

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

Source from the content-addressed store, hash-verified

489)
490
491func (js *jetStream) CreateObjectStore(ctx context.Context, cfg ObjectStoreConfig) (ObjectStore, error) {
492 scfg, err := js.prepareObjectStoreConfig(cfg)
493 if err != nil {
494 return nil, err
495 }
496
497 stream, err := js.CreateStream(ctx, scfg)
498 if err != nil {
499 if errors.Is(err, ErrStreamNameAlreadyInUse) {
500 // errors are joined so that backwards compatibility is retained
501 // and previous checks for ErrStreamNameAlreadyInUse will still work.
502 err = errors.Join(fmt.Errorf("%w: %s", ErrBucketExists, cfg.Bucket), err)
503 }
504 return nil, err
505 }
506 pushJS, err := js.legacyJetStream()
507 if err != nil {
508 return nil, err
509 }
510
511 return mapStreamToObjectStore(js, pushJS, cfg.Bucket, stream), nil
512}
513
514func (js *jetStream) UpdateObjectStore(ctx context.Context, cfg ObjectStoreConfig) (ObjectStore, error) {
515 scfg, err := js.prepareObjectStoreConfig(cfg)

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected