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

Function publishMeta

object.go:734–753  ·  view source on GitHub ↗
(info *ObjectInfo, js JetStreamContext)

Source from the content-addressed store, hash-verified

732}
733
734func publishMeta(info *ObjectInfo, js JetStreamContext) error {
735 // marshal the object into json, don't store an actual time
736 info.ModTime = time.Time{}
737 data, err := json.Marshal(info)
738 if err != nil {
739 return err
740 }
741
742 // Prepare and publish the message.
743 mm := NewMsg(fmt.Sprintf(objMetaPreTmpl, info.Bucket, encodeName(info.ObjectMeta.Name)))
744 mm.Header.Set(MsgRollup, MsgRollupSubject)
745 mm.Data = data
746 if _, err := js.PublishMsg(mm); err != nil {
747 return err
748 }
749
750 // set the ModTime in case it's returned to the user, even though it's not the correct time.
751 info.ModTime = time.Now().UTC()
752 return nil
753}
754
755// AddLink will add a link to another object if it's not deleted and not another link
756// name is the name of this link object

Callers 4

DeleteMethod · 0.70
AddLinkMethod · 0.70
AddBucketLinkMethod · 0.70
UpdateMetaMethod · 0.70

Calls 4

NewMsgFunction · 0.85
encodeNameFunction · 0.70
SetMethod · 0.65
PublishMsgMethod · 0.65

Tested by

no test coverage detected