• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

uber / cadence / 018965f0-fdaa-4535-a39b-924d1b4fe28b

17 Jul 2023 10:20PM UTC coverage: 57.058% (-0.09%) from 57.146%
018965f0-fdaa-4535-a39b-924d1b4fe28b

push

buildkite

web-flow
[dynamic config] add Filters method to dynamic config Key (#5346)

What changed?

Add Filters method to Key interface
Add implementations on most keys by parsing the comments on keys (assuming they are correct)
Why?

This is needed to know what dynamic config is domain specific. And this could possible simplify the collection struct by consolidating all GetPropertyFilterBy** methods.

How did you test it?

Potential risks

no risk since the method will be read only in non-critical path

Release notes

Documentation Changes

21 of 21 new or added lines in 1 file covered. (100.0%)

87154 of 152745 relevant lines covered (57.06%)

2500.48 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

53.06
/common/persistence/serialization/thrift_decoder.go
1
// The MIT License (MIT)
2
//
3
// Copyright (c) 2017-2020 Uber Technologies Inc.
4
//
5
// Permission is hereby granted, free of charge, to any person obtaining a copy
6
// of this software and associated documentation files (the "Software"), to deal
7
// in the Software without restriction, including without limitation the rights
8
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
// copies of the Software, and to permit persons to whom the Software is
10
// furnished to do so, subject to the following conditions:
11
//
12
// The above copyright notice and this permission notice shall be included in all
13
// copies or substantial portions of the Software.
14
//
15
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
// SOFTWARE.
22

23
package serialization
24

25
import (
26
        "bytes"
27

28
        "go.uber.org/thriftrw/protocol/binary"
29

30
        "github.com/uber/cadence/.gen/go/sqlblobs"
31
)
32

33
type (
34
        thriftDecoder struct{}
35
)
36

37
func newThriftDecoder() decoder {
67✔
38
        return &thriftDecoder{}
67✔
39
}
67✔
40

41
func (d *thriftDecoder) shardInfoFromBlob(data []byte) (*ShardInfo, error) {
24✔
42
        result := &sqlblobs.ShardInfo{}
24✔
43
        if err := thriftRWDecode(data, result); err != nil {
24✔
44
                return nil, err
×
45
        }
×
46
        return shardInfoFromThrift(result), nil
24✔
47
}
48

49
func (d *thriftDecoder) domainInfoFromBlob(data []byte) (*DomainInfo, error) {
3,097✔
50
        result := &sqlblobs.DomainInfo{}
3,097✔
51
        if err := thriftRWDecode(data, result); err != nil {
3,097✔
52
                return nil, err
×
53
        }
×
54
        return domainInfoFromThrift(result), nil
3,097✔
55
}
56

57
func (d *thriftDecoder) historyTreeInfoFromBlob(data []byte) (*HistoryTreeInfo, error) {
37✔
58
        result := &sqlblobs.HistoryTreeInfo{}
37✔
59
        if err := thriftRWDecode(data, result); err != nil {
37✔
60
                return nil, err
×
61
        }
×
62
        return historyTreeInfoFromThrift(result), nil
37✔
63
}
64

65
func (d *thriftDecoder) workflowExecutionInfoFromBlob(data []byte) (*WorkflowExecutionInfo, error) {
494✔
66
        result := &sqlblobs.WorkflowExecutionInfo{}
494✔
67
        if err := thriftRWDecode(data, result); err != nil {
494✔
68
                return nil, err
×
69
        }
×
70
        return workflowExecutionInfoFromThrift(result), nil
494✔
71
}
72

73
func (d *thriftDecoder) activityInfoFromBlob(data []byte) (*ActivityInfo, error) {
68✔
74
        result := &sqlblobs.ActivityInfo{}
68✔
75
        if err := thriftRWDecode(data, result); err != nil {
68✔
76
                return nil, err
×
77
        }
×
78
        return activityInfoFromThrift(result), nil
68✔
79
}
80

81
func (d *thriftDecoder) childExecutionInfoFromBlob(data []byte) (*ChildExecutionInfo, error) {
3✔
82
        result := &sqlblobs.ChildExecutionInfo{}
3✔
83
        if err := thriftRWDecode(data, result); err != nil {
3✔
84
                return nil, err
×
85
        }
×
86
        return childExecutionInfoFromThrift(result), nil
3✔
87
}
88

89
func (d *thriftDecoder) signalInfoFromBlob(data []byte) (*SignalInfo, error) {
×
90
        result := &sqlblobs.SignalInfo{}
×
91
        if err := thriftRWDecode(data, result); err != nil {
×
92
                return nil, err
×
93
        }
×
94
        return signalInfoFromThrift(result), nil
×
95
}
96

97
func (d *thriftDecoder) requestCancelInfoFromBlob(data []byte) (*RequestCancelInfo, error) {
×
98
        result := &sqlblobs.RequestCancelInfo{}
×
99
        if err := thriftRWDecode(data, result); err != nil {
×
100
                return nil, err
×
101
        }
×
102
        return requestCancelInfoFromThrift(result), nil
×
103
}
104

105
func (d *thriftDecoder) timerInfoFromBlob(data []byte) (*TimerInfo, error) {
×
106
        result := &sqlblobs.TimerInfo{}
×
107
        if err := thriftRWDecode(data, result); err != nil {
×
108
                return nil, err
×
109
        }
×
110
        return timerInfoFromThrift(result), nil
×
111
}
112

113
func (d *thriftDecoder) taskInfoFromBlob(data []byte) (*TaskInfo, error) {
578✔
114
        result := &sqlblobs.TaskInfo{}
578✔
115
        if err := thriftRWDecode(data, result); err != nil {
578✔
116
                return nil, err
×
117
        }
×
118
        return taskInfoFromThrift(result), nil
578✔
119
}
120

121
func (d *thriftDecoder) taskListInfoFromBlob(data []byte) (*TaskListInfo, error) {
906✔
122
        result := &sqlblobs.TaskListInfo{}
906✔
123
        if err := thriftRWDecode(data, result); err != nil {
906✔
124
                return nil, err
×
125
        }
×
126
        return taskListInfoFromThrift(result), nil
906✔
127
}
128

129
func (d *thriftDecoder) transferTaskInfoFromBlob(data []byte) (*TransferTaskInfo, error) {
3,731✔
130
        result := &sqlblobs.TransferTaskInfo{}
3,731✔
131
        if err := thriftRWDecode(data, result); err != nil {
3,731✔
132
                return nil, err
×
133
        }
×
134
        return transferTaskInfoFromThrift(result), nil
3,731✔
135
}
136

137
func (d *thriftDecoder) crossClusterTaskInfoFromBlob(data []byte) (*CrossClusterTaskInfo, error) {
×
138
        result := &sqlblobsCrossClusterTaskInfo{}
×
139
        if err := thriftRWDecode(data, result); err != nil {
×
140
                return nil, err
×
141
        }
×
142
        return crossClusterTaskInfoFromThrift(result), nil
×
143
}
144

145
func (d *thriftDecoder) timerTaskInfoFromBlob(data []byte) (*TimerTaskInfo, error) {
5,758✔
146
        result := &sqlblobs.TimerTaskInfo{}
5,758✔
147
        if err := thriftRWDecode(data, result); err != nil {
5,758✔
148
                return nil, err
×
149
        }
×
150
        return timerTaskInfoFromThrift(result), nil
5,758✔
151
}
152

153
func (d *thriftDecoder) replicationTaskInfoFromBlob(data []byte) (*ReplicationTaskInfo, error) {
2✔
154
        result := &sqlblobs.ReplicationTaskInfo{}
2✔
155
        if err := thriftRWDecode(data, result); err != nil {
2✔
156
                return nil, err
×
157
        }
×
158
        return replicationTaskInfoFromThrift(result), nil
2✔
159
}
160

161
func thriftRWDecode(b []byte, result thriftRWType) error {
14,685✔
162
        buf := bytes.NewReader(b)
14,685✔
163
        sr := binary.Default.Reader(buf)
14,685✔
164
        return result.Decode(sr)
14,685✔
165
}
14,685✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc