go.temporal.io/server/common/tasktoken/serializer.go

58 LOC · 24 covered · 34 uncovered · 8 ranges · 2635 concepts · 5 introducers · 1229 tests

File neighbourhood

The centred file is linked to every concept that introduces one of its ranges, every test that runs code from the file, and the gray connector concepts standing between those tests and the file's own introducer concepts. Undirected links join concepts to every file where they introduce source and concepts to the tests they introduce; arrows show specialization between the displayed concepts and bridge only concepts omitted from this view. Concept colors match the source ranges below; connector concepts have no source color and are shown in gray.

Focused file, its introducer and connector concepts, their introduced files, and tests that run code from the file

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the related-file, concept, and source links on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the related-file, concept, and source links on this page while the interactive map is unavailable.

1 package tasktoken
2
3 import (
4 persistencespb "go.temporal.io/server/api/persistence/v1"
5 tokenspb "go.temporal.io/server/api/token/v1"
6 )
7
8 type Serializer struct{}
9
10 // NewSerializer creates a new instance of Serializer
11 > func NewSerializer() *Serializer { serializer.go ×1
12 > return &Serializer{}
13 > }
14
15 > func (s *Serializer) Serialize(taskToken *tokenspb.Task) ([]byte, error) { serializer.go ×2
16 > if taskToken == nil {
17 return nil, nil
18 }
19 > return taskToken.Marshal() serializer.go ×2
20 }
21
22 > func (s *Serializer) Deserialize(data []byte) (*tokenspb.Task, error) { message.go-helpers.pb.go ×1
23 > taskToken := &tokenspb.Task{}
24 > err := taskToken.Unmarshal(data)
25 > return taskToken, err
26 > }
27
28 func (s *Serializer) SerializeQueryTaskToken(taskToken *tokenspb.QueryTask) ([]byte, error) {
29 if taskToken == nil {
30 return nil, nil
31 }
32 return taskToken.Marshal()
33 }
34
35 > func (s *Serializer) DeserializeQueryTaskToken(data []byte) (*tokenspb.QueryTask, error) { namespace_validator.go ×4
36 > taskToken := tokenspb.QueryTask{}
37 > err := taskToken.Unmarshal(data)
38 > return &taskToken, err
39 > }
40
41 > func (s *Serializer) SerializeNexusTaskToken(taskToken *tokenspb.NexusTask) ([]byte, error) { message.pb.go ×3
42 > if taskToken == nil {
43 return nil, nil
44 }
45 > return taskToken.Marshal() message.pb.go ×3
46 }
47
48 > func (s *Serializer) DeserializeNexusTaskToken(data []byte) (*tokenspb.NexusTask, error) { message.pb.go ×3
49 > taskToken := tokenspb.NexusTask{}
50 > err := taskToken.Unmarshal(data)
51 > return &taskToken, err
52 > }
53
54 func (s *Serializer) DeserializeChasmComponentRef(data []byte) (*persistencespb.ChasmComponentRef, error) {
55 token := persistencespb.ChasmComponentRef{}
56 err := token.Unmarshal(data)
57 return &token, err
58 }