Skip to content

Commit

Permalink
Revert "Added 2-way proto-thrift mapper (#1130)"
Browse files Browse the repository at this point in the history
This reverts commit 0fb34ee.

Panicking due to null run-id values on children-cancellation, possibly elsewhere.

Part of #1149
  • Loading branch information
Groxx committed Nov 9, 2021
1 parent a6b3235 commit e2653f4
Show file tree
Hide file tree
Showing 29 changed files with 3,304 additions and 9,334 deletions.
338 changes: 74 additions & 264 deletions internal/compatibility/adapter.go

Large diffs are not rendered by default.

946 changes: 0 additions & 946 deletions internal/compatibility/api_test.go

This file was deleted.

334 changes: 0 additions & 334 deletions internal/compatibility/enum_test.go

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

package thrift
package compatibility

import (
"errors"
Expand All @@ -30,7 +30,7 @@ import (
"go.uber.org/yarpc/yarpcerrors"
)

func Error(err error) error {
func thriftError(err error) error {
status := yarpcerrors.FromError(err)
if status == nil || status.Code() == yarpcerrors.CodeOK {
return nil
Expand Down Expand Up @@ -136,4 +136,4 @@ func getErrorDetails(err error) interface{} {
return details[0]
}
return nil
}
}
64 changes: 0 additions & 64 deletions internal/compatibility/error_test.go

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,23 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

package thrift
package compatibility

import (
"time"

gogo "github.com/gogo/protobuf/types"
"go.uber.org/cadence/internal/common"
"time"
)

func boolPtr(b bool) *bool {
return &b
}

func toDoubleValue(v *gogo.DoubleValue) *float64 {
func fromDoubleValue(v *float64) *gogo.DoubleValue {
if v == nil {
return nil
}
return &v.Value
return &gogo.DoubleValue{Value: *v}
}

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

func unixNanoToTime(t *int64) *gogo.Timestamp {
if t == nil {
return nil
}
time, err := gogo.TimestampProto(time.Unix(0, *t))
if err != nil {
panic(err)
}
return time
}

func timeToUnixNano(t *gogo.Timestamp) *int64 {
if t == nil {
return nil
Expand All @@ -56,6 +66,13 @@ func timeToUnixNano(t *gogo.Timestamp) *int64 {
return common.Int64Ptr(timestamp.UnixNano())
}

func daysToDuration(d *int32) *gogo.Duration {
if d == nil {
return nil
}
return gogo.DurationProto(time.Duration(*d) * (24 * time.Hour))
}

func durationToDays(d *gogo.Duration) *int32 {
if d == nil {
return nil
Expand All @@ -67,6 +84,13 @@ func durationToDays(d *gogo.Duration) *int32 {
return common.Int32Ptr(int32(duration / (24 * time.Hour)))
}

func secondsToDuration(d *int32) *gogo.Duration {
if d == nil {
return nil
}
return gogo.DurationProto(time.Duration(*d) * time.Second)
}

func durationToSeconds(d *gogo.Duration) *int32 {
if d == nil {
return nil
Expand All @@ -85,23 +109,13 @@ func int32To64(v *int32) *int64 {
return common.Int64Ptr(int64(*v))
}

type fieldSet map[string]struct{}

func newFieldSet(mask *gogo.FieldMask) fieldSet {
if mask == nil {
func int64To32(v *int64) *int32 {
if v == nil {
return nil
}
fs := map[string]struct{}{}
for _, field := range mask.Paths {
fs[field] = struct{}{}
}
return fs
return common.Int32Ptr(int32(*v))
}

func (fs fieldSet) isSet(field string) bool {
if fs == nil {
return true
}
_, ok := fs[field]
return ok
func newFieldMask(fields []string) *gogo.FieldMask {
return &gogo.FieldMask{Paths: fields}
}
189 changes: 0 additions & 189 deletions internal/compatibility/proto/decision.go

This file was deleted.

Loading

0 comments on commit e2653f4

Please sign in to comment.