MCPcopy Create free account
hub / github.com/PerpetualSoftware/pad / encodeFrame

Function encodeFrame

internal/materialize/supervisor.go:1028–1039  ·  view source on GitHub ↗
(req WorkerRequest)

Source from the content-addressed store, hash-verified

1026}
1027
1028func encodeFrame(req WorkerRequest) ([]byte, error) {
1029 body, err := json.Marshal(req)
1030 if err != nil {
1031 return nil, fmt.Errorf("materialize: encode request: %w", err)
1032 }
1033 if len(body) > MaxFrameBytes {
1034 return nil, fmt.Errorf("%w: %d bytes", ErrJobTooLarge, len(body))
1035 }
1036 out := make([]byte, 4, 4+len(body))
1037 binary.BigEndian.PutUint32(out, uint32(len(body)))
1038 return append(out, body...), nil
1039}
1040
1041// ---------------------------------------------------------------------------
1042// the child's stderr

Callers 2

spawnMethod · 0.85
runMethod · 0.85

Calls 2

appendFunction · 0.85
makeFunction · 0.50

Tested by

no test coverage detected