Skip to content

Commit

Permalink
Adopt proto files changes (#159)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexshtin committed Jun 12, 2020
1 parent 5165b45 commit 4b1863d
Show file tree
Hide file tree
Showing 55 changed files with 923 additions and 916 deletions.
11 changes: 5 additions & 6 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,9 @@ package client
import (
"context"

commonpb "go.temporal.io/temporal-proto/common"
filterpb "go.temporal.io/temporal-proto/filter"
tasklistpb "go.temporal.io/temporal-proto/tasklist"
"go.temporal.io/temporal-proto/workflowservice"
commonpb "go.temporal.io/temporal-proto/common/v1"
enumspb "go.temporal.io/temporal-proto/enums/v1"
"go.temporal.io/temporal-proto/workflowservice/v1"

"go.temporal.io/temporal/encoded"
"go.temporal.io/temporal/internal"
Expand Down Expand Up @@ -193,7 +192,7 @@ type (
// }
// events = append(events, event)
// }
GetWorkflowHistory(ctx context.Context, workflowID string, runID string, isLongPoll bool, filterType filterpb.HistoryEventFilterType) HistoryEventIterator
GetWorkflowHistory(ctx context.Context, workflowID string, runID string, isLongPoll bool, filterType enumspb.HistoryEventFilterType) HistoryEventIterator

// CompleteActivity reports activity completed.
// activity Execute method can return activity.ErrResultPending to
Expand Down Expand Up @@ -350,7 +349,7 @@ type (
// - BadRequestError
// - InternalServiceError
// - EntityNotExistError
DescribeTaskList(ctx context.Context, tasklist string, tasklistType tasklistpb.TaskListType) (*workflowservice.DescribeTaskListResponse, error)
DescribeTaskList(ctx context.Context, tasklist string, tasklistType enumspb.TaskListType) (*workflowservice.DescribeTaskListResponse, error)

// Close client and clean up underlying resources.
Close()
Expand Down
4 changes: 2 additions & 2 deletions error.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ package temporal
import (
"errors"

commonpb "go.temporal.io/temporal-proto/common"
enumspb "go.temporal.io/temporal-proto/enums/v1"
"go.temporal.io/temporal-proto/serviceerror"

"go.temporal.io/temporal/internal"
Expand Down Expand Up @@ -212,7 +212,7 @@ func IsPanicError(err error) bool {
// Use NewHeartbeatTimeoutError to create heartbeat TimeoutError
// WARNING: This function is public only to support unit testing of workflows.
// It shouldn't be used by application level code.
func NewTimeoutError(timeoutType commonpb.TimeoutType, lastErr error, details ...interface{}) *TimeoutError {
func NewTimeoutError(timeoutType enumspb.TimeoutType, lastErr error, details ...interface{}) *TimeoutError {
return internal.NewTimeoutError(timeoutType, lastErr, details...)
}

Expand Down
35 changes: 18 additions & 17 deletions evictiontest/workflow_cache_eviction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,12 @@ import (
"github.com/golang/mock/gomock"
log "github.com/sirupsen/logrus"
"github.com/stretchr/testify/suite"
commonpb "go.temporal.io/temporal-proto/common"
eventpb "go.temporal.io/temporal-proto/event"
tasklistpb "go.temporal.io/temporal-proto/tasklist"
"go.temporal.io/temporal-proto/workflowservice"
"go.temporal.io/temporal-proto/workflowservicemock"
commonpb "go.temporal.io/temporal-proto/common/v1"
enumspb "go.temporal.io/temporal-proto/enums/v1"
historypb "go.temporal.io/temporal-proto/history/v1"
tasklistpb "go.temporal.io/temporal-proto/tasklist/v1"
"go.temporal.io/temporal-proto/workflowservice/v1"
"go.temporal.io/temporal-proto/workflowservicemock/v1"
"go.uber.org/atomic"
"google.golang.org/grpc"

Expand Down Expand Up @@ -92,26 +93,26 @@ func TestWorkersTestSuite(t *testing.T) {
suite.Run(t, new(CacheEvictionSuite))
}

func createTestEventWorkflowExecutionStarted(eventID int64, attr *eventpb.WorkflowExecutionStartedEventAttributes) *eventpb.HistoryEvent {
return &eventpb.HistoryEvent{
func createTestEventWorkflowExecutionStarted(eventID int64, attr *historypb.WorkflowExecutionStartedEventAttributes) *historypb.HistoryEvent {
return &historypb.HistoryEvent{
EventId: eventID,
EventType: eventpb.EVENT_TYPE_WORKFLOW_EXECUTION_STARTED,
Attributes: &eventpb.HistoryEvent_WorkflowExecutionStartedEventAttributes{WorkflowExecutionStartedEventAttributes: attr}}
EventType: enumspb.EVENT_TYPE_WORKFLOW_EXECUTION_STARTED,
Attributes: &historypb.HistoryEvent_WorkflowExecutionStartedEventAttributes{WorkflowExecutionStartedEventAttributes: attr}}
}

func createTestEventDecisionTaskScheduled(eventID int64, attr *eventpb.DecisionTaskScheduledEventAttributes) *eventpb.HistoryEvent {
return &eventpb.HistoryEvent{
func createTestEventDecisionTaskScheduled(eventID int64, attr *historypb.DecisionTaskScheduledEventAttributes) *historypb.HistoryEvent {
return &historypb.HistoryEvent{
EventId: eventID,
EventType: eventpb.EVENT_TYPE_DECISION_TASK_SCHEDULED,
Attributes: &eventpb.HistoryEvent_DecisionTaskScheduledEventAttributes{DecisionTaskScheduledEventAttributes: attr}}
EventType: enumspb.EVENT_TYPE_DECISION_TASK_SCHEDULED,
Attributes: &historypb.HistoryEvent_DecisionTaskScheduledEventAttributes{DecisionTaskScheduledEventAttributes: attr}}
}

func (s *CacheEvictionSuite) TestResetStickyOnEviction() {
testEvents := []*eventpb.HistoryEvent{
createTestEventWorkflowExecutionStarted(1, &eventpb.WorkflowExecutionStartedEventAttributes{
testEvents := []*historypb.HistoryEvent{
createTestEventWorkflowExecutionStarted(1, &historypb.WorkflowExecutionStartedEventAttributes{
TaskList: &tasklistpb.TaskList{Name: "tasklist"},
}),
createTestEventDecisionTaskScheduled(2, &eventpb.DecisionTaskScheduledEventAttributes{}),
createTestEventDecisionTaskScheduled(2, &historypb.DecisionTaskScheduledEventAttributes{}),
}

var taskCounter atomic.Int32 // lambda variable to keep count
Expand All @@ -129,7 +130,7 @@ func (s *CacheEvictionSuite) TestResetStickyOnEviction() {
TaskToken: make([]byte, 5),
WorkflowExecution: &commonpb.WorkflowExecution{WorkflowId: workflowID, RunId: runID},
WorkflowType: &commonpb.WorkflowType{Name: "testReplayWorkflow"},
History: &eventpb.History{Events: testEvents},
History: &historypb.History{Events: testEvents},
PreviousStartedEventId: 5}
return ret, nil
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ require (
github.com/uber-go/tally v3.3.17+incompatible
github.com/uber/jaeger-client-go v2.23.1+incompatible
github.com/uber/jaeger-lib v2.2.0+incompatible // indirect
go.temporal.io/temporal-proto v0.24.0
go.temporal.io/temporal-proto v0.24.2
go.uber.org/atomic v1.6.0
go.uber.org/goleak v1.0.0
go.uber.org/zap v1.15.0
Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ github.com/uber/jaeger-client-go v2.23.1+incompatible/go.mod h1:WVhlPFC8FDjOFMMW
github.com/uber/jaeger-lib v2.2.0+incompatible h1:MxZXOiR2JuoANZ3J6DE/U0kSFv/eJ/GfSYVCjK7dyaw=
github.com/uber/jaeger-lib v2.2.0+incompatible/go.mod h1:ComeNDZlWwrWnDv8aPp0Ba6+uUTzImX/AauajbLI56U=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
go.temporal.io/temporal-proto v0.24.0 h1:4fHSBv4PIJuRJAU6l5ANrp9tOvXVB1c1mfShKYbpzlI=
go.temporal.io/temporal-proto v0.24.0/go.mod h1:lFt53MEhtjHIJtgg1U1Fdx3e3HoBOZcZKEbElzYz5Ro=
go.temporal.io/temporal-proto v0.24.2 h1:XZRX9+kB63jn6crfst2Sth3r8scabEqoXksUQu3q91k=
go.temporal.io/temporal-proto v0.24.2/go.mod h1:upayz+pnLT5z2lzh/qktmSnouTTl+WYcjbMoejagmzU=
go.uber.org/atomic v1.6.0 h1:Ezj3JGmsOnG1MoRWQkPBsKLe9DwWD9QeXzTRzzldNVk=
go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
go.uber.org/goleak v1.0.0 h1:qsup4IcBdlmsnGfqyLl4Ntn3C2XCCuKAE7DwHpScyUo=
Expand Down Expand Up @@ -148,8 +148,8 @@ golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd h1:xhmwyvizuTgC2qz7ZlMluP20uW+C3Rm0FD/WLDX8884=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200602225109-6fdc65e7d980 h1:OjiUf46hAmXblsZdnoSXsEUSKU8r1UEzcL5RVZ4gO9Y=
golang.org/x/sys v0.0.0-20200602225109-6fdc65e7d980/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200610111108-226ff32320da h1:bGb80FudwxpeucJUjPYJXuJ8Hk91vNtfvrymzwiei38=
golang.org/x/sys v0.0.0-20200610111108-226ff32320da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand Down Expand Up @@ -184,8 +184,8 @@ google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoA
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 h1:gSJIx1SDwno+2ElGhA4+qG2zF97qiUzTM+rQ0klBOcE=
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
google.golang.org/genproto v0.0.0-20200608115520-7c474a2e3482 h1:i+Aiej6cta/Frzp13/swvwz5O00kYcSe0A/C5Wd7zX8=
google.golang.org/genproto v0.0.0-20200608115520-7c474a2e3482/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA=
google.golang.org/genproto v0.0.0-20200612171551-7676ae05be11 h1:II66Di7x1uAfKBfe3OchemS7pUg9ahSr7qAP3bD0+Mo=
google.golang.org/genproto v0.0.0-20200612171551-7676ae05be11/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA=
google.golang.org/grpc v1.12.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
Expand Down
4 changes: 2 additions & 2 deletions internal/activity.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ import (

"github.com/opentracing/opentracing-go"
"github.com/uber-go/tally"
commonpb "go.temporal.io/temporal-proto/common"
commonpb "go.temporal.io/temporal-proto/common/v1"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"

"go.temporal.io/temporal-proto/workflowservice"
"go.temporal.io/temporal-proto/workflowservice/v1"
)

type (
Expand Down
4 changes: 2 additions & 2 deletions internal/activity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ import (
"go.temporal.io/temporal-proto/serviceerror"
"google.golang.org/grpc"

"go.temporal.io/temporal-proto/workflowservice"
"go.temporal.io/temporal-proto/workflowservicemock"
"go.temporal.io/temporal-proto/workflowservice/v1"
"go.temporal.io/temporal-proto/workflowservicemock/v1"
)

type activityTestSuite struct {
Expand Down
29 changes: 14 additions & 15 deletions internal/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@ import (

"github.com/opentracing/opentracing-go"
"github.com/uber-go/tally"
commonpb "go.temporal.io/temporal-proto/common"
filterpb "go.temporal.io/temporal-proto/filter"
tasklistpb "go.temporal.io/temporal-proto/tasklist"
"go.temporal.io/temporal-proto/workflowservice"
commonpb "go.temporal.io/temporal-proto/common/v1"
enumspb "go.temporal.io/temporal-proto/enums/v1"
"go.temporal.io/temporal-proto/workflowservice/v1"
"go.uber.org/zap"
"google.golang.org/grpc"

Expand Down Expand Up @@ -162,7 +161,7 @@ type (
// }
// events = append(events, event)
// }
GetWorkflowHistory(ctx context.Context, workflowID string, runID string, isLongPoll bool, filterType filterpb.HistoryEventFilterType) HistoryEventIterator
GetWorkflowHistory(ctx context.Context, workflowID string, runID string, isLongPoll bool, filterType enumspb.HistoryEventFilterType) HistoryEventIterator

// CompleteActivity reports activity completed.
// activity Execute method can return acitivity.activity.ErrResultPending to
Expand All @@ -179,7 +178,7 @@ type (
// The activity can fail with below errors ErrorWithDetails, TimeoutError, CanceledError.
CompleteActivity(ctx context.Context, taskToken []byte, result interface{}, err error) error

// CompleteActivityById reports activity completed.
// CompleteActivityByID reports activity completed.
// Similar to CompleteActivity, but may save user from keeping taskToken info.
// activity Execute method can return activity.ErrResultPending to
// indicate the activity is not completed when it's Execute method returns. In that case, this CompleteActivityById() method
Expand Down Expand Up @@ -310,7 +309,7 @@ type (
// - BadRequestError
// - InternalServiceError
// - EntityNotExistError
DescribeTaskList(ctx context.Context, tasklist string, tasklistType tasklistpb.TaskListType) (*workflowservice.DescribeTaskListResponse, error)
DescribeTaskList(ctx context.Context, tasklist string, tasklistType enumspb.TaskListType) (*workflowservice.DescribeTaskListResponse, error)

// Close client and clean up underlying resources.
Close()
Expand Down Expand Up @@ -640,27 +639,27 @@ func newNamespaceServiceClient(workflowServiceClient workflowservice.WorkflowSer
}
}

func (p WorkflowIDReusePolicy) toProto() commonpb.WorkflowIdReusePolicy {
func (p WorkflowIDReusePolicy) toProto() enumspb.WorkflowIdReusePolicy {
switch p {
case WorkflowIDReusePolicyAllowDuplicate:
return commonpb.WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE
return enumspb.WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE
case WorkflowIDReusePolicyAllowDuplicateFailedOnly:
return commonpb.WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE_FAILED_ONLY
return enumspb.WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE_FAILED_ONLY
case WorkflowIDReusePolicyRejectDuplicate:
return commonpb.WORKFLOW_ID_REUSE_POLICY_REJECT_DUPLICATE
return enumspb.WORKFLOW_ID_REUSE_POLICY_REJECT_DUPLICATE
default:
panic(fmt.Sprintf("unknown workflow reuse policy %v", p))
}
}

func (p ParentClosePolicy) toProto() commonpb.ParentClosePolicy {
func (p ParentClosePolicy) toProto() enumspb.ParentClosePolicy {
switch p {
case ParentClosePolicyAbandon:
return commonpb.PARENT_CLOSE_POLICY_ABANDON
return enumspb.PARENT_CLOSE_POLICY_ABANDON
case ParentClosePolicyRequestCancel:
return commonpb.PARENT_CLOSE_POLICY_REQUEST_CANCEL
return enumspb.PARENT_CLOSE_POLICY_REQUEST_CANCEL
case ParentClosePolicyTerminate:
return commonpb.PARENT_CLOSE_POLICY_TERMINATE
return enumspb.PARENT_CLOSE_POLICY_TERMINATE
default:
panic(fmt.Sprintf("unknown workflow parent close policy %v", p))
}
Expand Down
48 changes: 24 additions & 24 deletions internal/common/serializer/serializer.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ import (
"fmt"

"github.com/gogo/protobuf/proto"
commonpb "go.temporal.io/temporal-proto/common"
eventpb "go.temporal.io/temporal-proto/event"
filterpb "go.temporal.io/temporal-proto/filter"
commonpb "go.temporal.io/temporal-proto/common/v1"
enumspb "go.temporal.io/temporal-proto/enums/v1"
historypb "go.temporal.io/temporal-proto/history/v1"
"go.temporal.io/temporal-proto/serviceerror"
)

Expand Down Expand Up @@ -68,16 +68,16 @@ type (

// UnknownEncodingTypeError is an error type for unknown or unsupported encoding type
UnknownEncodingTypeError struct {
encodingType commonpb.EncodingType
encodingType enumspb.EncodingType
}
)

// SerializeBatchEvents serializes batch events into a datablob proto
func SerializeBatchEvents(events []*eventpb.HistoryEvent, encodingType commonpb.EncodingType) (*commonpb.DataBlob, error) {
return serialize(&eventpb.History{Events: events}, encodingType)
func SerializeBatchEvents(events []*historypb.HistoryEvent, encodingType enumspb.EncodingType) (*commonpb.DataBlob, error) {
return serialize(&historypb.History{Events: events}, encodingType)
}

func serializeProto(p proto.Marshaler, encodingType commonpb.EncodingType) (*commonpb.DataBlob, error) {
func serializeProto(p proto.Marshaler, encodingType enumspb.EncodingType) (*commonpb.DataBlob, error) {
if p == nil {
return nil, nil
}
Expand All @@ -86,10 +86,10 @@ func serializeProto(p proto.Marshaler, encodingType commonpb.EncodingType) (*com
var err error

switch encodingType {
case commonpb.ENCODING_TYPE_PROTO3:
case enumspb.ENCODING_TYPE_PROTO3:
data, err = p.Marshal()
case commonpb.ENCODING_TYPE_JSON:
encodingType = commonpb.ENCODING_TYPE_JSON
case enumspb.ENCODING_TYPE_JSON:
encodingType = enumspb.ENCODING_TYPE_JSON
pb, ok := p.(proto.Message)
if !ok {
return nil, NewSerializationError("could not cast protomarshal interface to proto.message")
Expand All @@ -112,20 +112,20 @@ func serializeProto(p proto.Marshaler, encodingType commonpb.EncodingType) (*com
}

// DeserializeBatchEvents deserializes batch events from a datablob proto
func DeserializeBatchEvents(data *commonpb.DataBlob) ([]*eventpb.HistoryEvent, error) {
func DeserializeBatchEvents(data *commonpb.DataBlob) ([]*historypb.HistoryEvent, error) {
if data == nil {
return nil, nil
}
if len(data.Data) == 0 {
return nil, nil
}

events := &eventpb.History{}
events := &historypb.History{}
var err error
switch data.EncodingType {
case commonpb.ENCODING_TYPE_JSON:
case enumspb.ENCODING_TYPE_JSON:
err = NewJSONPBEncoder().Decode(data.Data, events)
case commonpb.ENCODING_TYPE_PROTO3:
case enumspb.ENCODING_TYPE_PROTO3:
err = proto.Unmarshal(data.Data, events)
default:
return nil, NewDeserializationError("DeserializeBatchEvents invalid encoding")
Expand All @@ -136,7 +136,7 @@ func DeserializeBatchEvents(data *commonpb.DataBlob) ([]*eventpb.HistoryEvent, e
return events.Events, nil
}

func serialize(input interface{}, encodingType commonpb.EncodingType) (*commonpb.DataBlob, error) {
func serialize(input interface{}, encodingType enumspb.EncodingType) (*commonpb.DataBlob, error) {
if input == nil {
return nil, nil
}
Expand All @@ -149,7 +149,7 @@ func serialize(input interface{}, encodingType commonpb.EncodingType) (*commonpb
var err error

switch encodingType {
case commonpb.ENCODING_TYPE_JSON: // For backward-compatibility
case enumspb.ENCODING_TYPE_JSON: // For backward-compatibility
data, err = json.Marshal(input)
default:
return nil, NewUnknownEncodingTypeError(encodingType)
Expand All @@ -163,7 +163,7 @@ func serialize(input interface{}, encodingType commonpb.EncodingType) (*commonpb
}

// NewUnknownEncodingTypeError returns a new instance of encoding type error
func NewUnknownEncodingTypeError(encodingType commonpb.EncodingType) error {
func NewUnknownEncodingTypeError(encodingType enumspb.EncodingType) error {
return &UnknownEncodingTypeError{encodingType: encodingType}
}

Expand All @@ -190,7 +190,7 @@ func (e *DeserializationError) Error() string {
}

// NewDataBlob creates new blob data
func NewDataBlob(data []byte, encodingType commonpb.EncodingType) *commonpb.DataBlob {
func NewDataBlob(data []byte, encodingType enumspb.EncodingType) *commonpb.DataBlob {
if len(data) == 0 {
return nil
}
Expand All @@ -203,10 +203,10 @@ func NewDataBlob(data []byte, encodingType commonpb.EncodingType) *commonpb.Data

// DeserializeBlobDataToHistoryEvents deserialize the blob data to history event data
func DeserializeBlobDataToHistoryEvents(
dataBlobs []*commonpb.DataBlob, filterType filterpb.HistoryEventFilterType,
) (*eventpb.History, error) {
dataBlobs []*commonpb.DataBlob, filterType enumspb.HistoryEventFilterType,
) (*historypb.History, error) {

var historyEvents []*eventpb.HistoryEvent
var historyEvents []*historypb.HistoryEvent

for _, batch := range dataBlobs {
events, err := DeserializeBatchEvents(batch)
Expand All @@ -222,8 +222,8 @@ func DeserializeBlobDataToHistoryEvents(
historyEvents = append(historyEvents, events...)
}

if filterType == filterpb.HISTORY_EVENT_FILTER_TYPE_CLOSE_EVENT {
historyEvents = []*eventpb.HistoryEvent{historyEvents[len(historyEvents)-1]}
if filterType == enumspb.HISTORY_EVENT_FILTER_TYPE_CLOSE_EVENT {
historyEvents = []*historypb.HistoryEvent{historyEvents[len(historyEvents)-1]}
}
return &eventpb.History{Events: historyEvents}, nil
return &historypb.History{Events: historyEvents}, nil
}
Loading

0 comments on commit 4b1863d

Please sign in to comment.