Skip to content

Commit e2653f4

Browse files
committed
Revert "Added 2-way proto-thrift mapper (#1130)"
This reverts commit 0fb34ee. Panicking due to null run-id values on children-cancellation, possibly elsewhere. Part of #1149
1 parent a6b3235 commit e2653f4

29 files changed

+3304
-9334
lines changed

internal/compatibility/adapter.go

Lines changed: 74 additions & 264 deletions
Large diffs are not rendered by default.

internal/compatibility/api_test.go

Lines changed: 0 additions & 946 deletions
This file was deleted.

internal/compatibility/enum_test.go

Lines changed: 0 additions & 334 deletions
This file was deleted.

internal/compatibility/thrift/error.go renamed to internal/compatibility/error.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1919
// THE SOFTWARE.
2020

21-
package thrift
21+
package compatibility
2222

2323
import (
2424
"errors"
@@ -30,7 +30,7 @@ import (
3030
"go.uber.org/yarpc/yarpcerrors"
3131
)
3232

33-
func Error(err error) error {
33+
func thriftError(err error) error {
3434
status := yarpcerrors.FromError(err)
3535
if status == nil || status.Code() == yarpcerrors.CodeOK {
3636
return nil
@@ -136,4 +136,4 @@ func getErrorDetails(err error) interface{} {
136136
return details[0]
137137
}
138138
return nil
139-
}
139+
}

internal/compatibility/error_test.go

Lines changed: 0 additions & 64 deletions
This file was deleted.

internal/compatibility/thrift/helpers.go renamed to internal/compatibility/helpers.go

Lines changed: 34 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,23 @@
1818
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1919
// THE SOFTWARE.
2020

21-
package thrift
21+
package compatibility
2222

2323
import (
24-
"time"
25-
2624
gogo "github.com/gogo/protobuf/types"
2725
"go.uber.org/cadence/internal/common"
26+
"time"
2827
)
2928

3029
func boolPtr(b bool) *bool {
3130
return &b
3231
}
3332

34-
func toDoubleValue(v *gogo.DoubleValue) *float64 {
33+
func fromDoubleValue(v *float64) *gogo.DoubleValue {
3534
if v == nil {
3635
return nil
3736
}
38-
return &v.Value
37+
return &gogo.DoubleValue{Value: *v}
3938
}
4039

4140
func toInt64Value(v *gogo.Int64Value) *int64 {
@@ -45,6 +44,17 @@ func toInt64Value(v *gogo.Int64Value) *int64 {
4544
return common.Int64Ptr(v.Value)
4645
}
4746

47+
func unixNanoToTime(t *int64) *gogo.Timestamp {
48+
if t == nil {
49+
return nil
50+
}
51+
time, err := gogo.TimestampProto(time.Unix(0, *t))
52+
if err != nil {
53+
panic(err)
54+
}
55+
return time
56+
}
57+
4858
func timeToUnixNano(t *gogo.Timestamp) *int64 {
4959
if t == nil {
5060
return nil
@@ -56,6 +66,13 @@ func timeToUnixNano(t *gogo.Timestamp) *int64 {
5666
return common.Int64Ptr(timestamp.UnixNano())
5767
}
5868

69+
func daysToDuration(d *int32) *gogo.Duration {
70+
if d == nil {
71+
return nil
72+
}
73+
return gogo.DurationProto(time.Duration(*d) * (24 * time.Hour))
74+
}
75+
5976
func durationToDays(d *gogo.Duration) *int32 {
6077
if d == nil {
6178
return nil
@@ -67,6 +84,13 @@ func durationToDays(d *gogo.Duration) *int32 {
6784
return common.Int32Ptr(int32(duration / (24 * time.Hour)))
6885
}
6986

87+
func secondsToDuration(d *int32) *gogo.Duration {
88+
if d == nil {
89+
return nil
90+
}
91+
return gogo.DurationProto(time.Duration(*d) * time.Second)
92+
}
93+
7094
func durationToSeconds(d *gogo.Duration) *int32 {
7195
if d == nil {
7296
return nil
@@ -85,23 +109,13 @@ func int32To64(v *int32) *int64 {
85109
return common.Int64Ptr(int64(*v))
86110
}
87111

88-
type fieldSet map[string]struct{}
89-
90-
func newFieldSet(mask *gogo.FieldMask) fieldSet {
91-
if mask == nil {
112+
func int64To32(v *int64) *int32 {
113+
if v == nil {
92114
return nil
93115
}
94-
fs := map[string]struct{}{}
95-
for _, field := range mask.Paths {
96-
fs[field] = struct{}{}
97-
}
98-
return fs
116+
return common.Int32Ptr(int32(*v))
99117
}
100118

101-
func (fs fieldSet) isSet(field string) bool {
102-
if fs == nil {
103-
return true
104-
}
105-
_, ok := fs[field]
106-
return ok
119+
func newFieldMask(fields []string) *gogo.FieldMask {
120+
return &gogo.FieldMask{Paths: fields}
107121
}

internal/compatibility/proto/decision.go

Lines changed: 0 additions & 189 deletions
This file was deleted.

0 commit comments

Comments
 (0)