ReportSampleMsgWithContext is the proxy function for the method defined in the tars file, with the context
(tarsCtx context.Context, msg []StatSampleMsg, opts ...map[string]string)
| 211 | |
| 212 | // ReportSampleMsgWithContext is the proxy function for the method defined in the tars file, with the context |
| 213 | func (obj *StatF) ReportSampleMsgWithContext(tarsCtx context.Context, msg []StatSampleMsg, opts ...map[string]string) (ret int32, err error) { |
| 214 | var ( |
| 215 | length int32 |
| 216 | have bool |
| 217 | ty byte |
| 218 | ) |
| 219 | buf := codec.NewBuffer() |
| 220 | err = buf.WriteHead(codec.LIST, 1) |
| 221 | if err != nil { |
| 222 | return ret, err |
| 223 | } |
| 224 | err = buf.WriteInt32(int32(len(msg)), 0) |
| 225 | if err != nil { |
| 226 | return ret, err |
| 227 | } |
| 228 | for _, v := range msg { |
| 229 | err = v.WriteBlock(buf, 0) |
| 230 | if err != nil { |
| 231 | return ret, err |
| 232 | } |
| 233 | } |
| 234 | |
| 235 | var statusMap map[string]string |
| 236 | var contextMap map[string]string |
| 237 | if len(opts) == 1 { |
| 238 | contextMap = opts[0] |
| 239 | } else if len(opts) == 2 { |
| 240 | contextMap = opts[0] |
| 241 | statusMap = opts[1] |
| 242 | } |
| 243 | |
| 244 | tarsResp := new(requestf.ResponsePacket) |
| 245 | err = obj.servant.TarsInvoke(tarsCtx, 0, "reportSampleMsg", buf.ToBytes(), statusMap, contextMap, tarsResp) |
| 246 | if err != nil { |
| 247 | return ret, err |
| 248 | } |
| 249 | readBuf := codec.NewReader(tools.Int8ToByte(tarsResp.SBuffer)) |
| 250 | err = readBuf.ReadInt32(&ret, 0, true) |
| 251 | if err != nil { |
| 252 | return ret, err |
| 253 | } |
| 254 | |
| 255 | if len(opts) == 1 { |
| 256 | for k := range contextMap { |
| 257 | delete(contextMap, k) |
| 258 | } |
| 259 | for k, v := range tarsResp.Context { |
| 260 | contextMap[k] = v |
| 261 | } |
| 262 | } else if len(opts) == 2 { |
| 263 | for k := range contextMap { |
| 264 | delete(contextMap, k) |
| 265 | } |
| 266 | for k, v := range tarsResp.Context { |
| 267 | contextMap[k] = v |
| 268 | } |
| 269 | for k := range statusMap { |
| 270 | delete(statusMap, k) |
no test coverage detected