(ctx context.Context, info *ObjectInfo, js *jetStream)
| 977 | } |
| 978 | |
| 979 | func publishMeta(ctx context.Context, info *ObjectInfo, js *jetStream) error { |
| 980 | // marshal the object into json, don't store an actual time |
| 981 | info.ModTime = time.Time{} |
| 982 | data, err := json.Marshal(info) |
| 983 | if err != nil { |
| 984 | return err |
| 985 | } |
| 986 | |
| 987 | // Prepare and publish the message. |
| 988 | mm := nats.NewMsg(fmt.Sprintf(objMetaPreTmpl, info.Bucket, encodeName(info.ObjectMeta.Name))) |
| 989 | mm.Header.Set(MsgRollup, MsgRollupSubject) |
| 990 | mm.Data = data |
| 991 | if _, err := js.PublishMsg(ctx, mm); err != nil { |
| 992 | return err |
| 993 | } |
| 994 | |
| 995 | // set the ModTime in case it's returned to the user, even though it's not the correct time. |
| 996 | info.ModTime = time.Now().UTC() |
| 997 | return nil |
| 998 | } |
| 999 | |
| 1000 | // AddLink will add a link to another object if it's not deleted and not another link |
| 1001 | // name is the name of this link object |
no test coverage detected