MCPcopy Create free account
hub / github.com/cortexproject/cortex / runPRW2HandleFromPool

Function runPRW2HandleFromPool

pkg/util/push/push_test.go:238–247  ·  view source on GitHub ↗

runPRW2HandleFromPool simulates handlePRW2 using the sync.Pool

(ctx context.Context, body []byte, contentLength int, overrides *validation.Overrides, userID string)

Source from the content-addressed store, hash-verified

236
237// runPRW2HandleFromPool simulates handlePRW2 using the sync.Pool
238func runPRW2HandleFromPool(ctx context.Context, body []byte, contentLength int, overrides *validation.Overrides, userID string) error {
239 req := cortexpb.PreallocWriteRequestV2FromPool()
240 defer cortexpb.ReuseWriteRequestV2(req)
241
242 if err := util.ParseProtoReader(ctx, bytes.NewReader(body), contentLength, benchMaxRecvMsgSize, req, util.RawSnappy); err != nil {
243 return err
244 }
245 _, err := convertV2RequestToV1(req, overrides.EnableTypeAndUnitLabels(userID))
246 return err
247}
248
249// runPRW2HandleFromScratch simulates handlePRW2 without using the sync.Pool.
250func runPRW2HandleFromScratch(ctx context.Context, body []byte, contentLength int, overrides *validation.Overrides, userID string) error {

Callers 1

Calls 5

ReuseWriteRequestV2Function · 0.92
ParseProtoReaderFunction · 0.92
convertV2RequestToV1Function · 0.85

Tested by

no test coverage detected