(r v1.Report)
| 223 | } |
| 224 | |
| 225 | func (s *sync) Report(r v1.Report) (v1.Desire, error) { |
| 226 | msg := &v1.Message{ |
| 227 | Kind: v1.MessageReport, |
| 228 | Metadata: map[string]string{"source": os.Getenv(context.KeySvcName)}, |
| 229 | Content: v1.LazyValue{Value: r}, |
| 230 | } |
| 231 | res, err := s.link.Request(msg) |
| 232 | if err != nil { |
| 233 | return nil, errors.Trace(err) |
| 234 | } |
| 235 | s.log.Debug("sync reports cloud shadow", log.Any("report", msg)) |
| 236 | var desire v1.Desire |
| 237 | err = res.Content.Unmarshal(&desire) |
| 238 | if err != nil { |
| 239 | return nil, errors.Trace(err) |
| 240 | } |
| 241 | return desire, nil |
| 242 | } |
| 243 | |
| 244 | func (s *sync) reporting() error { |
| 245 | s.log.Info("sync starts to report") |
no test coverage detected