MCPcopy Create free account
hub / github.com/temporalio/temporal / Encode

Method Encode

tools/tdbg/task_encoder.go:89–103  ·  view source on GitHub ↗

Encode a blob for a given task category to a human-readable format by deserializing the blob into a proto message and then pretty-printing it using protojson.

(writer io.Writer, categoryID int, blob *commonpb.DataBlob)

Source from the content-addressed store, hash-verified

87// Encode a blob for a given task category to a human-readable format by deserializing the blob into a proto message and
88// then pretty-printing it using protojson.
89func (e *ProtoTaskBlobEncoder) Encode(writer io.Writer, categoryID int, blob *commonpb.DataBlob) error {
90 message, err := e.deserializer.Deserialize(categoryID, blob)
91 if err != nil {
92 return fmt.Errorf("failed to deserialize task blob: %w", err)
93 }
94 bs, err := jsonpbMarshaler.Marshal(message)
95 if err != nil {
96 return fmt.Errorf("failed to marshal task blob: %w", err)
97 }
98 _, err = writer.Write(bs)
99 if err != nil {
100 return fmt.Errorf("failed to write marshalled task blob: %w", err)
101 }
102 return nil
103}
104
105// Encode the task by calling the function.
106func (e TaskBlobEncoderFn) Encode(writer io.Writer, taskCategoryID int, blob *commonpb.DataBlob) error {

Calls 4

DeserializeMethod · 0.65
MarshalMethod · 0.65
WriteMethod · 0.65
ErrorfMethod · 0.45