diff --git a/common/persistence/serialization/getters.go b/common/persistence/serialization/getters.go new file mode 100644 index 00000000000..86182dafe85 --- /dev/null +++ b/common/persistence/serialization/getters.go @@ -0,0 +1,1637 @@ +// The MIT License (MIT) + +// Copyright (c) 2017-2020 Uber Technologies Inc. + +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +package serialization + +import ( + "time" + + "github.com/uber/cadence/common/types" +) + +// GetStolenSinceRenew internal sql blob getter +func (s *ShardInfo) GetStolenSinceRenew() (o int32) { + if s != nil && s.StolenSinceRenew != nil { + return *s.StolenSinceRenew + } + return +} + +// GetUpdatedAt internal sql blob getter +func (s *ShardInfo) GetUpdatedAt() time.Time { + if s != nil && s.UpdatedAt != nil { + return *s.UpdatedAt + } + return time.Unix(0, 0) +} + +// GetReplicationAckLevel internal sql blob getter +func (s *ShardInfo) GetReplicationAckLevel() (o int64) { + if s != nil && s.ReplicationAckLevel != nil { + return *s.ReplicationAckLevel + } + return +} + +// GetTransferAckLevel internal sql blob getter +func (s *ShardInfo) GetTransferAckLevel() (o int64) { + if s != nil && s.TransferAckLevel != nil { + return *s.TransferAckLevel + } + return +} + +// GetTimerAckLevel internal sql blob getter +func (s *ShardInfo) GetTimerAckLevel() time.Time { + if s != nil && s.TimerAckLevel != nil { + return *s.TimerAckLevel + } + return time.Unix(0, 0) +} + +// GetDomainNotificationVersion internal sql blob getter +func (s *ShardInfo) GetDomainNotificationVersion() (o int64) { + if s != nil && s.DomainNotificationVersion != nil { + return *s.DomainNotificationVersion + } + return +} + +// GetClusterTransferAckLevel internal sql blob getter +func (s *ShardInfo) GetClusterTransferAckLevel() (o map[string]int64) { + if s != nil { + return s.ClusterTransferAckLevel + } + return +} + +// GetClusterTimerAckLevel internal sql blob getter +func (s *ShardInfo) GetClusterTimerAckLevel() (o map[string]time.Time) { + if s != nil { + return s.ClusterTimerAckLevel + } + return +} + +// GetOwner internal sql blob getter +func (s *ShardInfo) GetOwner() (o string) { + if s != nil && s.Owner != nil { + return *s.Owner + } + return +} + +// GetClusterReplicationLevel internal sql blob getter +func (s *ShardInfo) GetClusterReplicationLevel() (o map[string]int64) { + if s != nil { + return s.ClusterReplicationLevel + } + return +} + +// GetPendingFailoverMarkers internal sql blob getter +func (s *ShardInfo) GetPendingFailoverMarkers() (o []byte) { + if s != nil { + return s.PendingFailoverMarkers + } + return +} + +// GetPendingFailoverMarkersEncoding internal sql blob getter +func (s *ShardInfo) GetPendingFailoverMarkersEncoding() (o string) { + if s != nil && s.PendingFailoverMarkersEncoding != nil { + return *s.PendingFailoverMarkersEncoding + } + return +} + +// GetReplicationDlqAckLevel internal sql blob getter +func (s *ShardInfo) GetReplicationDlqAckLevel() (o map[string]int64) { + if s != nil { + return s.ReplicationDlqAckLevel + } + return +} + +// GetTransferProcessingQueueStates internal sql blob getter +func (s *ShardInfo) GetTransferProcessingQueueStates() (o []byte) { + if s != nil { + return s.TransferProcessingQueueStates + } + return +} + +// GetTransferProcessingQueueStatesEncoding internal sql blob getter +func (s *ShardInfo) GetTransferProcessingQueueStatesEncoding() (o string) { + if s != nil && s.TransferProcessingQueueStatesEncoding != nil { + return *s.TransferProcessingQueueStatesEncoding + } + return +} + +// GetTimerProcessingQueueStates internal sql blob getter +func (s *ShardInfo) GetTimerProcessingQueueStates() (o []byte) { + if s != nil { + return s.TimerProcessingQueueStates + } + return +} + +// GetTimerProcessingQueueStatesEncoding internal sql blob getter +func (s *ShardInfo) GetTimerProcessingQueueStatesEncoding() (o string) { + if s != nil && s.TimerProcessingQueueStatesEncoding != nil { + return *s.TimerProcessingQueueStatesEncoding + } + return +} + +// GetName internal sql blob getter +func (d *DomainInfo) GetName() (o string) { + if d != nil && d.Name != nil { + return *d.Name + } + return +} + +// GetDescription internal sql blob getter +func (d *DomainInfo) GetDescription() (o string) { + if d != nil && d.Description != nil { + return *d.Description + } + return +} + +// GetOwner internal sql blob getter +func (d *DomainInfo) GetOwner() (o string) { + if d != nil && d.Owner != nil { + return *d.Owner + } + return +} + +// GetStatus internal sql blob getter +func (d *DomainInfo) GetStatus() (o int32) { + if d != nil && d.Status != nil { + return *d.Status + } + return +} + +// GetRetention internal sql blob getter +func (d *DomainInfo) GetRetention() time.Duration { + if d != nil && d.Retention != nil { + return *d.Retention + } + return time.Duration(0) +} + +// GetEmitMetric internal sql blob getter +func (d *DomainInfo) GetEmitMetric() (o bool) { + if d != nil && d.EmitMetric != nil { + return *d.EmitMetric + } + return +} + +// GetArchivalBucket internal sql blob getter +func (d *DomainInfo) GetArchivalBucket() (o string) { + if d != nil && d.ArchivalBucket != nil { + return *d.ArchivalBucket + } + return +} + +// GetArchivalStatus internal sql blob getter +func (d *DomainInfo) GetArchivalStatus() (o int16) { + if d != nil && d.ArchivalStatus != nil { + return *d.ArchivalStatus + } + return +} + +// GetConfigVersion internal sql blob getter +func (d *DomainInfo) GetConfigVersion() (o int64) { + if d != nil && d.ConfigVersion != nil { + return *d.ConfigVersion + } + return +} + +// GetNotificationVersion internal sql blob getter +func (d *DomainInfo) GetNotificationVersion() (o int64) { + if d != nil && d.NotificationVersion != nil { + return *d.NotificationVersion + } + return +} + +// GetFailoverNotificationVersion internal sql blob getter +func (d *DomainInfo) GetFailoverNotificationVersion() (o int64) { + if d != nil && d.FailoverNotificationVersion != nil { + return *d.FailoverNotificationVersion + } + return +} + +// GetFailoverVersion internal sql blob getter +func (d *DomainInfo) GetFailoverVersion() (o int64) { + if d != nil && d.FailoverVersion != nil { + return *d.FailoverVersion + } + return +} + +// GetActiveClusterName internal sql blob getter +func (d *DomainInfo) GetActiveClusterName() (o string) { + if d != nil && d.ActiveClusterName != nil { + return *d.ActiveClusterName + } + return +} + +// GetClusters internal sql blob getter +func (d *DomainInfo) GetClusters() (o []string) { + if d != nil { + return d.Clusters + } + return +} + +// GetData internal sql blob getter +func (d *DomainInfo) GetData() (o map[string]string) { + if d != nil { + return d.Data + } + return +} + +// GetBadBinaries internal sql blob getter +func (d *DomainInfo) GetBadBinaries() (o []byte) { + if d != nil { + return d.BadBinaries + } + return +} + +// GetBadBinariesEncoding internal sql blob getter +func (d *DomainInfo) GetBadBinariesEncoding() (o string) { + if d != nil && d.BadBinariesEncoding != nil { + return *d.BadBinariesEncoding + } + return +} + +// GetHistoryArchivalStatus internal sql blob getter +func (d *DomainInfo) GetHistoryArchivalStatus() (o int16) { + if d != nil && d.HistoryArchivalStatus != nil { + return *d.HistoryArchivalStatus + } + return +} + +// GetHistoryArchivalURI internal sql blob getter +func (d *DomainInfo) GetHistoryArchivalURI() (o string) { + if d != nil && d.HistoryArchivalURI != nil { + return *d.HistoryArchivalURI + } + return +} + +// GetVisibilityArchivalStatus internal sql blob getter +func (d *DomainInfo) GetVisibilityArchivalStatus() (o int16) { + if d != nil && d.VisibilityArchivalStatus != nil { + return *d.VisibilityArchivalStatus + } + return +} + +// GetVisibilityArchivalURI internal sql blob getter +func (d *DomainInfo) GetVisibilityArchivalURI() (o string) { + if d != nil && d.VisibilityArchivalURI != nil { + return *d.VisibilityArchivalURI + } + return +} + +// GetFailoverEndTimestamp internal sql blob getter +func (d *DomainInfo) GetFailoverEndTimestamp() time.Time { + if d != nil && d.FailoverEndTimestamp != nil { + return *d.FailoverEndTimestamp + } + return time.Unix(0, 0) +} + +// GetPreviousFailoverVersion internal sql blob getter +func (d *DomainInfo) GetPreviousFailoverVersion() (o int64) { + if d != nil && d.PreviousFailoverVersion != nil { + return *d.PreviousFailoverVersion + } + return +} + +// GetLastUpdatedTimestamp internal sql blob getter +func (d *DomainInfo) GetLastUpdatedTimestamp() time.Time { + if d != nil && d.LastUpdatedTimestamp != nil { + return *d.LastUpdatedTimestamp + } + return time.Unix(0, 0) +} + +// GetCreatedTimestamp internal sql blob getter +func (h *HistoryTreeInfo) GetCreatedTimestamp() time.Time { + if h != nil && h.CreatedTimestamp != nil { + return *h.CreatedTimestamp + } + return time.Unix(0, 0) +} + +// GetAncestors internal sql blob getter +func (h *HistoryTreeInfo) GetAncestors() (o []*types.HistoryBranchRange) { + if h != nil { + return h.Ancestors + } + return +} + +// GetInfo internal sql blob getter +func (h *HistoryTreeInfo) GetInfo() (o string) { + if h != nil && h.Info != nil { + return *h.Info + } + return +} + +// GetParentDomainID internal sql blob getter +func (w *WorkflowExecutionInfo) GetParentDomainID() (o []byte) { + if w != nil { + return w.ParentDomainID + } + return +} + +// GetRetryBackoffCoefficient internal sql blob getter +func (w *WorkflowExecutionInfo) GetRetryBackoffCoefficient() (o float64) { + if w != nil && w.RetryBackoffCoefficient != nil { + return *w.RetryBackoffCoefficient + } + return +} + +// GetParentWorkflowID internal sql blob getter +func (w *WorkflowExecutionInfo) GetParentWorkflowID() (o string) { + if w != nil && w.ParentWorkflowID != nil { + return *w.ParentWorkflowID + } + return +} + +// GetParentRunID internal sql blob getter +func (w *WorkflowExecutionInfo) GetParentRunID() (o []byte) { + if w != nil { + return w.ParentRunID + } + return +} + +// GetCompletionEventEncoding internal sql blob getter +func (w *WorkflowExecutionInfo) GetCompletionEventEncoding() (o string) { + if w != nil && w.CompletionEventEncoding != nil { + return *w.CompletionEventEncoding + } + return +} + +// GetTaskList internal sql blob getter +func (w *WorkflowExecutionInfo) GetTaskList() (o string) { + if w != nil && w.TaskList != nil { + return *w.TaskList + } + return +} + +// GetWorkflowTypeName internal sql blob getter +func (w *WorkflowExecutionInfo) GetWorkflowTypeName() (o string) { + if w != nil && w.WorkflowTypeName != nil { + return *w.WorkflowTypeName + } + return +} + +// GetCreateRequestID internal sql blob getter +func (w *WorkflowExecutionInfo) GetCreateRequestID() (o string) { + if w != nil && w.CreateRequestID != nil { + return *w.CreateRequestID + } + return +} + +// GetDecisionRequestID internal sql blob getter +func (w *WorkflowExecutionInfo) GetDecisionRequestID() (o string) { + if w != nil && w.DecisionRequestID != nil { + return *w.DecisionRequestID + } + return +} + +// GetCancelRequestID internal sql blob getter +func (w *WorkflowExecutionInfo) GetCancelRequestID() (o string) { + if w != nil && w.CancelRequestID != nil { + return *w.CancelRequestID + } + return +} + +// GetStickyTaskList internal sql blob getter +func (w *WorkflowExecutionInfo) GetStickyTaskList() (o string) { + if w != nil && w.StickyTaskList != nil { + return *w.StickyTaskList + } + return +} + +// GetCronSchedule internal sql blob getter +func (w *WorkflowExecutionInfo) GetCronSchedule() (o string) { + if w != nil && w.CronSchedule != nil { + return *w.CronSchedule + } + return +} + +// GetClientLibraryVersion internal sql blob getter +func (w *WorkflowExecutionInfo) GetClientLibraryVersion() (o string) { + if w != nil && w.ClientLibraryVersion != nil { + return *w.ClientLibraryVersion + } + return +} + +// GetClientFeatureVersion internal sql blob getter +func (w *WorkflowExecutionInfo) GetClientFeatureVersion() (o string) { + if w != nil && w.ClientFeatureVersion != nil { + return *w.ClientFeatureVersion + } + return +} + +// GetClientImpl internal sql blob getter +func (w *WorkflowExecutionInfo) GetClientImpl() (o string) { + if w != nil && w.ClientImpl != nil { + return *w.ClientImpl + } + return +} + +// GetAutoResetPointsEncoding internal sql blob getter +func (w *WorkflowExecutionInfo) GetAutoResetPointsEncoding() (o string) { + if w != nil && w.AutoResetPointsEncoding != nil { + return *w.AutoResetPointsEncoding + } + return +} + +// GetVersionHistoriesEncoding internal sql blob getter +func (w *WorkflowExecutionInfo) GetVersionHistoriesEncoding() (o string) { + if w != nil && w.VersionHistoriesEncoding != nil { + return *w.VersionHistoriesEncoding + } + return +} + +// GetInitiatedID internal sql blob getter +func (w *WorkflowExecutionInfo) GetInitiatedID() (o int64) { + if w != nil && w.InitiatedID != nil { + return *w.InitiatedID + } + return +} + +// GetCompletionEventBatchID internal sql blob getter +func (w *WorkflowExecutionInfo) GetCompletionEventBatchID() (o int64) { + if w != nil && w.CompletionEventBatchID != nil { + return *w.CompletionEventBatchID + } + return +} + +// GetStartVersion internal sql blob getter +func (w *WorkflowExecutionInfo) GetStartVersion() (o int64) { + if w != nil && w.StartVersion != nil { + return *w.StartVersion + } + return +} + +// GetLastWriteEventID internal sql blob getter +func (w *WorkflowExecutionInfo) GetLastWriteEventID() (o int64) { + if w != nil && w.LastWriteEventID != nil { + return *w.LastWriteEventID + } + return +} + +// GetLastEventTaskID internal sql blob getter +func (w *WorkflowExecutionInfo) GetLastEventTaskID() (o int64) { + if w != nil && w.LastEventTaskID != nil { + return *w.LastEventTaskID + } + return +} + +// GetLastFirstEventID internal sql blob getter +func (w *WorkflowExecutionInfo) GetLastFirstEventID() (o int64) { + if w != nil && w.LastFirstEventID != nil { + return *w.LastFirstEventID + } + return +} + +// GetLastProcessedEvent internal sql blob getter +func (w *WorkflowExecutionInfo) GetLastProcessedEvent() (o int64) { + if w != nil && w.LastProcessedEvent != nil { + return *w.LastProcessedEvent + } + return +} + +// GetDecisionVersion internal sql blob getter +func (w *WorkflowExecutionInfo) GetDecisionVersion() (o int64) { + if w != nil && w.DecisionVersion != nil { + return *w.DecisionVersion + } + return +} + +// GetDecisionScheduleID internal sql blob getter +func (w *WorkflowExecutionInfo) GetDecisionScheduleID() (o int64) { + if w != nil && w.DecisionScheduleID != nil { + return *w.DecisionScheduleID + } + return +} + +// GetDecisionStartedID internal sql blob getter +func (w *WorkflowExecutionInfo) GetDecisionStartedID() (o int64) { + if w != nil && w.DecisionStartedID != nil { + return *w.DecisionStartedID + } + return +} + +// GetDecisionAttempt internal sql blob getter +func (w *WorkflowExecutionInfo) GetDecisionAttempt() (o int64) { + if w != nil && w.DecisionAttempt != nil { + return *w.DecisionAttempt + } + return +} + +// GetRetryAttempt internal sql blob getter +func (w *WorkflowExecutionInfo) GetRetryAttempt() (o int64) { + if w != nil && w.RetryAttempt != nil { + return *w.RetryAttempt + } + return +} + +// GetSignalCount internal sql blob getter +func (w *WorkflowExecutionInfo) GetSignalCount() (o int64) { + if w != nil && w.SignalCount != nil { + return *w.SignalCount + } + return +} + +// GetHistorySize internal sql blob getter +func (w *WorkflowExecutionInfo) GetHistorySize() (o int64) { + if w != nil && w.HistorySize != nil { + return *w.HistorySize + } + return +} + +// GetState internal sql blob getter +func (w *WorkflowExecutionInfo) GetState() (o int32) { + if w != nil && w.State != nil { + return *w.State + } + return +} + +// GetCloseStatus internal sql blob getter +func (w *WorkflowExecutionInfo) GetCloseStatus() (o int32) { + if w != nil && w.CloseStatus != nil { + return *w.CloseStatus + } + return +} + +// GetRetryMaximumAttempts internal sql blob getter +func (w *WorkflowExecutionInfo) GetRetryMaximumAttempts() (o int32) { + if w != nil && w.RetryMaximumAttempts != nil { + return *w.RetryMaximumAttempts + } + return +} + +// GetEventStoreVersion internal sql blob getter +func (w *WorkflowExecutionInfo) GetEventStoreVersion() (o int32) { + if w != nil && w.EventStoreVersion != nil { + return *w.EventStoreVersion + } + return +} + +// GetWorkflowTimeout internal sql blob getter +func (w *WorkflowExecutionInfo) GetWorkflowTimeout() time.Duration { + if w != nil && w.WorkflowTimeout != nil { + return *w.WorkflowTimeout + } + return time.Duration(0) +} + +// GetDecisionTaskTimeout internal sql blob getter +func (w *WorkflowExecutionInfo) GetDecisionTaskTimeout() time.Duration { + if w != nil && w.DecisionTaskTimeout != nil { + return *w.DecisionTaskTimeout + } + return time.Duration(0) +} + +// GetDecisionTimeout internal sql blob getter +func (w *WorkflowExecutionInfo) GetDecisionTimeout() time.Duration { + if w != nil && w.DecisionTimeout != nil { + return *w.DecisionTimeout + } + return time.Duration(0) +} + +// GetStickyScheduleToStartTimeout internal sql blob getter +func (w *WorkflowExecutionInfo) GetStickyScheduleToStartTimeout() time.Duration { + if w != nil && w.StickyScheduleToStartTimeout != nil { + return *w.StickyScheduleToStartTimeout + } + return time.Duration(0) +} + +// GetRetryInitialInterval internal sql blob getter +func (w *WorkflowExecutionInfo) GetRetryInitialInterval() time.Duration { + if w != nil && w.RetryInitialInterval != nil { + return *w.RetryInitialInterval + } + return time.Duration(0) +} + +// GetRetryMaximumInterval internal sql blob getter +func (w *WorkflowExecutionInfo) GetRetryMaximumInterval() time.Duration { + if w != nil && w.RetryMaximumInterval != nil { + return *w.RetryMaximumInterval + } + return time.Duration(0) +} + +// GetRetryExpiration internal sql blob getter +func (w *WorkflowExecutionInfo) GetRetryExpiration() time.Duration { + if w != nil && w.RetryExpiration != nil { + return *w.RetryExpiration + } + return time.Duration(0) +} + +// GetStartTimestamp internal sql blob getter +func (w *WorkflowExecutionInfo) GetStartTimestamp() time.Time { + if w != nil && w.StartTimestamp != nil { + return *w.StartTimestamp + } + return time.Unix(0, 0) +} + +// GetLastUpdatedTimestamp internal sql blob getter +func (w *WorkflowExecutionInfo) GetLastUpdatedTimestamp() time.Time { + if w != nil && w.LastUpdatedTimestamp != nil { + return *w.LastUpdatedTimestamp + } + return time.Unix(0, 0) +} + +// GetDecisionStartedTimestamp internal sql blob getter +func (w *WorkflowExecutionInfo) GetDecisionStartedTimestamp() time.Time { + if w != nil && w.DecisionStartedTimestamp != nil { + return *w.DecisionStartedTimestamp + } + return time.Unix(0, 0) +} + +// GetDecisionScheduledTimestamp internal sql blob getter +func (w *WorkflowExecutionInfo) GetDecisionScheduledTimestamp() time.Time { + if w != nil && w.DecisionScheduledTimestamp != nil { + return *w.DecisionScheduledTimestamp + } + return time.Unix(0, 0) +} + +// GetDecisionOriginalScheduledTimestamp internal sql blob getter +func (w *WorkflowExecutionInfo) GetDecisionOriginalScheduledTimestamp() time.Time { + if w != nil && w.DecisionOriginalScheduledTimestamp != nil { + return *w.DecisionOriginalScheduledTimestamp + } + return time.Unix(0, 0) +} + +// GetRetryExpirationTimestamp internal sql blob getter +func (w *WorkflowExecutionInfo) GetRetryExpirationTimestamp() time.Time { + if w != nil && w.RetryExpirationTimestamp != nil { + return *w.RetryExpirationTimestamp + } + return time.Unix(0, 0) +} + +// GetCompletionEvent internal sql blob getter +func (w *WorkflowExecutionInfo) GetCompletionEvent() (o []byte) { + if w != nil { + return w.CompletionEvent + } + return +} + +// GetExecutionContext internal sql blob getter +func (w *WorkflowExecutionInfo) GetExecutionContext() (o []byte) { + if w != nil { + return w.ExecutionContext + } + return +} + +// GetEventBranchToken internal sql blob getter +func (w *WorkflowExecutionInfo) GetEventBranchToken() (o []byte) { + if w != nil { + return w.EventBranchToken + } + return +} + +// GetAutoResetPoints internal sql blob getter +func (w *WorkflowExecutionInfo) GetAutoResetPoints() (o []byte) { + if w != nil { + return w.AutoResetPoints + } + return +} + +// GetVersionHistories internal sql blob getter +func (w *WorkflowExecutionInfo) GetVersionHistories() (o []byte) { + if w != nil { + return w.VersionHistories + } + return +} + +// GetMemo internal sql blob getter +func (w *WorkflowExecutionInfo) GetMemo() (o map[string][]byte) { + if w != nil { + return w.Memo + } + return +} + +// GetSearchAttributes internal sql blob getter +func (w *WorkflowExecutionInfo) GetSearchAttributes() (o map[string][]byte) { + if w != nil { + return w.SearchAttributes + } + return +} + +// GetRetryNonRetryableErrors internal sql blob getter +func (w *WorkflowExecutionInfo) GetRetryNonRetryableErrors() (o []string) { + if w != nil { + return w.RetryNonRetryableErrors + } + return +} + +// GetCancelRequested internal sql blob getter +func (w *WorkflowExecutionInfo) GetCancelRequested() (o bool) { + if w != nil && w.CancelRequested != nil { + return *w.CancelRequested + } + return +} + +// GetHasRetryPolicy internal sql blob getter +func (w *WorkflowExecutionInfo) GetHasRetryPolicy() (o bool) { + if w != nil && w.HasRetryPolicy != nil { + return *w.HasRetryPolicy + } + return +} + +// GetVersion internal sql blob getter +func (a *ActivityInfo) GetVersion() (o int64) { + if a != nil && a.Version != nil { + return *a.Version + } + return +} + +// GetScheduledEventBatchID internal sql blob getter +func (a *ActivityInfo) GetScheduledEventBatchID() (o int64) { + if a != nil && a.ScheduledEventBatchID != nil { + return *a.ScheduledEventBatchID + } + return +} + +// GetStartedID internal sql blob getter +func (a *ActivityInfo) GetStartedID() (o int64) { + if a != nil && a.StartedID != nil { + return *a.StartedID + } + return +} + +// GetCancelRequestID internal sql blob getter +func (a *ActivityInfo) GetCancelRequestID() (o int64) { + if a != nil && a.CancelRequestID != nil { + return *a.CancelRequestID + } + return +} + +// GetTimerTaskStatus internal sql blob getter +func (a *ActivityInfo) GetTimerTaskStatus() (o int32) { + if a != nil && a.TimerTaskStatus != nil { + return *a.TimerTaskStatus + } + return +} + +// GetScheduledEventEncoding internal sql blob getter +func (a *ActivityInfo) GetScheduledEventEncoding() (o string) { + if a != nil && a.ScheduledEventEncoding != nil { + return *a.ScheduledEventEncoding + } + return +} + +// GetStartedIdentity internal sql blob getter +func (a *ActivityInfo) GetStartedIdentity() (o string) { + if a != nil && a.StartedIdentity != nil { + return *a.StartedIdentity + } + return +} + +// GetRetryLastFailureReason internal sql blob getter +func (a *ActivityInfo) GetRetryLastFailureReason() (o string) { + if a != nil && a.RetryLastFailureReason != nil { + return *a.RetryLastFailureReason + } + return +} + +// GetRetryLastWorkerIdentity internal sql blob getter +func (a *ActivityInfo) GetRetryLastWorkerIdentity() (o string) { + if a != nil && a.RetryLastWorkerIdentity != nil { + return *a.RetryLastWorkerIdentity + } + return +} + +// GetTaskList internal sql blob getter +func (a *ActivityInfo) GetTaskList() (o string) { + if a != nil && a.TaskList != nil { + return *a.TaskList + } + return +} + +// GetStartedEventEncoding internal sql blob getter +func (a *ActivityInfo) GetStartedEventEncoding() (o string) { + if a != nil && a.StartedEventEncoding != nil { + return *a.StartedEventEncoding + } + return +} + +// GetActivityID internal sql blob getter +func (a *ActivityInfo) GetActivityID() (o string) { + if a != nil && a.ActivityID != nil { + return *a.ActivityID + } + return +} + +// GetRequestID internal sql blob getter +func (a *ActivityInfo) GetRequestID() (o string) { + if a != nil && a.RequestID != nil { + return *a.RequestID + } + return +} + +// GetAttempt internal sql blob getter +func (a *ActivityInfo) GetAttempt() (o int32) { + if a != nil && a.Attempt != nil { + return *a.Attempt + } + return +} + +// GetRetryMaximumAttempts internal sql blob getter +func (a *ActivityInfo) GetRetryMaximumAttempts() (o int32) { + if a != nil && a.RetryMaximumAttempts != nil { + return *a.RetryMaximumAttempts + } + return +} + +// GetScheduledTimestamp internal sql blob getter +func (a *ActivityInfo) GetScheduledTimestamp() time.Time { + if a != nil && a.ScheduledTimestamp != nil { + return *a.ScheduledTimestamp + } + return time.Unix(0, 0) +} + +// GetStartedTimestamp internal sql blob getter +func (a *ActivityInfo) GetStartedTimestamp() time.Time { + if a != nil && a.StartedTimestamp != nil { + return *a.StartedTimestamp + } + return time.Unix(0, 0) +} + +// GetRetryExpirationTimestamp internal sql blob getter +func (a *ActivityInfo) GetRetryExpirationTimestamp() time.Time { + if a != nil && a.RetryExpirationTimestamp != nil { + return *a.RetryExpirationTimestamp + } + return time.Unix(0, 0) +} + +// GetScheduleToStartTimeout internal sql blob getter +func (a *ActivityInfo) GetScheduleToStartTimeout() time.Duration { + if a != nil && a.ScheduleToStartTimeout != nil { + return *a.ScheduleToStartTimeout + } + return time.Duration(0) +} + +// GetScheduleToCloseTimeout internal sql blob getter +func (a *ActivityInfo) GetScheduleToCloseTimeout() time.Duration { + if a != nil && a.ScheduleToCloseTimeout != nil { + return *a.ScheduleToCloseTimeout + } + return time.Duration(0) +} + +// GetStartToCloseTimeout internal sql blob getter +func (a *ActivityInfo) GetStartToCloseTimeout() time.Duration { + if a != nil && a.StartToCloseTimeout != nil { + return *a.StartToCloseTimeout + } + return time.Duration(0) +} + +// GetHeartbeatTimeout internal sql blob getter +func (a *ActivityInfo) GetHeartbeatTimeout() time.Duration { + if a != nil && a.HeartbeatTimeout != nil { + return *a.HeartbeatTimeout + } + return time.Duration(0) +} + +// GetRetryInitialInterval internal sql blob getter +func (a *ActivityInfo) GetRetryInitialInterval() time.Duration { + if a != nil && a.RetryInitialInterval != nil { + return *a.RetryInitialInterval + } + return time.Duration(0) +} + +// GetRetryMaximumInterval internal sql blob getter +func (a *ActivityInfo) GetRetryMaximumInterval() time.Duration { + if a != nil && a.RetryMaximumInterval != nil { + return *a.RetryMaximumInterval + } + return time.Duration(0) +} + +// GetScheduledEvent internal sql blob getter +func (a *ActivityInfo) GetScheduledEvent() (o []byte) { + if a != nil { + return a.ScheduledEvent + } + return +} + +// GetStartedEvent internal sql blob getter +func (a *ActivityInfo) GetStartedEvent() (o []byte) { + if a != nil { + return a.StartedEvent + } + return +} + +// GetRetryLastFailureDetails internal sql blob getter +func (a *ActivityInfo) GetRetryLastFailureDetails() (o []byte) { + if a != nil { + return a.RetryLastFailureDetails + } + return +} + +// GetCancelRequested internal sql blob getter +func (a *ActivityInfo) GetCancelRequested() (o bool) { + if a != nil && a.CancelRequested != nil { + return *a.CancelRequested + } + return +} + +// GetHasRetryPolicy internal sql blob getter +func (a *ActivityInfo) GetHasRetryPolicy() (o bool) { + if a != nil && a.HasRetryPolicy != nil { + return *a.HasRetryPolicy + } + return +} + +// GetRetryBackoffCoefficient internal sql blob getter +func (a *ActivityInfo) GetRetryBackoffCoefficient() (o float64) { + if a != nil && a.RetryBackoffCoefficient != nil { + return *a.RetryBackoffCoefficient + } + return +} + +// GetRetryNonRetryableErrors internal sql blob getter +func (a *ActivityInfo) GetRetryNonRetryableErrors() (o []string) { + if a != nil { + return a.RetryNonRetryableErrors + } + return +} + +// GetVersion internal sql blob getter +func (c *ChildExecutionInfo) GetVersion() (o int64) { + if c != nil && c.Version != nil { + return *c.Version + } + return +} + +// GetInitiatedEventBatchID internal sql blob getter +func (c *ChildExecutionInfo) GetInitiatedEventBatchID() (o int64) { + if c != nil && c.InitiatedEventBatchID != nil { + return *c.InitiatedEventBatchID + } + return +} + +// GetStartedID internal sql blob getter +func (c *ChildExecutionInfo) GetStartedID() (o int64) { + if c != nil && c.StartedID != nil { + return *c.StartedID + } + return +} + +// GetParentClosePolicy internal sql blob getter +func (c *ChildExecutionInfo) GetParentClosePolicy() (o int32) { + if c != nil && c.ParentClosePolicy != nil { + return *c.ParentClosePolicy + } + return +} + +// GetInitiatedEventEncoding internal sql blob getter +func (c *ChildExecutionInfo) GetInitiatedEventEncoding() (o string) { + if c != nil && c.InitiatedEventEncoding != nil { + return *c.InitiatedEventEncoding + } + return +} + +// GetStartedWorkflowID internal sql blob getter +func (c *ChildExecutionInfo) GetStartedWorkflowID() (o string) { + if c != nil && c.StartedWorkflowID != nil { + return *c.StartedWorkflowID + } + return +} + +// GetStartedRunID internal sql blob getter +func (c *ChildExecutionInfo) GetStartedRunID() (o []byte) { + if c != nil { + return c.StartedRunID + } + return +} + +// GetStartedEventEncoding internal sql blob getter +func (c *ChildExecutionInfo) GetStartedEventEncoding() (o string) { + if c != nil && c.StartedEventEncoding != nil { + return *c.StartedEventEncoding + } + return +} + +// GetCreateRequestID internal sql blob getter +func (c *ChildExecutionInfo) GetCreateRequestID() (o string) { + if c != nil && c.CreateRequestID != nil { + return *c.CreateRequestID + } + return +} + +// GetDomainName internal sql blob getter +func (c *ChildExecutionInfo) GetDomainName() (o string) { + if c != nil && c.DomainName != nil { + return *c.DomainName + } + return +} + +// GetWorkflowTypeName internal sql blob getter +func (c *ChildExecutionInfo) GetWorkflowTypeName() (o string) { + if c != nil && c.WorkflowTypeName != nil { + return *c.WorkflowTypeName + } + return +} + +// GetInitiatedEvent internal sql blob getter +func (c *ChildExecutionInfo) GetInitiatedEvent() (o []byte) { + if c != nil { + return c.InitiatedEvent + } + return +} + +// GetStartedEvent internal sql blob getter +func (c *ChildExecutionInfo) GetStartedEvent() (o []byte) { + if c != nil { + return c.StartedEvent + } + return +} + +// GetVersion internal sql blob getter +func (s *SignalInfo) GetVersion() (o int64) { + if s != nil && s.Version != nil { + return *s.Version + } + return +} + +// GetInitiatedEventBatchID internal sql blob getter +func (s *SignalInfo) GetInitiatedEventBatchID() (o int64) { + if s != nil && s.InitiatedEventBatchID != nil { + return *s.InitiatedEventBatchID + } + return +} + +// GetRequestID internal sql blob getter +func (s *SignalInfo) GetRequestID() (o string) { + if s != nil && s.RequestID != nil { + return *s.RequestID + } + return +} + +// GetName internal sql blob getter +func (s *SignalInfo) GetName() (o string) { + if s != nil && s.Name != nil { + return *s.Name + } + return +} + +// GetInput internal sql blob getter +func (s *SignalInfo) GetInput() (o []byte) { + if s != nil { + return s.Input + } + return +} + +// GetControl internal sql blob getter +func (s *SignalInfo) GetControl() (o []byte) { + if s != nil { + return s.Control + } + return +} + +// GetVersion internal sql blob getter +func (r *RequestCancelInfo) GetVersion() (o int64) { + if r != nil && r.Version != nil { + return *r.Version + } + return +} + +// GetInitiatedEventBatchID internal sql blob getter +func (r *RequestCancelInfo) GetInitiatedEventBatchID() (o int64) { + if r != nil && r.InitiatedEventBatchID != nil { + return *r.InitiatedEventBatchID + } + return +} + +// GetCancelRequestID internal sql blob getter +func (r *RequestCancelInfo) GetCancelRequestID() (o string) { + if r != nil && r.CancelRequestID != nil { + return *r.CancelRequestID + } + return +} + +// GetVersion internal sql blob getter +func (t *TimerInfo) GetVersion() (o int64) { + if t != nil && t.Version != nil { + return *t.Version + } + return +} + +// GetStartedID internal sql blob getter +func (t *TimerInfo) GetStartedID() (o int64) { + if t != nil && t.StartedID != nil { + return *t.StartedID + } + return +} + +// GetTaskID internal sql blob getter +func (t *TimerInfo) GetTaskID() (o int64) { + if t != nil && t.TaskID != nil { + return *t.TaskID + } + return +} + +// GetExpiryTimestamp internal sql blob getter +func (t *TimerInfo) GetExpiryTimestamp() (o time.Time) { + if t != nil && t.ExpiryTimestamp != nil { + return *t.ExpiryTimestamp + } + return time.Unix(0, 0) +} + +// GetWorkflowID internal sql blob getter +func (t *TaskInfo) GetWorkflowID() (o string) { + if t != nil && t.WorkflowID != nil { + return *t.WorkflowID + } + return +} + +// GetRunID internal sql blob getter +func (t *TaskInfo) GetRunID() (o []byte) { + if t != nil { + return t.RunID + } + return +} + +// GetScheduleID internal sql blob getter +func (t *TaskInfo) GetScheduleID() (o int64) { + if t != nil && t.ScheduleID != nil { + return *t.ScheduleID + } + return +} + +// GetExpiryTimestamp internal sql blob getter +func (t *TaskInfo) GetExpiryTimestamp() time.Time { + if t != nil && t.ExpiryTimestamp != nil { + return *t.ExpiryTimestamp + } + return time.Unix(0, 0) +} + +// GetCreatedTimestamp internal sql blob getter +func (t *TaskInfo) GetCreatedTimestamp() time.Time { + if t != nil && t.CreatedTimestamp != nil { + return *t.CreatedTimestamp + } + return time.Unix(0, 0) +} + +// GetKind internal sql blob getter +func (t *TaskListInfo) GetKind() (o int16) { + if t != nil && t.Kind != nil { + return *t.Kind + } + return +} + +// GetAckLevel internal sql blob getter +func (t *TaskListInfo) GetAckLevel() (o int64) { + if t != nil && t.AckLevel != nil { + return *t.AckLevel + } + return +} + +// GetExpiryTimestamp internal sql blob getter +func (t *TaskListInfo) GetExpiryTimestamp() time.Time { + if t != nil && t.ExpiryTimestamp != nil { + return *t.ExpiryTimestamp + } + return time.Unix(0, 0) +} + +// GetLastUpdated internal sql blob getter +func (t *TaskListInfo) GetLastUpdated() time.Time { + if t != nil && t.LastUpdated != nil { + return *t.LastUpdated + } + return time.Unix(0, 0) +} + +// GetDomainID internal sql blob getter +func (t *TransferTaskInfo) GetDomainID() (o []byte) { + if t != nil { + return t.DomainID + } + return +} + +// GetWorkflowID internal sql blob getter +func (t *TransferTaskInfo) GetWorkflowID() (o string) { + if t != nil && t.WorkflowID != nil { + return *t.WorkflowID + } + return +} + +// GetRunID internal sql blob getter +func (t *TransferTaskInfo) GetRunID() (o []byte) { + if t != nil { + return t.RunID + } + return +} + +// GetTaskType internal sql blob getter +func (t *TransferTaskInfo) GetTaskType() (o int16) { + if t != nil && t.TaskType != nil { + return *t.TaskType + } + return +} + +// GetTargetDomainID internal sql blob getter +func (t *TransferTaskInfo) GetTargetDomainID() (o []byte) { + if t != nil { + return t.TargetDomainID + } + return +} + +// GetTargetWorkflowID internal sql blob getter +func (t *TransferTaskInfo) GetTargetWorkflowID() (o string) { + if t != nil && t.TargetWorkflowID != nil { + return *t.TargetWorkflowID + } + return +} + +// GetTargetRunID internal sql blob getter +func (t *TransferTaskInfo) GetTargetRunID() (o []byte) { + if t != nil { + return t.TargetRunID + } + return +} + +// GetTaskList internal sql blob getter +func (t *TransferTaskInfo) GetTaskList() (o string) { + if t != nil && t.TaskList != nil { + return *t.TaskList + } + return +} + +// GetTargetChildWorkflowOnly internal sql blob getter +func (t *TransferTaskInfo) GetTargetChildWorkflowOnly() (o bool) { + if t != nil && t.TargetChildWorkflowOnly != nil { + return *t.TargetChildWorkflowOnly + } + return +} + +// GetScheduleID internal sql blob getter +func (t *TransferTaskInfo) GetScheduleID() (o int64) { + if t != nil && t.ScheduleID != nil { + return *t.ScheduleID + } + return +} + +// GetVersion internal sql blob getter +func (t *TransferTaskInfo) GetVersion() (o int64) { + if t != nil && t.Version != nil { + return *t.Version + } + return +} + +// GetVisibilityTimestamp internal sql blob getter +func (t *TransferTaskInfo) GetVisibilityTimestamp() time.Time { + if t != nil && t.VisibilityTimestamp != nil { + return *t.VisibilityTimestamp + } + return time.Unix(0, 0) +} + +// GetDomainID internal sql blob getter +func (t *TimerTaskInfo) GetDomainID() (o []byte) { + if t != nil && t.DomainID != nil { + return t.DomainID + } + return +} + +// GetWorkflowID internal sql blob getter +func (t *TimerTaskInfo) GetWorkflowID() (o string) { + if t != nil && t.WorkflowID != nil { + return *t.WorkflowID + } + return +} + +// GetRunID internal sql blob getter +func (t *TimerTaskInfo) GetRunID() (o []byte) { + if t != nil && t.RunID != nil { + return t.RunID + } + return +} + +// GetTaskType internal sql blob getter +func (t *TimerTaskInfo) GetTaskType() (o int16) { + if t != nil && t.TaskType != nil { + return *t.TaskType + } + return +} + +// GetTimeoutType internal sql blob getter +func (t *TimerTaskInfo) GetTimeoutType() (o int16) { + if t != nil && t.TimeoutType != nil { + return *t.TimeoutType + } + return +} + +// GetVersion internal sql blob getter +func (t *TimerTaskInfo) GetVersion() (o int64) { + if t != nil && t.Version != nil { + return *t.Version + } + return +} + +// GetScheduleAttempt internal sql blob getter +func (t *TimerTaskInfo) GetScheduleAttempt() (o int64) { + if t != nil && t.ScheduleAttempt != nil { + return *t.ScheduleAttempt + } + return +} + +// GetEventID internal sql blob getter +func (t *TimerTaskInfo) GetEventID() (o int64) { + if t != nil && t.EventID != nil { + return *t.EventID + } + return +} + +// GetDomainID internal sql blob getter +func (t *ReplicationTaskInfo) GetDomainID() (o []byte) { + if t != nil { + return t.DomainID + } + return +} + +// GetWorkflowID internal sql blob getter +func (t *ReplicationTaskInfo) GetWorkflowID() (o string) { + if t != nil && t.WorkflowID != nil { + return *t.WorkflowID + } + return +} + +// GetRunID internal sql blob getter +func (t *ReplicationTaskInfo) GetRunID() (o []byte) { + if t != nil { + return t.RunID + } + return +} + +// GetTaskType internal sql blob getter +func (t *ReplicationTaskInfo) GetTaskType() (o int16) { + if t != nil && t.TaskType != nil { + return *t.TaskType + } + return +} + +// GetVersion internal sql blob getter +func (t *ReplicationTaskInfo) GetVersion() (o int64) { + if t != nil && t.Version != nil { + return *t.Version + } + return +} + +// GetFirstEventID internal sql blob getter +func (t *ReplicationTaskInfo) GetFirstEventID() (o int64) { + if t != nil && t.FirstEventID != nil { + return *t.FirstEventID + } + return +} + +// GetNextEventID internal sql blob getter +func (t *ReplicationTaskInfo) GetNextEventID() (o int64) { + if t != nil && t.NextEventID != nil { + return *t.NextEventID + } + return +} + +// GetScheduledID internal sql blob getter +func (t *ReplicationTaskInfo) GetScheduledID() (o int64) { + if t != nil && t.ScheduledID != nil { + return *t.ScheduledID + } + return +} + +// GetEventStoreVersion internal sql blob getter +func (t *ReplicationTaskInfo) GetEventStoreVersion() (o int32) { + if t != nil && t.EventStoreVersion != nil { + return *t.EventStoreVersion + } + return +} + +// GetNewRunEventStoreVersion internal sql blob getter +func (t *ReplicationTaskInfo) GetNewRunEventStoreVersion() (o int32) { + if t != nil && t.NewRunEventStoreVersion != nil { + return *t.NewRunEventStoreVersion + } + return +} + +// GetBranchToken internal sql blob getter +func (t *ReplicationTaskInfo) GetBranchToken() (o []byte) { + if t != nil { + return t.BranchToken + } + return +} + +// GetNewRunBranchToken internal sql blob getter +func (t *ReplicationTaskInfo) GetNewRunBranchToken() (o []byte) { + if t != nil { + return t.NewRunBranchToken + } + return +} + +// GetCreationTimestamp internal sql blob getter +func (t *ReplicationTaskInfo) GetCreationTimestamp() time.Time { + if t != nil && t.CreationTimestamp != nil { + return *t.CreationTimestamp + } + return time.Unix(0, 0) +} diff --git a/common/persistence/serialization/interfaces.go b/common/persistence/serialization/interfaces.go index 0093ca97ed3..f1c01fd6be3 100644 --- a/common/persistence/serialization/interfaces.go +++ b/common/persistence/serialization/interfaces.go @@ -27,9 +27,9 @@ import ( "go.uber.org/thriftrw/wire" - "github.com/uber/cadence/.gen/go/sqlblobs" "github.com/uber/cadence/common" "github.com/uber/cadence/common/persistence" + "github.com/uber/cadence/common/types" ) type ( @@ -92,15 +92,15 @@ type ( // HistoryTreeInfo blob in a serialization agnostic format HistoryTreeInfo struct { CreatedTimestamp *time.Time - Ancestors []*HistoryBranchRange + Ancestors []*types.HistoryBranchRange Info *string } // WorkflowExecutionInfo blob in a serialization agnostic format WorkflowExecutionInfo struct { - ParentDomainID *string + ParentDomainID UUID ParentWorkflowID *string - ParentRunID *string + ParentRunID UUID InitiatedID *int64 CompletionEventBatchID *int64 CompletionEvent []byte @@ -201,7 +201,7 @@ type ( InitiatedEvent []byte InitiatedEventEncoding *string StartedWorkflowID *string - StartedRunID *string + StartedRunID UUID StartedEvent []byte StartedEventEncoding *string CreateRequestID *string @@ -238,7 +238,7 @@ type ( // TaskInfo blob in a serialization agnostic format TaskInfo struct { WorkflowID *string - RunID *string + RunID UUID ScheduleID *int64 ExpiryTimestamp *time.Time CreatedTimestamp *time.Time @@ -254,13 +254,13 @@ type ( // TransferTaskInfo blob in a serialization agnostic format TransferTaskInfo struct { - DomainID *string + DomainID UUID WorkflowID *string - RunID *string + RunID UUID TaskType *int16 - TargetDomainID *string + TargetDomainID UUID TargetWorkflowID *string - TargetRunID *string + TargetRunID UUID TaskList *string TargetChildWorkflowOnly *bool ScheduleID *int64 @@ -270,9 +270,9 @@ type ( // TimerTaskInfo blob in a serialization agnostic format TimerTaskInfo struct { - DomainID *string + DomainID UUID WorkflowID *string - RunID *string + RunID UUID TaskType *int16 TimeoutType *int16 Version *int64 @@ -282,9 +282,9 @@ type ( // ReplicationTaskInfo blob in a serialization agnostic format ReplicationTaskInfo struct { - DomainID *string + DomainID UUID WorkflowID *string - RunID *string + RunID UUID TaskType *int16 Version *int64 FirstEventID *int64 @@ -303,72 +303,72 @@ type ( // a single encoder which encodes into one format and a collection of decoders. // Parser selects the appropriate decoder for the provided blob. Parser interface { - ShardInfoToBlob(*sqlblobs.ShardInfo) (persistence.DataBlob, error) - DomainInfoToBlob(*sqlblobs.DomainInfo) (persistence.DataBlob, error) - HistoryTreeInfoToBlob(*sqlblobs.HistoryTreeInfo) (persistence.DataBlob, error) - WorkflowExecutionInfoToBlob(*sqlblobs.WorkflowExecutionInfo) (persistence.DataBlob, error) - ActivityInfoToBlob(*sqlblobs.ActivityInfo) (persistence.DataBlob, error) - ChildExecutionInfoToBlob(*sqlblobs.ChildExecutionInfo) (persistence.DataBlob, error) - SignalInfoToBlob(*sqlblobs.SignalInfo) (persistence.DataBlob, error) - RequestCancelInfoToBlob(*sqlblobs.RequestCancelInfo) (persistence.DataBlob, error) - TimerInfoToBlob(*sqlblobs.TimerInfo) (persistence.DataBlob, error) - TaskInfoToBlob(*sqlblobs.TaskInfo) (persistence.DataBlob, error) - TaskListInfoToBlob(*sqlblobs.TaskListInfo) (persistence.DataBlob, error) - TransferTaskInfoToBlob(*sqlblobs.TransferTaskInfo) (persistence.DataBlob, error) - TimerTaskInfoToBlob(*sqlblobs.TimerTaskInfo) (persistence.DataBlob, error) - ReplicationTaskInfoToBlob(*sqlblobs.ReplicationTaskInfo) (persistence.DataBlob, error) + ShardInfoToBlob(*ShardInfo) (persistence.DataBlob, error) + DomainInfoToBlob(*DomainInfo) (persistence.DataBlob, error) + HistoryTreeInfoToBlob(*HistoryTreeInfo) (persistence.DataBlob, error) + WorkflowExecutionInfoToBlob(*WorkflowExecutionInfo) (persistence.DataBlob, error) + ActivityInfoToBlob(*ActivityInfo) (persistence.DataBlob, error) + ChildExecutionInfoToBlob(*ChildExecutionInfo) (persistence.DataBlob, error) + SignalInfoToBlob(*SignalInfo) (persistence.DataBlob, error) + RequestCancelInfoToBlob(*RequestCancelInfo) (persistence.DataBlob, error) + TimerInfoToBlob(*TimerInfo) (persistence.DataBlob, error) + TaskInfoToBlob(*TaskInfo) (persistence.DataBlob, error) + TaskListInfoToBlob(*TaskListInfo) (persistence.DataBlob, error) + TransferTaskInfoToBlob(*TransferTaskInfo) (persistence.DataBlob, error) + TimerTaskInfoToBlob(*TimerTaskInfo) (persistence.DataBlob, error) + ReplicationTaskInfoToBlob(*ReplicationTaskInfo) (persistence.DataBlob, error) - ShardInfoFromBlob([]byte, string) (*sqlblobs.ShardInfo, error) - DomainInfoFromBlob([]byte, string) (*sqlblobs.DomainInfo, error) - HistoryTreeInfoFromBlob([]byte, string) (*sqlblobs.HistoryTreeInfo, error) - WorkflowExecutionInfoFromBlob([]byte, string) (*sqlblobs.WorkflowExecutionInfo, error) - ActivityInfoFromBlob([]byte, string) (*sqlblobs.ActivityInfo, error) - ChildExecutionInfoFromBlob([]byte, string) (*sqlblobs.ChildExecutionInfo, error) - SignalInfoFromBlob([]byte, string) (*sqlblobs.SignalInfo, error) - RequestCancelInfoFromBlob([]byte, string) (*sqlblobs.RequestCancelInfo, error) - TimerInfoFromBlob([]byte, string) (*sqlblobs.TimerInfo, error) - TaskInfoFromBlob([]byte, string) (*sqlblobs.TaskInfo, error) - TaskListInfoFromBlob([]byte, string) (*sqlblobs.TaskListInfo, error) - TransferTaskInfoFromBlob([]byte, string) (*sqlblobs.TransferTaskInfo, error) - TimerTaskInfoFromBlob([]byte, string) (*sqlblobs.TimerTaskInfo, error) - ReplicationTaskInfoFromBlob([]byte, string) (*sqlblobs.ReplicationTaskInfo, error) + ShardInfoFromBlob([]byte, string) (*ShardInfo, error) + DomainInfoFromBlob([]byte, string) (*DomainInfo, error) + HistoryTreeInfoFromBlob([]byte, string) (*HistoryTreeInfo, error) + WorkflowExecutionInfoFromBlob([]byte, string) (*WorkflowExecutionInfo, error) + ActivityInfoFromBlob([]byte, string) (*ActivityInfo, error) + ChildExecutionInfoFromBlob([]byte, string) (*ChildExecutionInfo, error) + SignalInfoFromBlob([]byte, string) (*SignalInfo, error) + RequestCancelInfoFromBlob([]byte, string) (*RequestCancelInfo, error) + TimerInfoFromBlob([]byte, string) (*TimerInfo, error) + TaskInfoFromBlob([]byte, string) (*TaskInfo, error) + TaskListInfoFromBlob([]byte, string) (*TaskListInfo, error) + TransferTaskInfoFromBlob([]byte, string) (*TransferTaskInfo, error) + TimerTaskInfoFromBlob([]byte, string) (*TimerTaskInfo, error) + ReplicationTaskInfoFromBlob([]byte, string) (*ReplicationTaskInfo, error) } // encoder is used to serialize structs. Each encoder implementation uses one serialization format. encoder interface { - shardInfoToBlob(*sqlblobs.ShardInfo) ([]byte, error) - domainInfoToBlob(*sqlblobs.DomainInfo) ([]byte, error) - historyTreeInfoToBlob(*sqlblobs.HistoryTreeInfo) ([]byte, error) - workflowExecutionInfoToBlob(*sqlblobs.WorkflowExecutionInfo) ([]byte, error) - activityInfoToBlob(*sqlblobs.ActivityInfo) ([]byte, error) - childExecutionInfoToBlob(*sqlblobs.ChildExecutionInfo) ([]byte, error) - signalInfoToBlob(*sqlblobs.SignalInfo) ([]byte, error) - requestCancelInfoToBlob(*sqlblobs.RequestCancelInfo) ([]byte, error) - timerInfoToBlob(*sqlblobs.TimerInfo) ([]byte, error) - taskInfoToBlob(*sqlblobs.TaskInfo) ([]byte, error) - taskListInfoToBlob(*sqlblobs.TaskListInfo) ([]byte, error) - transferTaskInfoToBlob(*sqlblobs.TransferTaskInfo) ([]byte, error) - timerTaskInfoToBlob(*sqlblobs.TimerTaskInfo) ([]byte, error) - replicationTaskInfoToBlob(*sqlblobs.ReplicationTaskInfo) ([]byte, error) + shardInfoToBlob(*ShardInfo) ([]byte, error) + domainInfoToBlob(*DomainInfo) ([]byte, error) + historyTreeInfoToBlob(*HistoryTreeInfo) ([]byte, error) + workflowExecutionInfoToBlob(*WorkflowExecutionInfo) ([]byte, error) + activityInfoToBlob(*ActivityInfo) ([]byte, error) + childExecutionInfoToBlob(*ChildExecutionInfo) ([]byte, error) + signalInfoToBlob(*SignalInfo) ([]byte, error) + requestCancelInfoToBlob(*RequestCancelInfo) ([]byte, error) + timerInfoToBlob(*TimerInfo) ([]byte, error) + taskInfoToBlob(*TaskInfo) ([]byte, error) + taskListInfoToBlob(*TaskListInfo) ([]byte, error) + transferTaskInfoToBlob(*TransferTaskInfo) ([]byte, error) + timerTaskInfoToBlob(*TimerTaskInfo) ([]byte, error) + replicationTaskInfoToBlob(*ReplicationTaskInfo) ([]byte, error) encodingType() common.EncodingType } // decoder is used to deserialize structs. Each decoder implementation uses one serialization format. decoder interface { - shardInfoFromBlob([]byte) (*sqlblobs.ShardInfo, error) - domainInfoFromBlob([]byte) (*sqlblobs.DomainInfo, error) - historyTreeInfoFromBlob([]byte) (*sqlblobs.HistoryTreeInfo, error) - workflowExecutionInfoFromBlob([]byte) (*sqlblobs.WorkflowExecutionInfo, error) - activityInfoFromBlob([]byte) (*sqlblobs.ActivityInfo, error) - childExecutionInfoFromBlob([]byte) (*sqlblobs.ChildExecutionInfo, error) - signalInfoFromBlob([]byte) (*sqlblobs.SignalInfo, error) - requestCancelInfoFromBlob([]byte) (*sqlblobs.RequestCancelInfo, error) - timerInfoFromBlob([]byte) (*sqlblobs.TimerInfo, error) - taskInfoFromBlob([]byte) (*sqlblobs.TaskInfo, error) - taskListInfoFromBlob([]byte) (*sqlblobs.TaskListInfo, error) - transferTaskInfoFromBlob([]byte) (*sqlblobs.TransferTaskInfo, error) - timerTaskInfoFromBlob([]byte) (*sqlblobs.TimerTaskInfo, error) - replicationTaskInfoFromBlob([]byte) (*sqlblobs.ReplicationTaskInfo, error) + shardInfoFromBlob([]byte) (*ShardInfo, error) + domainInfoFromBlob([]byte) (*DomainInfo, error) + historyTreeInfoFromBlob([]byte) (*HistoryTreeInfo, error) + workflowExecutionInfoFromBlob([]byte) (*WorkflowExecutionInfo, error) + activityInfoFromBlob([]byte) (*ActivityInfo, error) + childExecutionInfoFromBlob([]byte) (*ChildExecutionInfo, error) + signalInfoFromBlob([]byte) (*SignalInfo, error) + requestCancelInfoFromBlob([]byte) (*RequestCancelInfo, error) + timerInfoFromBlob([]byte) (*TimerInfo, error) + taskInfoFromBlob([]byte) (*TaskInfo, error) + taskListInfoFromBlob([]byte) (*TaskListInfo, error) + transferTaskInfoFromBlob([]byte) (*TransferTaskInfo, error) + timerTaskInfoFromBlob([]byte) (*TimerTaskInfo, error) + replicationTaskInfoFromBlob([]byte) (*ReplicationTaskInfo, error) } thriftRWType interface { diff --git a/common/persistence/serialization/parser.go b/common/persistence/serialization/parser.go index 77fa1d11da9..674d2e94d4b 100644 --- a/common/persistence/serialization/parser.go +++ b/common/persistence/serialization/parser.go @@ -25,7 +25,6 @@ package serialization import ( "fmt" - "github.com/uber/cadence/.gen/go/sqlblobs" "github.com/uber/cadence/common" "github.com/uber/cadence/common/persistence" ) @@ -57,7 +56,7 @@ func NewParser(encodingType common.EncodingType, decodingTypes ...common.Encodin }, nil } -func (p *parser) ShardInfoToBlob(info *sqlblobs.ShardInfo) (persistence.DataBlob, error) { +func (p *parser) ShardInfoToBlob(info *ShardInfo) (persistence.DataBlob, error) { db := persistence.DataBlob{} data, err := p.encoder.shardInfoToBlob(info) if err != nil { @@ -68,7 +67,7 @@ func (p *parser) ShardInfoToBlob(info *sqlblobs.ShardInfo) (persistence.DataBlob return db, nil } -func (p *parser) DomainInfoToBlob(info *sqlblobs.DomainInfo) (persistence.DataBlob, error) { +func (p *parser) DomainInfoToBlob(info *DomainInfo) (persistence.DataBlob, error) { db := persistence.DataBlob{} data, err := p.encoder.domainInfoToBlob(info) if err != nil { @@ -79,7 +78,7 @@ func (p *parser) DomainInfoToBlob(info *sqlblobs.DomainInfo) (persistence.DataBl return db, nil } -func (p *parser) HistoryTreeInfoToBlob(info *sqlblobs.HistoryTreeInfo) (persistence.DataBlob, error) { +func (p *parser) HistoryTreeInfoToBlob(info *HistoryTreeInfo) (persistence.DataBlob, error) { db := persistence.DataBlob{} data, err := p.encoder.historyTreeInfoToBlob(info) if err != nil { @@ -90,7 +89,7 @@ func (p *parser) HistoryTreeInfoToBlob(info *sqlblobs.HistoryTreeInfo) (persiste return db, nil } -func (p *parser) WorkflowExecutionInfoToBlob(info *sqlblobs.WorkflowExecutionInfo) (persistence.DataBlob, error) { +func (p *parser) WorkflowExecutionInfoToBlob(info *WorkflowExecutionInfo) (persistence.DataBlob, error) { db := persistence.DataBlob{} data, err := p.encoder.workflowExecutionInfoToBlob(info) if err != nil { @@ -101,7 +100,7 @@ func (p *parser) WorkflowExecutionInfoToBlob(info *sqlblobs.WorkflowExecutionInf return db, nil } -func (p *parser) ActivityInfoToBlob(info *sqlblobs.ActivityInfo) (persistence.DataBlob, error) { +func (p *parser) ActivityInfoToBlob(info *ActivityInfo) (persistence.DataBlob, error) { db := persistence.DataBlob{} data, err := p.encoder.activityInfoToBlob(info) if err != nil { @@ -112,7 +111,7 @@ func (p *parser) ActivityInfoToBlob(info *sqlblobs.ActivityInfo) (persistence.Da return db, nil } -func (p *parser) ChildExecutionInfoToBlob(info *sqlblobs.ChildExecutionInfo) (persistence.DataBlob, error) { +func (p *parser) ChildExecutionInfoToBlob(info *ChildExecutionInfo) (persistence.DataBlob, error) { db := persistence.DataBlob{} data, err := p.encoder.childExecutionInfoToBlob(info) if err != nil { @@ -123,7 +122,7 @@ func (p *parser) ChildExecutionInfoToBlob(info *sqlblobs.ChildExecutionInfo) (pe return db, nil } -func (p *parser) SignalInfoToBlob(info *sqlblobs.SignalInfo) (persistence.DataBlob, error) { +func (p *parser) SignalInfoToBlob(info *SignalInfo) (persistence.DataBlob, error) { db := persistence.DataBlob{} data, err := p.encoder.signalInfoToBlob(info) if err != nil { @@ -134,7 +133,7 @@ func (p *parser) SignalInfoToBlob(info *sqlblobs.SignalInfo) (persistence.DataBl return db, nil } -func (p *parser) RequestCancelInfoToBlob(info *sqlblobs.RequestCancelInfo) (persistence.DataBlob, error) { +func (p *parser) RequestCancelInfoToBlob(info *RequestCancelInfo) (persistence.DataBlob, error) { db := persistence.DataBlob{} data, err := p.encoder.requestCancelInfoToBlob(info) if err != nil { @@ -145,7 +144,7 @@ func (p *parser) RequestCancelInfoToBlob(info *sqlblobs.RequestCancelInfo) (pers return db, nil } -func (p *parser) TimerInfoToBlob(info *sqlblobs.TimerInfo) (persistence.DataBlob, error) { +func (p *parser) TimerInfoToBlob(info *TimerInfo) (persistence.DataBlob, error) { db := persistence.DataBlob{} data, err := p.encoder.timerInfoToBlob(info) if err != nil { @@ -156,7 +155,7 @@ func (p *parser) TimerInfoToBlob(info *sqlblobs.TimerInfo) (persistence.DataBlob return db, nil } -func (p *parser) TaskInfoToBlob(info *sqlblobs.TaskInfo) (persistence.DataBlob, error) { +func (p *parser) TaskInfoToBlob(info *TaskInfo) (persistence.DataBlob, error) { db := persistence.DataBlob{} data, err := p.encoder.taskInfoToBlob(info) if err != nil { @@ -167,7 +166,7 @@ func (p *parser) TaskInfoToBlob(info *sqlblobs.TaskInfo) (persistence.DataBlob, return db, nil } -func (p *parser) TaskListInfoToBlob(info *sqlblobs.TaskListInfo) (persistence.DataBlob, error) { +func (p *parser) TaskListInfoToBlob(info *TaskListInfo) (persistence.DataBlob, error) { db := persistence.DataBlob{} data, err := p.encoder.taskListInfoToBlob(info) if err != nil { @@ -178,7 +177,7 @@ func (p *parser) TaskListInfoToBlob(info *sqlblobs.TaskListInfo) (persistence.Da return db, nil } -func (p *parser) TransferTaskInfoToBlob(info *sqlblobs.TransferTaskInfo) (persistence.DataBlob, error) { +func (p *parser) TransferTaskInfoToBlob(info *TransferTaskInfo) (persistence.DataBlob, error) { db := persistence.DataBlob{} data, err := p.encoder.transferTaskInfoToBlob(info) if err != nil { @@ -189,7 +188,7 @@ func (p *parser) TransferTaskInfoToBlob(info *sqlblobs.TransferTaskInfo) (persis return db, nil } -func (p *parser) TimerTaskInfoToBlob(info *sqlblobs.TimerTaskInfo) (persistence.DataBlob, error) { +func (p *parser) TimerTaskInfoToBlob(info *TimerTaskInfo) (persistence.DataBlob, error) { db := persistence.DataBlob{} data, err := p.encoder.timerTaskInfoToBlob(info) if err != nil { @@ -200,7 +199,7 @@ func (p *parser) TimerTaskInfoToBlob(info *sqlblobs.TimerTaskInfo) (persistence. return db, nil } -func (p *parser) ReplicationTaskInfoToBlob(info *sqlblobs.ReplicationTaskInfo) (persistence.DataBlob, error) { +func (p *parser) ReplicationTaskInfoToBlob(info *ReplicationTaskInfo) (persistence.DataBlob, error) { db := persistence.DataBlob{} data, err := p.encoder.replicationTaskInfoToBlob(info) if err != nil { @@ -211,7 +210,7 @@ func (p *parser) ReplicationTaskInfoToBlob(info *sqlblobs.ReplicationTaskInfo) ( return db, nil } -func (p *parser) ShardInfoFromBlob(data []byte, encoding string) (*sqlblobs.ShardInfo, error) { +func (p *parser) ShardInfoFromBlob(data []byte, encoding string) (*ShardInfo, error) { decoder, err := p.getCachedDecoder(common.EncodingType(encoding)) if err != nil { return nil, err @@ -219,7 +218,7 @@ func (p *parser) ShardInfoFromBlob(data []byte, encoding string) (*sqlblobs.Shar return decoder.shardInfoFromBlob(data) } -func (p *parser) DomainInfoFromBlob(data []byte, encoding string) (*sqlblobs.DomainInfo, error) { +func (p *parser) DomainInfoFromBlob(data []byte, encoding string) (*DomainInfo, error) { decoder, err := p.getCachedDecoder(common.EncodingType(encoding)) if err != nil { return nil, err @@ -227,7 +226,7 @@ func (p *parser) DomainInfoFromBlob(data []byte, encoding string) (*sqlblobs.Dom return decoder.domainInfoFromBlob(data) } -func (p *parser) HistoryTreeInfoFromBlob(data []byte, encoding string) (*sqlblobs.HistoryTreeInfo, error) { +func (p *parser) HistoryTreeInfoFromBlob(data []byte, encoding string) (*HistoryTreeInfo, error) { decoder, err := p.getCachedDecoder(common.EncodingType(encoding)) if err != nil { return nil, err @@ -235,7 +234,7 @@ func (p *parser) HistoryTreeInfoFromBlob(data []byte, encoding string) (*sqlblob return decoder.historyTreeInfoFromBlob(data) } -func (p *parser) WorkflowExecutionInfoFromBlob(data []byte, encoding string) (*sqlblobs.WorkflowExecutionInfo, error) { +func (p *parser) WorkflowExecutionInfoFromBlob(data []byte, encoding string) (*WorkflowExecutionInfo, error) { decoder, err := p.getCachedDecoder(common.EncodingType(encoding)) if err != nil { return nil, err @@ -243,7 +242,7 @@ func (p *parser) WorkflowExecutionInfoFromBlob(data []byte, encoding string) (*s return decoder.workflowExecutionInfoFromBlob(data) } -func (p *parser) ActivityInfoFromBlob(data []byte, encoding string) (*sqlblobs.ActivityInfo, error) { +func (p *parser) ActivityInfoFromBlob(data []byte, encoding string) (*ActivityInfo, error) { decoder, err := p.getCachedDecoder(common.EncodingType(encoding)) if err != nil { return nil, err @@ -251,7 +250,7 @@ func (p *parser) ActivityInfoFromBlob(data []byte, encoding string) (*sqlblobs.A return decoder.activityInfoFromBlob(data) } -func (p *parser) ChildExecutionInfoFromBlob(data []byte, encoding string) (*sqlblobs.ChildExecutionInfo, error) { +func (p *parser) ChildExecutionInfoFromBlob(data []byte, encoding string) (*ChildExecutionInfo, error) { decoder, err := p.getCachedDecoder(common.EncodingType(encoding)) if err != nil { return nil, err @@ -259,7 +258,7 @@ func (p *parser) ChildExecutionInfoFromBlob(data []byte, encoding string) (*sqlb return decoder.childExecutionInfoFromBlob(data) } -func (p *parser) SignalInfoFromBlob(data []byte, encoding string) (*sqlblobs.SignalInfo, error) { +func (p *parser) SignalInfoFromBlob(data []byte, encoding string) (*SignalInfo, error) { decoder, err := p.getCachedDecoder(common.EncodingType(encoding)) if err != nil { return nil, err @@ -267,7 +266,7 @@ func (p *parser) SignalInfoFromBlob(data []byte, encoding string) (*sqlblobs.Sig return decoder.signalInfoFromBlob(data) } -func (p *parser) RequestCancelInfoFromBlob(data []byte, encoding string) (*sqlblobs.RequestCancelInfo, error) { +func (p *parser) RequestCancelInfoFromBlob(data []byte, encoding string) (*RequestCancelInfo, error) { decoder, err := p.getCachedDecoder(common.EncodingType(encoding)) if err != nil { return nil, err @@ -275,7 +274,7 @@ func (p *parser) RequestCancelInfoFromBlob(data []byte, encoding string) (*sqlbl return decoder.requestCancelInfoFromBlob(data) } -func (p *parser) TimerInfoFromBlob(data []byte, encoding string) (*sqlblobs.TimerInfo, error) { +func (p *parser) TimerInfoFromBlob(data []byte, encoding string) (*TimerInfo, error) { decoder, err := p.getCachedDecoder(common.EncodingType(encoding)) if err != nil { return nil, err @@ -283,7 +282,7 @@ func (p *parser) TimerInfoFromBlob(data []byte, encoding string) (*sqlblobs.Time return decoder.timerInfoFromBlob(data) } -func (p *parser) TaskInfoFromBlob(data []byte, encoding string) (*sqlblobs.TaskInfo, error) { +func (p *parser) TaskInfoFromBlob(data []byte, encoding string) (*TaskInfo, error) { decoder, err := p.getCachedDecoder(common.EncodingType(encoding)) if err != nil { return nil, err @@ -291,7 +290,7 @@ func (p *parser) TaskInfoFromBlob(data []byte, encoding string) (*sqlblobs.TaskI return decoder.taskInfoFromBlob(data) } -func (p *parser) TaskListInfoFromBlob(data []byte, encoding string) (*sqlblobs.TaskListInfo, error) { +func (p *parser) TaskListInfoFromBlob(data []byte, encoding string) (*TaskListInfo, error) { decoder, err := p.getCachedDecoder(common.EncodingType(encoding)) if err != nil { return nil, err @@ -299,7 +298,7 @@ func (p *parser) TaskListInfoFromBlob(data []byte, encoding string) (*sqlblobs.T return decoder.taskListInfoFromBlob(data) } -func (p *parser) TransferTaskInfoFromBlob(data []byte, encoding string) (*sqlblobs.TransferTaskInfo, error) { +func (p *parser) TransferTaskInfoFromBlob(data []byte, encoding string) (*TransferTaskInfo, error) { decoder, err := p.getCachedDecoder(common.EncodingType(encoding)) if err != nil { return nil, err @@ -307,7 +306,7 @@ func (p *parser) TransferTaskInfoFromBlob(data []byte, encoding string) (*sqlblo return decoder.transferTaskInfoFromBlob(data) } -func (p *parser) TimerTaskInfoFromBlob(data []byte, encoding string) (*sqlblobs.TimerTaskInfo, error) { +func (p *parser) TimerTaskInfoFromBlob(data []byte, encoding string) (*TimerTaskInfo, error) { decoder, err := p.getCachedDecoder(common.EncodingType(encoding)) if err != nil { return nil, err @@ -315,7 +314,7 @@ func (p *parser) TimerTaskInfoFromBlob(data []byte, encoding string) (*sqlblobs. return decoder.timerTaskInfoFromBlob(data) } -func (p *parser) ReplicationTaskInfoFromBlob(data []byte, encoding string) (*sqlblobs.ReplicationTaskInfo, error) { +func (p *parser) ReplicationTaskInfoFromBlob(data []byte, encoding string) (*ReplicationTaskInfo, error) { decoder, err := p.getCachedDecoder(common.EncodingType(encoding)) if err != nil { return nil, err diff --git a/common/persistence/serialization/parser_test.go b/common/persistence/serialization/parser_test.go index f449d6d8cec..b85a72a52f8 100644 --- a/common/persistence/serialization/parser_test.go +++ b/common/persistence/serialization/parser_test.go @@ -27,14 +27,13 @@ import ( "github.com/stretchr/testify/assert" - "github.com/uber/cadence/.gen/go/sqlblobs" "github.com/uber/cadence/common" ) func TestParse(t *testing.T) { thriftParser, err := NewParser(common.EncodingTypeThriftRW, common.EncodingTypeThriftRW) assert.NoError(t, err) - domainInfo := &sqlblobs.DomainInfo{ + domainInfo := &DomainInfo{ Name: common.StringPtr("test_name"), Data: map[string]string{"test_key": "test_value"}, } diff --git a/common/persistence/serialization/proto_decoder.go b/common/persistence/serialization/proto_decoder.go index 39dec04679a..3bb5af0e018 100644 --- a/common/persistence/serialization/proto_decoder.go +++ b/common/persistence/serialization/proto_decoder.go @@ -22,10 +22,6 @@ package serialization -import ( - "github.com/uber/cadence/.gen/go/sqlblobs" -) - type ( protoDecoder struct{} ) @@ -34,58 +30,58 @@ func newProtoDecoder() decoder { return &protoDecoder{} } -func (d *protoDecoder) shardInfoFromBlob(data []byte) (*sqlblobs.ShardInfo, error) { +func (d *protoDecoder) shardInfoFromBlob(data []byte) (*ShardInfo, error) { panic("not implemented") } -func (d *protoDecoder) domainInfoFromBlob(data []byte) (*sqlblobs.DomainInfo, error) { +func (d *protoDecoder) domainInfoFromBlob(data []byte) (*DomainInfo, error) { panic("not implemented") } -func (d *protoDecoder) historyTreeInfoFromBlob(data []byte) (*sqlblobs.HistoryTreeInfo, error) { +func (d *protoDecoder) historyTreeInfoFromBlob(data []byte) (*HistoryTreeInfo, error) { panic("not implemented") } -func (d *protoDecoder) workflowExecutionInfoFromBlob(data []byte) (*sqlblobs.WorkflowExecutionInfo, error) { +func (d *protoDecoder) workflowExecutionInfoFromBlob(data []byte) (*WorkflowExecutionInfo, error) { panic("not implemented") } -func (d *protoDecoder) activityInfoFromBlob(data []byte) (*sqlblobs.ActivityInfo, error) { +func (d *protoDecoder) activityInfoFromBlob(data []byte) (*ActivityInfo, error) { panic("not implemented") } -func (d *protoDecoder) childExecutionInfoFromBlob(data []byte) (*sqlblobs.ChildExecutionInfo, error) { +func (d *protoDecoder) childExecutionInfoFromBlob(data []byte) (*ChildExecutionInfo, error) { panic("not implemented") } -func (d *protoDecoder) signalInfoFromBlob(data []byte) (*sqlblobs.SignalInfo, error) { +func (d *protoDecoder) signalInfoFromBlob(data []byte) (*SignalInfo, error) { panic("not implemented") } -func (d *protoDecoder) requestCancelInfoFromBlob(data []byte) (*sqlblobs.RequestCancelInfo, error) { +func (d *protoDecoder) requestCancelInfoFromBlob(data []byte) (*RequestCancelInfo, error) { panic("not implemented") } -func (d *protoDecoder) timerInfoFromBlob(data []byte) (*sqlblobs.TimerInfo, error) { +func (d *protoDecoder) timerInfoFromBlob(data []byte) (*TimerInfo, error) { panic("not implemented") } -func (d *protoDecoder) taskInfoFromBlob(data []byte) (*sqlblobs.TaskInfo, error) { +func (d *protoDecoder) taskInfoFromBlob(data []byte) (*TaskInfo, error) { panic("not implemented") } -func (d *protoDecoder) taskListInfoFromBlob(data []byte) (*sqlblobs.TaskListInfo, error) { +func (d *protoDecoder) taskListInfoFromBlob(data []byte) (*TaskListInfo, error) { panic("not implemented") } -func (d *protoDecoder) transferTaskInfoFromBlob(data []byte) (*sqlblobs.TransferTaskInfo, error) { +func (d *protoDecoder) transferTaskInfoFromBlob(data []byte) (*TransferTaskInfo, error) { panic("not implemented") } -func (d *protoDecoder) timerTaskInfoFromBlob(data []byte) (*sqlblobs.TimerTaskInfo, error) { +func (d *protoDecoder) timerTaskInfoFromBlob(data []byte) (*TimerTaskInfo, error) { panic("not implemented") } -func (d *protoDecoder) replicationTaskInfoFromBlob(data []byte) (*sqlblobs.ReplicationTaskInfo, error) { +func (d *protoDecoder) replicationTaskInfoFromBlob(data []byte) (*ReplicationTaskInfo, error) { panic("not implemented") } diff --git a/common/persistence/serialization/proto_encoder.go b/common/persistence/serialization/proto_encoder.go index 6b46d781b95..76714ab7966 100644 --- a/common/persistence/serialization/proto_encoder.go +++ b/common/persistence/serialization/proto_encoder.go @@ -23,7 +23,6 @@ package serialization import ( - "github.com/uber/cadence/.gen/go/sqlblobs" "github.com/uber/cadence/common" ) @@ -33,59 +32,59 @@ func newProtoEncoder() encoder { return &protoEncoder{} } -func (e *protoEncoder) shardInfoToBlob(*sqlblobs.ShardInfo) ([]byte, error) { +func (e *protoEncoder) shardInfoToBlob(*ShardInfo) ([]byte, error) { panic("not implemented") } -func (e *protoEncoder) domainInfoToBlob(*sqlblobs.DomainInfo) ([]byte, error) { +func (e *protoEncoder) domainInfoToBlob(*DomainInfo) ([]byte, error) { panic("not implemented") } -func (e *protoEncoder) historyTreeInfoToBlob(*sqlblobs.HistoryTreeInfo) ([]byte, error) { +func (e *protoEncoder) historyTreeInfoToBlob(*HistoryTreeInfo) ([]byte, error) { panic("not implemented") } -func (e *protoEncoder) workflowExecutionInfoToBlob(*sqlblobs.WorkflowExecutionInfo) ([]byte, error) { +func (e *protoEncoder) workflowExecutionInfoToBlob(*WorkflowExecutionInfo) ([]byte, error) { panic("not implemented") } -func (e *protoEncoder) activityInfoToBlob(*sqlblobs.ActivityInfo) ([]byte, error) { +func (e *protoEncoder) activityInfoToBlob(*ActivityInfo) ([]byte, error) { panic("not implemented") } -func (e *protoEncoder) childExecutionInfoToBlob(*sqlblobs.ChildExecutionInfo) ([]byte, error) { +func (e *protoEncoder) childExecutionInfoToBlob(*ChildExecutionInfo) ([]byte, error) { panic("not implemented") } -func (e *protoEncoder) signalInfoToBlob(*sqlblobs.SignalInfo) ([]byte, error) { +func (e *protoEncoder) signalInfoToBlob(*SignalInfo) ([]byte, error) { panic("not implemented") } -func (e *protoEncoder) requestCancelInfoToBlob(*sqlblobs.RequestCancelInfo) ([]byte, error) { +func (e *protoEncoder) requestCancelInfoToBlob(*RequestCancelInfo) ([]byte, error) { panic("not implemented") } -func (e *protoEncoder) timerInfoToBlob(*sqlblobs.TimerInfo) ([]byte, error) { +func (e *protoEncoder) timerInfoToBlob(*TimerInfo) ([]byte, error) { panic("not implemented") } -func (e *protoEncoder) taskInfoToBlob(*sqlblobs.TaskInfo) ([]byte, error) { +func (e *protoEncoder) taskInfoToBlob(*TaskInfo) ([]byte, error) { panic("not implemented") } -func (e *protoEncoder) taskListInfoToBlob(*sqlblobs.TaskListInfo) ([]byte, error) { +func (e *protoEncoder) taskListInfoToBlob(*TaskListInfo) ([]byte, error) { panic("not implemented") } -func (e *protoEncoder) transferTaskInfoToBlob(*sqlblobs.TransferTaskInfo) ([]byte, error) { +func (e *protoEncoder) transferTaskInfoToBlob(*TransferTaskInfo) ([]byte, error) { panic("not implemented") } -func (e *protoEncoder) timerTaskInfoToBlob(*sqlblobs.TimerTaskInfo) ([]byte, error) { +func (e *protoEncoder) timerTaskInfoToBlob(*TimerTaskInfo) ([]byte, error) { panic("not implemented") } -func (e *protoEncoder) replicationTaskInfoToBlob(*sqlblobs.ReplicationTaskInfo) ([]byte, error) { +func (e *protoEncoder) replicationTaskInfoToBlob(*ReplicationTaskInfo) ([]byte, error) { panic("not implemented") } diff --git a/common/persistence/serialization/thrift_decoder.go b/common/persistence/serialization/thrift_decoder.go index 0f436542b8e..3088babcb78 100644 --- a/common/persistence/serialization/thrift_decoder.go +++ b/common/persistence/serialization/thrift_decoder.go @@ -39,116 +39,116 @@ func newThriftDecoder() decoder { return &thriftDecoder{} } -func (d *thriftDecoder) shardInfoFromBlob(data []byte) (*sqlblobs.ShardInfo, error) { +func (d *thriftDecoder) shardInfoFromBlob(data []byte) (*ShardInfo, error) { result := &sqlblobs.ShardInfo{} if err := thriftRWDecode(data, result); err != nil { return nil, err } - return result, nil + return shardInfoFromThrift(result), nil } -func (d *thriftDecoder) domainInfoFromBlob(data []byte) (*sqlblobs.DomainInfo, error) { +func (d *thriftDecoder) domainInfoFromBlob(data []byte) (*DomainInfo, error) { result := &sqlblobs.DomainInfo{} if err := thriftRWDecode(data, result); err != nil { return nil, err } - return result, nil + return domainInfoFromThrift(result), nil } -func (d *thriftDecoder) historyTreeInfoFromBlob(data []byte) (*sqlblobs.HistoryTreeInfo, error) { +func (d *thriftDecoder) historyTreeInfoFromBlob(data []byte) (*HistoryTreeInfo, error) { result := &sqlblobs.HistoryTreeInfo{} if err := thriftRWDecode(data, result); err != nil { return nil, err } - return result, nil + return historyTreeInfoFromThrift(result), nil } -func (d *thriftDecoder) workflowExecutionInfoFromBlob(data []byte) (*sqlblobs.WorkflowExecutionInfo, error) { +func (d *thriftDecoder) workflowExecutionInfoFromBlob(data []byte) (*WorkflowExecutionInfo, error) { result := &sqlblobs.WorkflowExecutionInfo{} if err := thriftRWDecode(data, result); err != nil { return nil, err } - return result, nil + return workflowExecutionInfoFromThrift(result), nil } -func (d *thriftDecoder) activityInfoFromBlob(data []byte) (*sqlblobs.ActivityInfo, error) { +func (d *thriftDecoder) activityInfoFromBlob(data []byte) (*ActivityInfo, error) { result := &sqlblobs.ActivityInfo{} if err := thriftRWDecode(data, result); err != nil { return nil, err } - return result, nil + return activityInfoFromThrift(result), nil } -func (d *thriftDecoder) childExecutionInfoFromBlob(data []byte) (*sqlblobs.ChildExecutionInfo, error) { +func (d *thriftDecoder) childExecutionInfoFromBlob(data []byte) (*ChildExecutionInfo, error) { result := &sqlblobs.ChildExecutionInfo{} if err := thriftRWDecode(data, result); err != nil { return nil, err } - return result, nil + return childExecutionInfoFromThrift(result), nil } -func (d *thriftDecoder) signalInfoFromBlob(data []byte) (*sqlblobs.SignalInfo, error) { +func (d *thriftDecoder) signalInfoFromBlob(data []byte) (*SignalInfo, error) { result := &sqlblobs.SignalInfo{} if err := thriftRWDecode(data, result); err != nil { return nil, err } - return result, nil + return signalInfoFromThrift(result), nil } -func (d *thriftDecoder) requestCancelInfoFromBlob(data []byte) (*sqlblobs.RequestCancelInfo, error) { +func (d *thriftDecoder) requestCancelInfoFromBlob(data []byte) (*RequestCancelInfo, error) { result := &sqlblobs.RequestCancelInfo{} if err := thriftRWDecode(data, result); err != nil { return nil, err } - return result, nil + return requestCancelInfoFromThrift(result), nil } -func (d *thriftDecoder) timerInfoFromBlob(data []byte) (*sqlblobs.TimerInfo, error) { +func (d *thriftDecoder) timerInfoFromBlob(data []byte) (*TimerInfo, error) { result := &sqlblobs.TimerInfo{} if err := thriftRWDecode(data, result); err != nil { return nil, err } - return result, nil + return timerInfoFromThrift(result), nil } -func (d *thriftDecoder) taskInfoFromBlob(data []byte) (*sqlblobs.TaskInfo, error) { +func (d *thriftDecoder) taskInfoFromBlob(data []byte) (*TaskInfo, error) { result := &sqlblobs.TaskInfo{} if err := thriftRWDecode(data, result); err != nil { return nil, err } - return result, nil + return taskInfoFromThrift(result), nil } -func (d *thriftDecoder) taskListInfoFromBlob(data []byte) (*sqlblobs.TaskListInfo, error) { +func (d *thriftDecoder) taskListInfoFromBlob(data []byte) (*TaskListInfo, error) { result := &sqlblobs.TaskListInfo{} if err := thriftRWDecode(data, result); err != nil { return nil, err } - return result, nil + return taskListInfoFromThrift(result), nil } -func (d *thriftDecoder) transferTaskInfoFromBlob(data []byte) (*sqlblobs.TransferTaskInfo, error) { +func (d *thriftDecoder) transferTaskInfoFromBlob(data []byte) (*TransferTaskInfo, error) { result := &sqlblobs.TransferTaskInfo{} if err := thriftRWDecode(data, result); err != nil { return nil, err } - return result, nil + return transferTaskInfoFromThrift(result), nil } -func (d *thriftDecoder) timerTaskInfoFromBlob(data []byte) (*sqlblobs.TimerTaskInfo, error) { +func (d *thriftDecoder) timerTaskInfoFromBlob(data []byte) (*TimerTaskInfo, error) { result := &sqlblobs.TimerTaskInfo{} if err := thriftRWDecode(data, result); err != nil { return nil, err } - return result, nil + return timerTaskInfoFromThrift(result), nil } -func (d *thriftDecoder) replicationTaskInfoFromBlob(data []byte) (*sqlblobs.ReplicationTaskInfo, error) { +func (d *thriftDecoder) replicationTaskInfoFromBlob(data []byte) (*ReplicationTaskInfo, error) { result := &sqlblobs.ReplicationTaskInfo{} if err := thriftRWDecode(data, result); err != nil { return nil, err } - return result, nil + return replicationTaskInfoFromThrift(result), nil } func thriftRWDecode(b []byte, result thriftRWType) error { diff --git a/common/persistence/serialization/thrift_encoder.go b/common/persistence/serialization/thrift_encoder.go index 463f19c50a1..f455f747710 100644 --- a/common/persistence/serialization/thrift_encoder.go +++ b/common/persistence/serialization/thrift_encoder.go @@ -27,7 +27,6 @@ import ( "go.uber.org/thriftrw/protocol" - "github.com/uber/cadence/.gen/go/sqlblobs" "github.com/uber/cadence/common" ) @@ -37,60 +36,60 @@ func newThriftEncoder() encoder { return &thriftEncoder{} } -func (e *thriftEncoder) shardInfoToBlob(info *sqlblobs.ShardInfo) ([]byte, error) { - return thriftRWEncode(info) +func (e *thriftEncoder) shardInfoToBlob(info *ShardInfo) ([]byte, error) { + return thriftRWEncode(shardInfoToThrift(info)) } -func (e *thriftEncoder) domainInfoToBlob(info *sqlblobs.DomainInfo) ([]byte, error) { - return thriftRWEncode(info) +func (e *thriftEncoder) domainInfoToBlob(info *DomainInfo) ([]byte, error) { + return thriftRWEncode(domainInfoToThrift(info)) } -func (e *thriftEncoder) historyTreeInfoToBlob(info *sqlblobs.HistoryTreeInfo) ([]byte, error) { - return thriftRWEncode(info) +func (e *thriftEncoder) historyTreeInfoToBlob(info *HistoryTreeInfo) ([]byte, error) { + return thriftRWEncode(historyTreeInfoToThrift(info)) } -func (e *thriftEncoder) workflowExecutionInfoToBlob(info *sqlblobs.WorkflowExecutionInfo) ([]byte, error) { - return thriftRWEncode(info) +func (e *thriftEncoder) workflowExecutionInfoToBlob(info *WorkflowExecutionInfo) ([]byte, error) { + return thriftRWEncode(workflowExecutionInfoToThrift(info)) } -func (e *thriftEncoder) activityInfoToBlob(info *sqlblobs.ActivityInfo) ([]byte, error) { - return thriftRWEncode(info) +func (e *thriftEncoder) activityInfoToBlob(info *ActivityInfo) ([]byte, error) { + return thriftRWEncode(activityInfoToThrift(info)) } -func (e *thriftEncoder) childExecutionInfoToBlob(info *sqlblobs.ChildExecutionInfo) ([]byte, error) { - return thriftRWEncode(info) +func (e *thriftEncoder) childExecutionInfoToBlob(info *ChildExecutionInfo) ([]byte, error) { + return thriftRWEncode(childExecutionInfoToThrift(info)) } -func (e *thriftEncoder) signalInfoToBlob(info *sqlblobs.SignalInfo) ([]byte, error) { - return thriftRWEncode(info) +func (e *thriftEncoder) signalInfoToBlob(info *SignalInfo) ([]byte, error) { + return thriftRWEncode(signalInfoToThrift(info)) } -func (e *thriftEncoder) requestCancelInfoToBlob(info *sqlblobs.RequestCancelInfo) ([]byte, error) { - return thriftRWEncode(info) +func (e *thriftEncoder) requestCancelInfoToBlob(info *RequestCancelInfo) ([]byte, error) { + return thriftRWEncode(requestCancelInfoToThrift(info)) } -func (e *thriftEncoder) timerInfoToBlob(info *sqlblobs.TimerInfo) ([]byte, error) { - return thriftRWEncode(info) +func (e *thriftEncoder) timerInfoToBlob(info *TimerInfo) ([]byte, error) { + return thriftRWEncode(timerInfoToThrift(info)) } -func (e *thriftEncoder) taskInfoToBlob(info *sqlblobs.TaskInfo) ([]byte, error) { - return thriftRWEncode(info) +func (e *thriftEncoder) taskInfoToBlob(info *TaskInfo) ([]byte, error) { + return thriftRWEncode(taskInfoToThrift(info)) } -func (e *thriftEncoder) taskListInfoToBlob(info *sqlblobs.TaskListInfo) ([]byte, error) { - return thriftRWEncode(info) +func (e *thriftEncoder) taskListInfoToBlob(info *TaskListInfo) ([]byte, error) { + return thriftRWEncode(taskListInfoToThrift(info)) } -func (e *thriftEncoder) transferTaskInfoToBlob(info *sqlblobs.TransferTaskInfo) ([]byte, error) { - return thriftRWEncode(info) +func (e *thriftEncoder) transferTaskInfoToBlob(info *TransferTaskInfo) ([]byte, error) { + return thriftRWEncode(transferTaskInfoToThrift(info)) } -func (e *thriftEncoder) timerTaskInfoToBlob(info *sqlblobs.TimerTaskInfo) ([]byte, error) { - return thriftRWEncode(info) +func (e *thriftEncoder) timerTaskInfoToBlob(info *TimerTaskInfo) ([]byte, error) { + return thriftRWEncode(timerTaskInfoToThrift(info)) } -func (e *thriftEncoder) replicationTaskInfoToBlob(info *sqlblobs.ReplicationTaskInfo) ([]byte, error) { - return thriftRWEncode(info) +func (e *thriftEncoder) replicationTaskInfoToBlob(info *ReplicationTaskInfo) ([]byte, error) { + return thriftRWEncode(replicationTaskInfoToThrift(info)) } func (e *thriftEncoder) encodingType() common.EncodingType { diff --git a/common/persistence/serialization/thrift_mapper.go b/common/persistence/serialization/thrift_mapper.go index acc60f2ec0a..762a3772224 100644 --- a/common/persistence/serialization/thrift_mapper.go +++ b/common/persistence/serialization/thrift_mapper.go @@ -28,6 +28,7 @@ import ( "github.com/uber/cadence/.gen/go/shared" "github.com/uber/cadence/.gen/go/sqlblobs" "github.com/uber/cadence/common" + "github.com/uber/cadence/common/types" ) func shardInfoToThrift(info *ShardInfo) *sqlblobs.ShardInfo { @@ -187,9 +188,9 @@ func historyTreeInfoFromThrift(info *sqlblobs.HistoryTreeInfo) *HistoryTreeInfo Info: info.Info, } if info.Ancestors != nil { - result.Ancestors = make([]*HistoryBranchRange, len(info.Ancestors), len(info.Ancestors)) + result.Ancestors = make([]*types.HistoryBranchRange, len(info.Ancestors), len(info.Ancestors)) for i, a := range info.Ancestors { - result.Ancestors[i] = &HistoryBranchRange{ + result.Ancestors[i] = &types.HistoryBranchRange{ BranchID: a.BranchID, BeginNodeID: a.BeginNodeID, EndNodeID: a.EndNodeID, @@ -204,9 +205,9 @@ func workflowExecutionInfoToThrift(info *WorkflowExecutionInfo) *sqlblobs.Workfl return nil } return &sqlblobs.WorkflowExecutionInfo{ - ParentDomainID: MustParsePtrUUID(info.ParentDomainID), + ParentDomainID: info.ParentDomainID, ParentWorkflowID: info.ParentWorkflowID, - ParentRunID: MustParsePtrUUID(info.ParentRunID), + ParentRunID: info.ParentRunID, InitiatedID: info.InitiatedID, CompletionEventBatchID: info.CompletionEventBatchID, CompletionEvent: info.CompletionEvent, @@ -270,9 +271,9 @@ func workflowExecutionInfoFromThrift(info *sqlblobs.WorkflowExecutionInfo) *Work return nil } return &WorkflowExecutionInfo{ - ParentDomainID: common.StringPtr(UUID(info.ParentDomainID).String()), + ParentDomainID: info.ParentDomainID, ParentWorkflowID: info.ParentWorkflowID, - ParentRunID: common.StringPtr(UUID(info.ParentRunID).String()), + ParentRunID: info.ParentRunID, InitiatedID: info.InitiatedID, CompletionEventBatchID: info.CompletionEventBatchID, CompletionEvent: info.CompletionEvent, @@ -420,7 +421,7 @@ func childExecutionInfoToThrift(info *ChildExecutionInfo) *sqlblobs.ChildExecuti InitiatedEvent: info.InitiatedEvent, InitiatedEventEncoding: info.InitiatedEventEncoding, StartedWorkflowID: info.StartedWorkflowID, - StartedRunID: MustParsePtrUUID(info.StartedRunID), + StartedRunID: info.StartedRunID, StartedEvent: info.StartedEvent, StartedEventEncoding: info.StartedEventEncoding, CreateRequestID: info.CreateRequestID, @@ -441,7 +442,7 @@ func childExecutionInfoFromThrift(info *sqlblobs.ChildExecutionInfo) *ChildExecu InitiatedEvent: info.InitiatedEvent, InitiatedEventEncoding: info.InitiatedEventEncoding, StartedWorkflowID: info.StartedWorkflowID, - StartedRunID: common.StringPtr(UUID(info.StartedRunID).String()), + StartedRunID: info.StartedRunID, StartedEvent: info.StartedEvent, StartedEventEncoding: info.StartedEventEncoding, CreateRequestID: info.CreateRequestID, @@ -531,7 +532,7 @@ func taskInfoToThrift(info *TaskInfo) *sqlblobs.TaskInfo { } return &sqlblobs.TaskInfo{ WorkflowID: info.WorkflowID, - RunID: MustParsePtrUUID(info.RunID), + RunID: info.RunID, ScheduleID: info.ScheduleID, ExpiryTimeNanos: unixNanoPtr(info.ExpiryTimestamp), CreatedTimeNanos: unixNanoPtr(info.CreatedTimestamp), @@ -544,7 +545,7 @@ func taskInfoFromThrift(info *sqlblobs.TaskInfo) *TaskInfo { } return &TaskInfo{ WorkflowID: info.WorkflowID, - RunID: common.StringPtr(UUID(info.RunID).String()), + RunID: info.RunID, ScheduleID: info.ScheduleID, ExpiryTimestamp: timePtr(info.ExpiryTimeNanos), CreatedTimestamp: timePtr(info.CreatedTimeNanos), @@ -580,13 +581,13 @@ func transferTaskInfoToThrift(info *TransferTaskInfo) *sqlblobs.TransferTaskInfo return nil } return &sqlblobs.TransferTaskInfo{ - DomainID: MustParsePtrUUID(info.DomainID), + DomainID: info.DomainID, WorkflowID: info.WorkflowID, - RunID: MustParsePtrUUID(info.RunID), + RunID: info.RunID, TaskType: info.TaskType, - TargetDomainID: MustParsePtrUUID(info.TargetDomainID), + TargetDomainID: info.TargetDomainID, TargetWorkflowID: info.TargetWorkflowID, - TargetRunID: MustParsePtrUUID(info.TargetRunID), + TargetRunID: info.TargetRunID, TaskList: info.TaskList, TargetChildWorkflowOnly: info.TargetChildWorkflowOnly, ScheduleID: info.ScheduleID, @@ -600,13 +601,13 @@ func transferTaskInfoFromThrift(info *sqlblobs.TransferTaskInfo) *TransferTaskIn return nil } return &TransferTaskInfo{ - DomainID: common.StringPtr(UUID(info.DomainID).String()), + DomainID: info.DomainID, WorkflowID: info.WorkflowID, - RunID: common.StringPtr(UUID(info.RunID).String()), + RunID: info.RunID, TaskType: info.TaskType, - TargetDomainID: common.StringPtr(UUID(info.TargetDomainID).String()), + TargetDomainID: info.TargetDomainID, TargetWorkflowID: info.TargetWorkflowID, - TargetRunID: common.StringPtr(UUID(info.TargetRunID).String()), + TargetRunID: info.TargetRunID, TaskList: info.TaskList, TargetChildWorkflowOnly: info.TargetChildWorkflowOnly, ScheduleID: info.ScheduleID, @@ -620,9 +621,9 @@ func timerTaskInfoToThrift(info *TimerTaskInfo) *sqlblobs.TimerTaskInfo { return nil } return &sqlblobs.TimerTaskInfo{ - DomainID: MustParsePtrUUID(info.DomainID), + DomainID: info.DomainID, WorkflowID: info.WorkflowID, - RunID: MustParsePtrUUID(info.RunID), + RunID: info.RunID, TaskType: info.TaskType, TimeoutType: info.TimeoutType, Version: info.Version, @@ -636,9 +637,9 @@ func timerTaskInfoFromThrift(info *sqlblobs.TimerTaskInfo) *TimerTaskInfo { return nil } return &TimerTaskInfo{ - DomainID: common.StringPtr(UUID(info.DomainID).String()), + DomainID: info.DomainID, WorkflowID: info.WorkflowID, - RunID: common.StringPtr(UUID(info.RunID).String()), + RunID: info.RunID, TaskType: info.TaskType, TimeoutType: info.TimeoutType, Version: info.Version, @@ -652,9 +653,9 @@ func replicationTaskInfoToThrift(info *ReplicationTaskInfo) *sqlblobs.Replicatio return nil } return &sqlblobs.ReplicationTaskInfo{ - DomainID: MustParsePtrUUID(info.DomainID), + DomainID: info.DomainID, WorkflowID: info.WorkflowID, - RunID: MustParsePtrUUID(info.RunID), + RunID: info.RunID, TaskType: info.TaskType, Version: info.Version, FirstEventID: info.FirstEventID, @@ -673,9 +674,9 @@ func replicationTaskInfoFromThrift(info *sqlblobs.ReplicationTaskInfo) *Replicat return nil } return &ReplicationTaskInfo{ - DomainID: common.StringPtr(UUID(info.DomainID).String()), + DomainID: info.DomainID, WorkflowID: info.WorkflowID, - RunID: common.StringPtr(UUID(info.RunID).String()), + RunID: info.RunID, TaskType: info.TaskType, Version: info.Version, FirstEventID: info.FirstEventID, diff --git a/common/persistence/serialization/thrift_mapper_test.go b/common/persistence/serialization/thrift_mapper_test.go index 8e74fd20425..527df26fd60 100644 --- a/common/persistence/serialization/thrift_mapper_test.go +++ b/common/persistence/serialization/thrift_mapper_test.go @@ -27,6 +27,8 @@ import ( "testing" "time" + "github.com/uber/cadence/common/types" + "github.com/pborman/uuid" "github.com/stretchr/testify/assert" @@ -133,7 +135,7 @@ func TestDomainInfo(t *testing.T) { func TestHistoryTreeInfo(t *testing.T) { expected := &HistoryTreeInfo{ CreatedTimestamp: common.TimePtr(time.Now()), - Ancestors: []*HistoryBranchRange{ + Ancestors: []*types.HistoryBranchRange{ { BranchID: common.StringPtr("branch_id"), BeginNodeID: common.Int64Ptr(int64(rand.Intn(1000))), @@ -155,9 +157,9 @@ func TestHistoryTreeInfo(t *testing.T) { func TestWorkflowExecutionInfo(t *testing.T) { expected := &WorkflowExecutionInfo{ - ParentDomainID: common.StringPtr(uuid.New()), + ParentDomainID: UUID(uuid.New()), ParentWorkflowID: common.StringPtr("ParentWorkflowID"), - ParentRunID: common.StringPtr(uuid.New()), + ParentRunID: UUID(uuid.New()), InitiatedID: common.Int64Ptr(int64(rand.Intn(1000))), CompletionEventBatchID: common.Int64Ptr(int64(rand.Intn(1000))), CompletionEvent: []byte("CompletionEvent"), @@ -350,7 +352,7 @@ func TestChildExecutionInfo(t *testing.T) { InitiatedEvent: []byte("InitiatedEvent"), InitiatedEventEncoding: common.StringPtr("InitiatedEventEncoding"), StartedWorkflowID: common.StringPtr("InitiatedEventEncoding"), - StartedRunID: common.StringPtr(uuid.New()), + StartedRunID: UUID(uuid.New()), StartedEvent: []byte("StartedEvent"), StartedEventEncoding: common.StringPtr("StartedEventEncoding"), CreateRequestID: common.StringPtr("CreateRequestID"), @@ -402,7 +404,7 @@ func TestTimerInfo(t *testing.T) { func TestTaskInfo(t *testing.T) { expected := &TaskInfo{ WorkflowID: common.StringPtr("WorkflowID"), - RunID: common.StringPtr(uuid.New()), + RunID: UUID(uuid.New()), ScheduleID: common.Int64Ptr(int64(rand.Intn(1000))), ExpiryTimestamp: common.TimePtr(time.Now()), CreatedTimestamp: common.TimePtr(time.Now()), @@ -431,13 +433,13 @@ func TestTaskListInfo(t *testing.T) { func TestTransferTaskInfo(t *testing.T) { expected := &TransferTaskInfo{ - DomainID: common.StringPtr(uuid.New()), + DomainID: UUID(uuid.New()), WorkflowID: common.StringPtr("WorkflowID"), - RunID: common.StringPtr(uuid.New()), + RunID: UUID(uuid.New()), TaskType: common.Int16Ptr(int16(rand.Intn(1000))), - TargetDomainID: common.StringPtr(uuid.New()), + TargetDomainID: UUID(uuid.New()), TargetWorkflowID: common.StringPtr("TargetWorkflowID"), - TargetRunID: common.StringPtr(uuid.New()), + TargetRunID: UUID(uuid.New()), TaskList: common.StringPtr("TaskList"), TargetChildWorkflowOnly: common.BoolPtr(true), ScheduleID: common.Int64Ptr(int64(rand.Intn(1000))), @@ -449,9 +451,9 @@ func TestTransferTaskInfo(t *testing.T) { func TestTimerTaskInfo(t *testing.T) { expected := &TimerTaskInfo{ - DomainID: common.StringPtr(uuid.New()), + DomainID: UUID(uuid.New()), WorkflowID: common.StringPtr("WorkflowID"), - RunID: common.StringPtr(uuid.New()), + RunID: UUID(uuid.New()), TaskType: common.Int16Ptr(int16(rand.Intn(1000))), TimeoutType: common.Int16Ptr(int16(rand.Intn(1000))), Version: common.Int64Ptr(int64(rand.Intn(1000))), @@ -464,9 +466,9 @@ func TestTimerTaskInfo(t *testing.T) { func TestReplicationTaskInfo(t *testing.T) { expected := &ReplicationTaskInfo{ - DomainID: common.StringPtr(uuid.New()), + DomainID: UUID(uuid.New()), WorkflowID: common.StringPtr("WorkflowID"), - RunID: common.StringPtr(uuid.New()), + RunID: UUID(uuid.New()), TaskType: common.Int16Ptr(int16(rand.Intn(1000))), Version: common.Int64Ptr(int64(rand.Intn(1000))), FirstEventID: common.Int64Ptr(int64(rand.Intn(1000))), diff --git a/common/persistence/sql/sqlExecutionManager.go b/common/persistence/sql/sqlExecutionManager.go index 14ef68bb100..54592110b8a 100644 --- a/common/persistence/sql/sqlExecutionManager.go +++ b/common/persistence/sql/sqlExecutionManager.go @@ -29,7 +29,6 @@ import ( "math" "time" - "github.com/uber/cadence/.gen/go/sqlblobs" "github.com/uber/cadence/common" "github.com/uber/cadence/common/collection" "github.com/uber/cadence/common/log" @@ -879,13 +878,13 @@ func (m *sqlExecutionManager) GetTransferTasks( } resp.Tasks[i] = &p.TransferTaskInfo{ TaskID: row.TaskID, - DomainID: serialization.UUID(info.DomainID).String(), + DomainID: info.DomainID.String(), WorkflowID: info.GetWorkflowID(), - RunID: serialization.UUID(info.RunID).String(), - VisibilityTimestamp: time.Unix(0, info.GetVisibilityTimestampNanos()), - TargetDomainID: serialization.UUID(info.TargetDomainID).String(), + RunID: info.RunID.String(), + VisibilityTimestamp: info.GetVisibilityTimestamp(), + TargetDomainID: info.TargetDomainID.String(), TargetWorkflowID: info.GetTargetWorkflowID(), - TargetRunID: serialization.UUID(info.TargetRunID).String(), + TargetRunID: info.TargetRunID.String(), TargetChildWorkflowOnly: info.GetTargetChildWorkflowOnly(), TaskList: info.GetTaskList(), TaskType: int(info.GetTaskType()), @@ -989,9 +988,9 @@ func (m *sqlExecutionManager) populateGetReplicationTasksResponse( tasks[i] = &p.InternalReplicationTaskInfo{ TaskID: row.TaskID, - DomainID: serialization.UUID(info.DomainID).String(), + DomainID: info.DomainID.String(), WorkflowID: info.GetWorkflowID(), - RunID: serialization.UUID(info.RunID).String(), + RunID: info.RunID.String(), TaskType: int(info.GetTaskType()), FirstEventID: info.GetFirstEventID(), NextEventID: info.GetNextEventID(), @@ -999,7 +998,7 @@ func (m *sqlExecutionManager) populateGetReplicationTasksResponse( ScheduledID: info.GetScheduledID(), BranchToken: info.GetBranchToken(), NewRunBranchToken: info.GetNewRunBranchToken(), - CreationTime: time.Unix(0, info.GetCreationTime()), + CreationTime: info.GetCreationTimestamp(), } } var nextPageToken []byte @@ -1225,9 +1224,9 @@ func (m *sqlExecutionManager) GetTimerIndexTasks( resp.Timers[i] = &p.TimerTaskInfo{ VisibilityTimestamp: row.VisibilityTimestamp, TaskID: row.TaskID, - DomainID: serialization.UUID(info.DomainID).String(), + DomainID: info.DomainID.String(), WorkflowID: info.GetWorkflowID(), - RunID: serialization.UUID(info.RunID).String(), + RunID: info.RunID.String(), TaskType: int(info.GetTaskType()), TimeoutType: int(info.GetTimeoutType()), EventID: info.GetEventID(), @@ -1295,7 +1294,7 @@ func (m *sqlExecutionManager) PutReplicationTaskToDLQ( request *p.InternalPutReplicationTaskToDLQRequest, ) error { replicationTask := request.TaskInfo - blob, err := m.parser.ReplicationTaskInfoToBlob(&sqlblobs.ReplicationTaskInfo{ + blob, err := m.parser.ReplicationTaskInfoToBlob(&serialization.ReplicationTaskInfo{ DomainID: serialization.MustParseUUID(replicationTask.DomainID), WorkflowID: &replicationTask.WorkflowID, RunID: serialization.MustParseUUID(replicationTask.RunID), @@ -1349,26 +1348,26 @@ func (m *sqlExecutionManager) populateWorkflowMutableState( NextEventID: execution.NextEventID, TaskList: info.GetTaskList(), WorkflowTypeName: info.GetWorkflowTypeName(), - WorkflowTimeout: common.SecondsToDuration(int64(info.GetWorkflowTimeoutSeconds())), - DecisionStartToCloseTimeout: common.SecondsToDuration(int64(info.GetDecisionTaskTimeoutSeconds())), + WorkflowTimeout: info.GetWorkflowTimeout(), + DecisionStartToCloseTimeout: info.GetDecisionTaskTimeout(), State: int(info.GetState()), CloseStatus: int(info.GetCloseStatus()), LastFirstEventID: info.GetLastFirstEventID(), LastProcessedEvent: info.GetLastProcessedEvent(), - StartTimestamp: time.Unix(0, info.GetStartTimeNanos()), - LastUpdatedTimestamp: time.Unix(0, info.GetLastUpdatedTimeNanos()), + StartTimestamp: info.GetStartTimestamp(), + LastUpdatedTimestamp: info.GetLastUpdatedTimestamp(), CreateRequestID: info.GetCreateRequestID(), DecisionVersion: info.GetDecisionVersion(), DecisionScheduleID: info.GetDecisionScheduleID(), DecisionStartedID: info.GetDecisionStartedID(), DecisionRequestID: info.GetDecisionRequestID(), - DecisionTimeout: common.SecondsToDuration(int64(info.GetDecisionTimeout())), + DecisionTimeout: info.GetDecisionTimeout(), DecisionAttempt: info.GetDecisionAttempt(), - DecisionStartedTimestamp: time.Unix(0, info.GetDecisionStartedTimestampNanos()), - DecisionScheduledTimestamp: time.Unix(0, info.GetDecisionScheduledTimestampNanos()), - DecisionOriginalScheduledTimestamp: time.Unix(0, info.GetDecisionOriginalScheduledTimestampNanos()), + DecisionStartedTimestamp: info.GetDecisionStartedTimestamp(), + DecisionScheduledTimestamp: info.GetDecisionScheduledTimestamp(), + DecisionOriginalScheduledTimestamp: info.GetDecisionOriginalScheduledTimestamp(), StickyTaskList: info.GetStickyTaskList(), - StickyScheduleToStartTimeout: common.SecondsToDuration(info.GetStickyScheduleToStartTimeout()), + StickyScheduleToStartTimeout: info.GetStickyScheduleToStartTimeout(), ClientLibraryVersion: info.GetClientLibraryVersion(), ClientFeatureVersion: info.GetClientFeatureVersion(), ClientImpl: info.GetClientImpl(), @@ -1378,12 +1377,12 @@ func (m *sqlExecutionManager) populateWorkflowMutableState( CompletionEventBatchID: common.EmptyEventID, HasRetryPolicy: info.GetHasRetryPolicy(), Attempt: int32(info.GetRetryAttempt()), - InitialInterval: common.SecondsToDuration(int64(info.GetRetryInitialIntervalSeconds())), + InitialInterval: info.GetRetryInitialInterval(), BackoffCoefficient: info.GetRetryBackoffCoefficient(), - MaximumInterval: common.SecondsToDuration(int64(info.GetRetryMaximumIntervalSeconds())), + MaximumInterval: info.GetRetryMaximumInterval(), MaximumAttempts: info.GetRetryMaximumAttempts(), - ExpirationSeconds: common.SecondsToDuration(int64(info.GetRetryExpirationSeconds())), - ExpirationTime: time.Unix(0, info.GetRetryExpirationTimeNanos()), + ExpirationSeconds: info.GetRetryExpiration(), + ExpirationTime: info.GetRetryExpirationTimestamp(), BranchToken: info.GetEventBranchToken(), ExecutionContext: info.GetExecutionContext(), NonRetriableErrors: info.GetRetryNonRetryableErrors(), @@ -1407,9 +1406,9 @@ func (m *sqlExecutionManager) populateWorkflowMutableState( } if info.ParentDomainID != nil { - state.ExecutionInfo.ParentDomainID = serialization.UUID(info.ParentDomainID).String() + state.ExecutionInfo.ParentDomainID = info.ParentDomainID.String() state.ExecutionInfo.ParentWorkflowID = info.GetParentWorkflowID() - state.ExecutionInfo.ParentRunID = serialization.UUID(info.ParentRunID).String() + state.ExecutionInfo.ParentRunID = info.ParentRunID.String() state.ExecutionInfo.InitiatedID = info.GetInitiatedID() if state.ExecutionInfo.CompletionEvent != nil { state.ExecutionInfo.CompletionEvent = nil diff --git a/common/persistence/sql/sqlExecutionManagerUtil.go b/common/persistence/sql/sqlExecutionManagerUtil.go index dda7514dac4..8966ccce577 100644 --- a/common/persistence/sql/sqlExecutionManagerUtil.go +++ b/common/persistence/sql/sqlExecutionManagerUtil.go @@ -30,7 +30,6 @@ import ( "github.com/uber/cadence/common/persistence/serialization" - "github.com/uber/cadence/.gen/go/sqlblobs" "github.com/uber/cadence/common" p "github.com/uber/cadence/common/persistence" "github.com/uber/cadence/common/persistence/sql/sqlplugin" @@ -853,7 +852,7 @@ func createTransferTasks( transferTasksRows := make([]sqlplugin.TransferTasksRow, len(transferTasks)) for i, task := range transferTasks { - info := &sqlblobs.TransferTaskInfo{ + info := &serialization.TransferTaskInfo{ DomainID: domainID, WorkflowID: &workflowID, RunID: runID, @@ -913,7 +912,7 @@ func createTransferTasks( info.TaskType = common.Int16Ptr(int16(task.GetType())) info.Version = common.Int64Ptr(task.GetVersion()) - info.VisibilityTimestampNanos = common.Int64Ptr(task.GetVisibilityTimestamp().UnixNano()) + info.VisibilityTimestamp = common.TimePtr(task.GetVisibilityTimestamp()) blob, err := parser.TransferTaskInfoToBlob(info) if err != nil { @@ -997,7 +996,7 @@ func createReplicationTasks( } } - blob, err := parser.ReplicationTaskInfoToBlob(&sqlblobs.ReplicationTaskInfo{ + blob, err := parser.ReplicationTaskInfoToBlob(&serialization.ReplicationTaskInfo{ DomainID: domainID, WorkflowID: &workflowID, RunID: runID, @@ -1010,7 +1009,7 @@ func createReplicationTasks( NewRunEventStoreVersion: common.Int32Ptr(p.EventStoreVersion), BranchToken: branchToken, NewRunBranchToken: newRunBranchToken, - CreationTime: common.Int64Ptr(task.GetVisibilityTimestamp().UnixNano()), + CreationTimestamp: common.TimePtr(task.GetVisibilityTimestamp()), }) if err != nil { return err @@ -1062,7 +1061,7 @@ func createTimerTasks( timerTasksRows := make([]sqlplugin.TimerTasksRow, len(timerTasks)) for i, task := range timerTasks { - info := &sqlblobs.TimerTaskInfo{} + info := &serialization.TimerTaskInfo{} switch t := task.(type) { case *p.DecisionTimeoutTask: info.EventID = &t.EventID @@ -1329,53 +1328,53 @@ func buildExecutionRow( parser serialization.Parser, ) (row *sqlplugin.ExecutionsRow, err error) { - info := &sqlblobs.WorkflowExecutionInfo{ - TaskList: &executionInfo.TaskList, - WorkflowTypeName: &executionInfo.WorkflowTypeName, - WorkflowTimeoutSeconds: common.Int32Ptr(int32(executionInfo.WorkflowTimeout.Seconds())), - DecisionTaskTimeoutSeconds: common.Int32Ptr(int32(executionInfo.DecisionStartToCloseTimeout.Seconds())), - ExecutionContext: executionInfo.ExecutionContext, - State: common.Int32Ptr(int32(executionInfo.State)), - CloseStatus: common.Int32Ptr(int32(executionInfo.CloseStatus)), - LastFirstEventID: &executionInfo.LastFirstEventID, - LastEventTaskID: &executionInfo.LastEventTaskID, - LastProcessedEvent: &executionInfo.LastProcessedEvent, - StartTimeNanos: common.Int64Ptr(executionInfo.StartTimestamp.UnixNano()), - LastUpdatedTimeNanos: common.Int64Ptr(executionInfo.LastUpdatedTimestamp.UnixNano()), - CreateRequestID: &executionInfo.CreateRequestID, - DecisionVersion: &executionInfo.DecisionVersion, - DecisionScheduleID: &executionInfo.DecisionScheduleID, - DecisionStartedID: &executionInfo.DecisionStartedID, - DecisionRequestID: &executionInfo.DecisionRequestID, - DecisionTimeout: common.Int32Ptr(int32(executionInfo.DecisionTimeout.Seconds())), - DecisionAttempt: &executionInfo.DecisionAttempt, - DecisionStartedTimestampNanos: common.Int64Ptr(executionInfo.DecisionStartedTimestamp.UnixNano()), - DecisionScheduledTimestampNanos: common.Int64Ptr(executionInfo.DecisionScheduledTimestamp.UnixNano()), - DecisionOriginalScheduledTimestampNanos: common.Int64Ptr(executionInfo.DecisionOriginalScheduledTimestamp.UnixNano()), - StickyTaskList: &executionInfo.StickyTaskList, - StickyScheduleToStartTimeout: common.Int64Ptr(int64(executionInfo.StickyScheduleToStartTimeout.Seconds())), - ClientLibraryVersion: &executionInfo.ClientLibraryVersion, - ClientFeatureVersion: &executionInfo.ClientFeatureVersion, - ClientImpl: &executionInfo.ClientImpl, - SignalCount: common.Int64Ptr(int64(executionInfo.SignalCount)), - HistorySize: &executionInfo.HistorySize, - CronSchedule: &executionInfo.CronSchedule, - CompletionEventBatchID: &executionInfo.CompletionEventBatchID, - HasRetryPolicy: &executionInfo.HasRetryPolicy, - RetryAttempt: common.Int64Ptr(int64(executionInfo.Attempt)), - RetryInitialIntervalSeconds: common.Int32Ptr(int32(executionInfo.InitialInterval.Seconds())), - RetryBackoffCoefficient: &executionInfo.BackoffCoefficient, - RetryMaximumIntervalSeconds: common.Int32Ptr(int32(executionInfo.MaximumInterval.Seconds())), - RetryMaximumAttempts: &executionInfo.MaximumAttempts, - RetryExpirationSeconds: common.Int32Ptr(int32(executionInfo.ExpirationSeconds.Seconds())), - RetryExpirationTimeNanos: common.Int64Ptr(executionInfo.ExpirationTime.UnixNano()), - RetryNonRetryableErrors: executionInfo.NonRetriableErrors, - EventStoreVersion: common.Int32Ptr(p.EventStoreVersion), - EventBranchToken: executionInfo.BranchToken, - AutoResetPoints: executionInfo.AutoResetPoints.Data, - AutoResetPointsEncoding: common.StringPtr(string(executionInfo.AutoResetPoints.GetEncoding())), - SearchAttributes: executionInfo.SearchAttributes, - Memo: executionInfo.Memo, + info := &serialization.WorkflowExecutionInfo{ + TaskList: &executionInfo.TaskList, + WorkflowTypeName: &executionInfo.WorkflowTypeName, + WorkflowTimeout: &executionInfo.WorkflowTimeout, + DecisionTaskTimeout: &executionInfo.DecisionStartToCloseTimeout, + ExecutionContext: executionInfo.ExecutionContext, + State: common.Int32Ptr(int32(executionInfo.State)), + CloseStatus: common.Int32Ptr(int32(executionInfo.CloseStatus)), + LastFirstEventID: &executionInfo.LastFirstEventID, + LastEventTaskID: &executionInfo.LastEventTaskID, + LastProcessedEvent: &executionInfo.LastProcessedEvent, + StartTimestamp: &executionInfo.StartTimestamp, + LastUpdatedTimestamp: &executionInfo.LastUpdatedTimestamp, + CreateRequestID: &executionInfo.CreateRequestID, + DecisionVersion: &executionInfo.DecisionVersion, + DecisionScheduleID: &executionInfo.DecisionScheduleID, + DecisionStartedID: &executionInfo.DecisionStartedID, + DecisionRequestID: &executionInfo.DecisionRequestID, + DecisionTimeout: &executionInfo.DecisionTimeout, + DecisionAttempt: &executionInfo.DecisionAttempt, + DecisionStartedTimestamp: &executionInfo.DecisionStartedTimestamp, + DecisionScheduledTimestamp: &executionInfo.DecisionScheduledTimestamp, + DecisionOriginalScheduledTimestamp: &executionInfo.DecisionOriginalScheduledTimestamp, + StickyTaskList: &executionInfo.StickyTaskList, + StickyScheduleToStartTimeout: &executionInfo.StickyScheduleToStartTimeout, + ClientLibraryVersion: &executionInfo.ClientLibraryVersion, + ClientFeatureVersion: &executionInfo.ClientFeatureVersion, + ClientImpl: &executionInfo.ClientImpl, + SignalCount: common.Int64Ptr(int64(executionInfo.SignalCount)), + HistorySize: &executionInfo.HistorySize, + CronSchedule: &executionInfo.CronSchedule, + CompletionEventBatchID: &executionInfo.CompletionEventBatchID, + HasRetryPolicy: &executionInfo.HasRetryPolicy, + RetryAttempt: common.Int64Ptr(int64(executionInfo.Attempt)), + RetryInitialInterval: &executionInfo.InitialInterval, + RetryBackoffCoefficient: &executionInfo.BackoffCoefficient, + RetryMaximumInterval: &executionInfo.MaximumInterval, + RetryMaximumAttempts: &executionInfo.MaximumAttempts, + RetryExpiration: &executionInfo.ExpirationSeconds, + RetryExpirationTimestamp: &executionInfo.ExpirationTime, + RetryNonRetryableErrors: executionInfo.NonRetriableErrors, + EventStoreVersion: common.Int32Ptr(p.EventStoreVersion), + EventBranchToken: executionInfo.BranchToken, + AutoResetPoints: executionInfo.AutoResetPoints.Data, + AutoResetPointsEncoding: common.StringPtr(string(executionInfo.AutoResetPoints.GetEncoding())), + SearchAttributes: executionInfo.SearchAttributes, + Memo: executionInfo.Memo, } completionEvent := executionInfo.CompletionEvent diff --git a/common/persistence/sql/sqlHistoryManager.go b/common/persistence/sql/sqlHistoryManager.go index 793d2310abf..9cabd9a9387 100644 --- a/common/persistence/sql/sqlHistoryManager.go +++ b/common/persistence/sql/sqlHistoryManager.go @@ -24,13 +24,11 @@ import ( "context" "database/sql" "fmt" - - "github.com/uber/cadence/common/types" - "github.com/uber/cadence/common/types/mapper/thrift" + "time" "github.com/uber/cadence/common/persistence/serialization" + "github.com/uber/cadence/common/types" - "github.com/uber/cadence/.gen/go/sqlblobs" "github.com/uber/cadence/common" "github.com/uber/cadence/common/log" p "github.com/uber/cadence/common/persistence" @@ -88,10 +86,10 @@ func (m *sqlHistoryV2Manager) AppendHistoryNodes( ancestors = append(ancestors, anc) } - treeInfo := &sqlblobs.HistoryTreeInfo{ - Ancestors: thrift.FromHistoryBranchRangeArray(ancestors), + treeInfo := &serialization.HistoryTreeInfo{ + Ancestors: ancestors, Info: &request.Info, - CreatedTimeNanos: common.TimeNowNanosPtr(), + CreatedTimestamp: common.TimePtr(time.Now()), } blob, err := m.parser.HistoryTreeInfoToBlob(treeInfo) @@ -329,10 +327,10 @@ func (m *sqlHistoryV2Manager) ForkHistoryBranch( Ancestors: newAncestors, }} - treeInfo := &sqlblobs.HistoryTreeInfo{ - Ancestors: thrift.FromHistoryBranchRangeArray(newAncestors), + treeInfo := &serialization.HistoryTreeInfo{ + Ancestors: newAncestors, Info: &request.Info, - CreatedTimeNanos: common.TimeNowNanosPtr(), + CreatedTimestamp: common.TimePtr(time.Now()), } blob, err := m.parser.HistoryTreeInfoToBlob(treeInfo) @@ -473,7 +471,7 @@ func (m *sqlHistoryV2Manager) GetHistoryTree( br := &types.HistoryBranch{ TreeID: &request.TreeID, BranchID: common.StringPtr(row.BranchID.String()), - Ancestors: thrift.ToHistoryBranchRangeArray(treeInfo.Ancestors), + Ancestors: treeInfo.Ancestors, } branches = append(branches, br) } diff --git a/common/persistence/sql/sqlMetadataManagerV2.go b/common/persistence/sql/sqlMetadataManagerV2.go index 5f45d704b05..1a20443a16c 100644 --- a/common/persistence/sql/sqlMetadataManagerV2.go +++ b/common/persistence/sql/sqlMetadataManagerV2.go @@ -24,9 +24,7 @@ import ( "context" "database/sql" "fmt" - "time" - "github.com/uber/cadence/.gen/go/sqlblobs" "github.com/uber/cadence/common" "github.com/uber/cadence/common/log" "github.com/uber/cadence/common/persistence" @@ -110,12 +108,12 @@ func (m *sqlMetadataManagerV2) CreateDomain( badBinariesEncoding = common.StringPtr(string(request.Config.BadBinaries.GetEncoding())) } - domainInfo := &sqlblobs.DomainInfo{ + domainInfo := &serialization.DomainInfo{ Status: common.Int32Ptr(int32(request.Info.Status)), Description: &request.Info.Description, Owner: &request.Info.OwnerEmail, Data: request.Info.Data, - RetentionDays: common.Int16Ptr(int16(common.DurationToDays(request.Config.Retention))), + Retention: &request.Config.Retention, EmitMetric: &request.Config.EmitMetric, ArchivalBucket: &request.Config.ArchivalBucket, ArchivalStatus: common.Int16Ptr(int16(request.Config.ArchivalStatus)), @@ -130,7 +128,7 @@ func (m *sqlMetadataManagerV2) CreateDomain( NotificationVersion: common.Int64Ptr(metadata.NotificationVersion), FailoverNotificationVersion: common.Int64Ptr(persistence.InitialFailoverNotificationVersion), PreviousFailoverVersion: common.Int64Ptr(common.InitialPreviousFailoverVersion), - LastUpdatedTime: common.Int64Ptr(request.LastUpdatedTime.UnixNano()), + LastUpdatedTimestamp: &request.LastUpdatedTime, BadBinaries: badBinaries, BadBinariesEncoding: badBinariesEncoding, } @@ -232,11 +230,6 @@ func (m *sqlMetadataManagerV2) domainRowToGetDomainResponse(row *sqlplugin.Domai badBinaries = persistence.NewDataBlob(domainInfo.BadBinaries, common.EncodingType(*domainInfo.BadBinariesEncoding)) } - var failoverEndTime *time.Time - if domainInfo.IsSetFailoverEndTime() { - failoverEndTime = common.TimePtr(time.Unix(0, *domainInfo.FailoverEndTime)) - } - return &persistence.InternalGetDomainResponse{ Info: &persistence.DomainInfo{ ID: row.ID.String(), @@ -247,7 +240,7 @@ func (m *sqlMetadataManagerV2) domainRowToGetDomainResponse(row *sqlplugin.Domai Data: domainInfo.GetData(), }, Config: &persistence.InternalDomainConfig{ - Retention: common.DaysToDuration(int32(domainInfo.GetRetentionDays())), + Retention: domainInfo.GetRetention(), EmitMetric: domainInfo.GetEmitMetric(), ArchivalBucket: domainInfo.GetArchivalBucket(), ArchivalStatus: types.ArchivalStatus(*domainInfo.ArchivalStatus), @@ -267,8 +260,8 @@ func (m *sqlMetadataManagerV2) domainRowToGetDomainResponse(row *sqlplugin.Domai NotificationVersion: domainInfo.GetNotificationVersion(), FailoverNotificationVersion: domainInfo.GetFailoverNotificationVersion(), PreviousFailoverVersion: domainInfo.GetPreviousFailoverVersion(), - FailoverEndTime: failoverEndTime, - LastUpdatedTime: time.Unix(0, domainInfo.GetLastUpdatedTime()), + FailoverEndTime: domainInfo.FailoverEndTimestamp, + LastUpdatedTime: domainInfo.GetLastUpdatedTimestamp(), }, nil } @@ -289,17 +282,12 @@ func (m *sqlMetadataManagerV2) UpdateDomain( badBinariesEncoding = common.StringPtr(string(request.Config.BadBinaries.GetEncoding())) } - var failoverEndTime *int64 - if request.FailoverEndTime != nil { - failoverEndTime = common.Int64Ptr(request.FailoverEndTime.UnixNano()) - } - - domainInfo := &sqlblobs.DomainInfo{ + domainInfo := &serialization.DomainInfo{ Status: common.Int32Ptr(int32(request.Info.Status)), Description: &request.Info.Description, Owner: &request.Info.OwnerEmail, Data: request.Info.Data, - RetentionDays: common.Int16Ptr(int16(common.DurationToDays(request.Config.Retention))), + Retention: &request.Config.Retention, EmitMetric: &request.Config.EmitMetric, ArchivalBucket: &request.Config.ArchivalBucket, ArchivalStatus: common.Int16Ptr(int16(request.Config.ArchivalStatus)), @@ -314,8 +302,8 @@ func (m *sqlMetadataManagerV2) UpdateDomain( NotificationVersion: common.Int64Ptr(request.NotificationVersion), FailoverNotificationVersion: common.Int64Ptr(request.FailoverNotificationVersion), PreviousFailoverVersion: common.Int64Ptr(request.PreviousFailoverVersion), - FailoverEndTime: failoverEndTime, - LastUpdatedTime: common.Int64Ptr(request.LastUpdatedTime.UnixNano()), + FailoverEndTimestamp: request.FailoverEndTime, + LastUpdatedTimestamp: &request.LastUpdatedTime, BadBinaries: badBinaries, BadBinariesEncoding: badBinariesEncoding, } diff --git a/common/persistence/sql/sqlShardManager.go b/common/persistence/sql/sqlShardManager.go index 9162a494296..87f0ffc14c1 100644 --- a/common/persistence/sql/sqlShardManager.go +++ b/common/persistence/sql/sqlShardManager.go @@ -28,7 +28,6 @@ import ( "github.com/uber/cadence/common/persistence/serialization" - "github.com/uber/cadence/.gen/go/sqlblobs" "github.com/uber/cadence/common" "github.com/uber/cadence/common/log" "github.com/uber/cadence/common/persistence" @@ -115,12 +114,12 @@ func (m *sqlShardManager) GetShard( timerAckLevel := make(map[string]time.Time, len(shardInfo.ClusterTimerAckLevel)) for k, v := range shardInfo.ClusterTimerAckLevel { - timerAckLevel[k] = time.Unix(0, v) + timerAckLevel[k] = v } if len(timerAckLevel) == 0 { timerAckLevel = map[string]time.Time{ - m.currentClusterName: time.Unix(0, shardInfo.GetTimerAckLevelNanos()), + m.currentClusterName: shardInfo.GetTimerAckLevel(), } } @@ -152,10 +151,10 @@ func (m *sqlShardManager) GetShard( RangeID: row.RangeID, Owner: shardInfo.GetOwner(), StolenSinceRenew: int(shardInfo.GetStolenSinceRenew()), - UpdatedAt: time.Unix(0, shardInfo.GetUpdatedAtNanos()), + UpdatedAt: shardInfo.GetUpdatedAt(), ReplicationAckLevel: shardInfo.GetReplicationAckLevel(), TransferAckLevel: shardInfo.GetTransferAckLevel(), - TimerAckLevel: time.Unix(0, shardInfo.GetTimerAckLevelNanos()), + TimerAckLevel: shardInfo.GetTimerAckLevel(), ClusterTransferAckLevel: shardInfo.ClusterTransferAckLevel, ClusterTimerAckLevel: timerAckLevel, TransferProcessingQueueStates: transferPQS, @@ -245,11 +244,6 @@ func readLockShard(ctx context.Context, tx sqlplugin.Tx, shardID int, oldRangeID } func shardInfoToShardsRow(s persistence.InternalShardInfo, parser serialization.Parser) (*sqlplugin.ShardsRow, error) { - timerAckLevels := make(map[string]int64, len(s.ClusterTimerAckLevel)) - for k, v := range s.ClusterTimerAckLevel { - timerAckLevels[k] = v.UnixNano() - } - var markerData []byte var markerEncoding string if s.PendingFailoverMarkers != nil { @@ -271,14 +265,14 @@ func shardInfoToShardsRow(s persistence.InternalShardInfo, parser serialization. timerPQSEncoding = string(s.TimerProcessingQueueStates.Encoding) } - shardInfo := &sqlblobs.ShardInfo{ + shardInfo := &serialization.ShardInfo{ StolenSinceRenew: common.Int32Ptr(int32(s.StolenSinceRenew)), - UpdatedAtNanos: common.Int64Ptr(s.UpdatedAt.UnixNano()), + UpdatedAt: &s.UpdatedAt, ReplicationAckLevel: common.Int64Ptr(s.ReplicationAckLevel), TransferAckLevel: common.Int64Ptr(s.TransferAckLevel), - TimerAckLevelNanos: common.Int64Ptr(s.TimerAckLevel.UnixNano()), + TimerAckLevel: &s.TimerAckLevel, ClusterTransferAckLevel: s.ClusterTransferAckLevel, - ClusterTimerAckLevel: timerAckLevels, + ClusterTimerAckLevel: s.ClusterTimerAckLevel, TransferProcessingQueueStates: transferPQSData, TransferProcessingQueueStatesEncoding: common.StringPtr(transferPQSEncoding), TimerProcessingQueueStates: timerPQSData, diff --git a/common/persistence/sql/sqlTaskManager.go b/common/persistence/sql/sqlTaskManager.go index 3dded02041f..0a5bcca6cfa 100644 --- a/common/persistence/sql/sqlTaskManager.go +++ b/common/persistence/sql/sqlTaskManager.go @@ -29,7 +29,6 @@ import ( "github.com/dgryski/go-farm" - "github.com/uber/cadence/.gen/go/sqlblobs" "github.com/uber/cadence/common" "github.com/uber/cadence/common/log" "github.com/uber/cadence/common/persistence" @@ -81,11 +80,11 @@ func (m *sqlTaskManager) LeaseTaskList( TaskType: common.Int64Ptr(int64(request.TaskType))}) if err != nil { if err == sql.ErrNoRows { - tlInfo := &sqlblobs.TaskListInfo{ - AckLevel: &ackLevel, - Kind: common.Int16Ptr(int16(request.TaskListKind)), - ExpiryTimeNanos: common.Int64Ptr(0), - LastUpdatedNanos: common.Int64Ptr(time.Now().UnixNano()), + tlInfo := &serialization.TaskListInfo{ + AckLevel: &ackLevel, + Kind: common.Int16Ptr(int16(request.TaskListKind)), + ExpiryTimestamp: common.TimePtr(time.Unix(0, 0)), + LastUpdated: common.TimePtr(time.Now()), } blob, err := m.parser.TaskListInfoToBlob(tlInfo) if err != nil { @@ -149,7 +148,7 @@ func (m *sqlTaskManager) LeaseTaskList( return err1 } now := time.Now() - tlInfo.LastUpdatedNanos = common.Int64Ptr(now.UnixNano()) + tlInfo.LastUpdated = common.TimePtr(now) blob, err1 := m.parser.TaskListInfoToBlob(tlInfo) if err1 != nil { return err1 @@ -202,14 +201,14 @@ func (m *sqlTaskManager) UpdateTaskList( ) (*persistence.UpdateTaskListResponse, error) { shardID := m.shardID(request.TaskListInfo.DomainID, request.TaskListInfo.Name) domainID := serialization.MustParseUUID(request.TaskListInfo.DomainID) - tlInfo := &sqlblobs.TaskListInfo{ - AckLevel: common.Int64Ptr(request.TaskListInfo.AckLevel), - Kind: common.Int16Ptr(int16(request.TaskListInfo.Kind)), - ExpiryTimeNanos: common.Int64Ptr(0), - LastUpdatedNanos: common.TimeNowNanosPtr(), + tlInfo := &serialization.TaskListInfo{ + AckLevel: common.Int64Ptr(request.TaskListInfo.AckLevel), + Kind: common.Int16Ptr(int16(request.TaskListInfo.Kind)), + ExpiryTimestamp: common.TimePtr(time.Unix(0, 0)), + LastUpdated: common.TimePtr(time.Now()), } if request.TaskListInfo.Kind == persistence.TaskListKindSticky { - tlInfo.ExpiryTimeNanos = common.Int64Ptr(stickyTaskListExpiry().UnixNano()) + tlInfo.ExpiryTimestamp = common.TimePtr(stickyTaskListExpiry()) } var resp *persistence.UpdateTaskListResponse @@ -328,8 +327,8 @@ func (m *sqlTaskManager) ListTaskList( resp.Items[i].RangeID = rows[i].RangeID resp.Items[i].Kind = int(info.GetKind()) resp.Items[i].AckLevel = info.GetAckLevel() - resp.Items[i].Expiry = time.Unix(0, info.GetExpiryTimeNanos()) - resp.Items[i].LastUpdated = time.Unix(0, info.GetLastUpdatedNanos()) + resp.Items[i].Expiry = info.GetExpiryTimestamp() + resp.Items[i].LastUpdated = info.GetLastUpdated() } return resp, nil @@ -388,12 +387,12 @@ func (m *sqlTaskManager) CreateTasks( } expiryTime = time.Now().Add(ttl) } - blob, err := m.parser.TaskInfoToBlob(&sqlblobs.TaskInfo{ + blob, err := m.parser.TaskInfoToBlob(&serialization.TaskInfo{ WorkflowID: &v.Data.WorkflowID, RunID: serialization.MustParseUUID(v.Data.RunID), ScheduleID: &v.Data.ScheduleID, - ExpiryTimeNanos: common.Int64Ptr(expiryTime.UnixNano()), - CreatedTimeNanos: common.Int64Ptr(time.Now().UnixNano()), + ExpiryTimestamp: &expiryTime, + CreatedTimestamp: common.TimePtr(time.Now()), }) if err != nil { return nil, err @@ -473,11 +472,11 @@ func (m *sqlTaskManager) GetTasks( tasks[i] = &persistence.InternalTaskInfo{ DomainID: request.DomainID, WorkflowID: info.GetWorkflowID(), - RunID: serialization.UUID(info.RunID).String(), + RunID: info.RunID.String(), TaskID: v.TaskID, ScheduleID: info.GetScheduleID(), - Expiry: time.Unix(0, info.GetExpiryTimeNanos()), - CreatedTime: time.Unix(0, info.GetCreatedTimeNanos()), + Expiry: info.GetExpiryTimestamp(), + CreatedTime: info.GetCreatedTimestamp(), } } diff --git a/common/persistence/sql/workflowStateMaps.go b/common/persistence/sql/workflowStateMaps.go index 5c4dbb2bca3..0c85d430c28 100644 --- a/common/persistence/sql/workflowStateMaps.go +++ b/common/persistence/sql/workflowStateMaps.go @@ -25,9 +25,7 @@ import ( "context" "database/sql" "fmt" - "time" - "github.com/uber/cadence/.gen/go/sqlblobs" "github.com/uber/cadence/common" "github.com/uber/cadence/common/persistence" "github.com/uber/cadence/common/persistence/serialization" @@ -53,38 +51,38 @@ func updateActivityInfos( scheduledEvent, scheduledEncoding := persistence.FromDataBlob(activityInfo.ScheduledEvent) startEvent, startEncoding := persistence.FromDataBlob(activityInfo.StartedEvent) - info := &sqlblobs.ActivityInfo{ - Version: &activityInfo.Version, - ScheduledEventBatchID: &activityInfo.ScheduledEventBatchID, - ScheduledEvent: scheduledEvent, - ScheduledEventEncoding: common.StringPtr(scheduledEncoding), - ScheduledTimeNanos: common.Int64Ptr(activityInfo.ScheduledTime.UnixNano()), - StartedID: &activityInfo.StartedID, - StartedEvent: startEvent, - StartedEventEncoding: common.StringPtr(startEncoding), - StartedTimeNanos: common.Int64Ptr(activityInfo.StartedTime.UnixNano()), - ActivityID: &activityInfo.ActivityID, - RequestID: &activityInfo.RequestID, - ScheduleToStartTimeoutSeconds: common.Int32Ptr(int32(activityInfo.ScheduleToStartTimeout.Seconds())), - ScheduleToCloseTimeoutSeconds: common.Int32Ptr(int32(activityInfo.ScheduleToCloseTimeout.Seconds())), - StartToCloseTimeoutSeconds: common.Int32Ptr(int32(activityInfo.StartToCloseTimeout.Seconds())), - HeartbeatTimeoutSeconds: common.Int32Ptr(int32(activityInfo.HeartbeatTimeout.Seconds())), - CancelRequested: &activityInfo.CancelRequested, - CancelRequestID: &activityInfo.CancelRequestID, - TimerTaskStatus: &activityInfo.TimerTaskStatus, - Attempt: &activityInfo.Attempt, - TaskList: &activityInfo.TaskList, - StartedIdentity: &activityInfo.StartedIdentity, - HasRetryPolicy: &activityInfo.HasRetryPolicy, - RetryInitialIntervalSeconds: common.Int32Ptr(int32(activityInfo.InitialInterval.Seconds())), - RetryBackoffCoefficient: &activityInfo.BackoffCoefficient, - RetryMaximumIntervalSeconds: common.Int32Ptr(int32(activityInfo.MaximumInterval.Seconds())), - RetryExpirationTimeNanos: common.Int64Ptr(activityInfo.ExpirationTime.UnixNano()), - RetryMaximumAttempts: &activityInfo.MaximumAttempts, - RetryNonRetryableErrors: activityInfo.NonRetriableErrors, - RetryLastFailureReason: &activityInfo.LastFailureReason, - RetryLastWorkerIdentity: &activityInfo.LastWorkerIdentity, - RetryLastFailureDetails: activityInfo.LastFailureDetails, + info := &serialization.ActivityInfo{ + Version: &activityInfo.Version, + ScheduledEventBatchID: &activityInfo.ScheduledEventBatchID, + ScheduledEvent: scheduledEvent, + ScheduledEventEncoding: common.StringPtr(scheduledEncoding), + ScheduledTimestamp: &activityInfo.ScheduledTime, + StartedID: &activityInfo.StartedID, + StartedEvent: startEvent, + StartedEventEncoding: common.StringPtr(startEncoding), + StartedTimestamp: &activityInfo.StartedTime, + ActivityID: &activityInfo.ActivityID, + RequestID: &activityInfo.RequestID, + ScheduleToStartTimeout: &activityInfo.ScheduleToStartTimeout, + ScheduleToCloseTimeout: &activityInfo.ScheduleToCloseTimeout, + StartToCloseTimeout: &activityInfo.StartToCloseTimeout, + HeartbeatTimeout: &activityInfo.HeartbeatTimeout, + CancelRequested: &activityInfo.CancelRequested, + CancelRequestID: &activityInfo.CancelRequestID, + TimerTaskStatus: &activityInfo.TimerTaskStatus, + Attempt: &activityInfo.Attempt, + TaskList: &activityInfo.TaskList, + StartedIdentity: &activityInfo.StartedIdentity, + HasRetryPolicy: &activityInfo.HasRetryPolicy, + RetryInitialInterval: &activityInfo.InitialInterval, + RetryBackoffCoefficient: &activityInfo.BackoffCoefficient, + RetryMaximumInterval: &activityInfo.MaximumInterval, + RetryExpirationTimestamp: &activityInfo.ExpirationTime, + RetryMaximumAttempts: &activityInfo.MaximumAttempts, + RetryNonRetryableErrors: activityInfo.NonRetriableErrors, + RetryLastFailureReason: &activityInfo.LastFailureReason, + RetryLastWorkerIdentity: &activityInfo.LastWorkerIdentity, + RetryLastFailureDetails: activityInfo.LastFailureDetails, } blob, err := parser.ActivityInfoToBlob(info) if err != nil { @@ -163,15 +161,15 @@ func getActivityInfoMap( Version: decoded.GetVersion(), ScheduledEventBatchID: decoded.GetScheduledEventBatchID(), ScheduledEvent: persistence.NewDataBlob(decoded.ScheduledEvent, common.EncodingType(decoded.GetScheduledEventEncoding())), - ScheduledTime: time.Unix(0, decoded.GetScheduledTimeNanos()), + ScheduledTime: decoded.GetScheduledTimestamp(), StartedID: decoded.GetStartedID(), - StartedTime: time.Unix(0, decoded.GetStartedTimeNanos()), + StartedTime: decoded.GetStartedTimestamp(), ActivityID: decoded.GetActivityID(), RequestID: decoded.GetRequestID(), - ScheduleToStartTimeout: common.SecondsToDuration(int64(decoded.GetScheduleToStartTimeoutSeconds())), - ScheduleToCloseTimeout: common.SecondsToDuration(int64(decoded.GetScheduleToCloseTimeoutSeconds())), - StartToCloseTimeout: common.SecondsToDuration(int64(decoded.GetStartToCloseTimeoutSeconds())), - HeartbeatTimeout: common.SecondsToDuration(int64(decoded.GetHeartbeatTimeoutSeconds())), + ScheduleToStartTimeout: decoded.GetScheduleToStartTimeout(), + ScheduleToCloseTimeout: decoded.GetScheduleToCloseTimeout(), + StartToCloseTimeout: decoded.GetStartToCloseTimeout(), + HeartbeatTimeout: decoded.GetHeartbeatTimeout(), CancelRequested: decoded.GetCancelRequested(), CancelRequestID: decoded.GetCancelRequestID(), TimerTaskStatus: decoded.GetTimerTaskStatus(), @@ -179,10 +177,10 @@ func getActivityInfoMap( StartedIdentity: decoded.GetStartedIdentity(), TaskList: decoded.GetTaskList(), HasRetryPolicy: decoded.GetHasRetryPolicy(), - InitialInterval: common.SecondsToDuration(int64(decoded.GetRetryInitialIntervalSeconds())), + InitialInterval: decoded.GetRetryInitialInterval(), BackoffCoefficient: decoded.GetRetryBackoffCoefficient(), - MaximumInterval: common.SecondsToDuration(int64(decoded.GetRetryMaximumIntervalSeconds())), - ExpirationTime: time.Unix(0, decoded.GetRetryExpirationTimeNanos()), + MaximumInterval: decoded.GetRetryMaximumInterval(), + ExpirationTime: decoded.GetRetryExpirationTimestamp(), MaximumAttempts: decoded.GetRetryMaximumAttempts(), NonRetriableErrors: decoded.GetRetryNonRetryableErrors(), LastFailureReason: decoded.GetRetryLastFailureReason(), @@ -235,10 +233,10 @@ func updateTimerInfos( if len(timerInfos) > 0 { rows := make([]sqlplugin.TimerInfoMapsRow, len(timerInfos)) for i, timerInfo := range timerInfos { - blob, err := parser.TimerInfoToBlob(&sqlblobs.TimerInfo{ + blob, err := parser.TimerInfoToBlob(&serialization.TimerInfo{ Version: &timerInfo.Version, StartedID: &timerInfo.StartedID, - ExpiryTimeNanos: common.Int64Ptr(timerInfo.ExpiryTime.UnixNano()), + ExpiryTimestamp: &timerInfo.ExpiryTime, // TaskID is a misleading variable, it actually serves // the purpose of indicating whether a timer task is // generated for this timer info @@ -312,7 +310,7 @@ func getTimerInfoMap( TimerID: row.TimerID, Version: info.GetVersion(), StartedID: info.GetStartedID(), - ExpiryTime: time.Unix(0, info.GetExpiryTimeNanos()), + ExpiryTime: info.GetExpiryTimestamp(), // TaskID is a misleading variable, it actually serves // the purpose of indicating whether a timer task is // generated for this timer info @@ -363,7 +361,7 @@ func updateChildExecutionInfos( initiateEvent, initiateEncoding := persistence.FromDataBlob(childExecutionInfo.InitiatedEvent) startEvent, startEncoding := persistence.FromDataBlob(childExecutionInfo.StartedEvent) - info := &sqlblobs.ChildExecutionInfo{ + info := &serialization.ChildExecutionInfo{ Version: &childExecutionInfo.Version, InitiatedEventBatchID: &childExecutionInfo.InitiatedEventBatchID, InitiatedEvent: initiateEvent, @@ -505,7 +503,7 @@ func updateRequestCancelInfos( if len(requestCancelInfos) > 0 { rows := make([]sqlplugin.RequestCancelInfoMapsRow, len(requestCancelInfos)) for i, requestCancelInfo := range requestCancelInfos { - blob, err := parser.RequestCancelInfoToBlob(&sqlblobs.RequestCancelInfo{ + blob, err := parser.RequestCancelInfoToBlob(&serialization.RequestCancelInfo{ Version: &requestCancelInfo.Version, InitiatedEventBatchID: &requestCancelInfo.InitiatedEventBatchID, CancelRequestID: &requestCancelInfo.CancelRequestID, @@ -624,7 +622,7 @@ func updateSignalInfos( if len(signalInfos) > 0 { rows := make([]sqlplugin.SignalInfoMapsRow, len(signalInfos)) for i, signalInfo := range signalInfos { - blob, err := parser.SignalInfoToBlob(&sqlblobs.SignalInfo{ + blob, err := parser.SignalInfoToBlob(&serialization.SignalInfo{ Version: &signalInfo.Version, InitiatedEventBatchID: &signalInfo.InitiatedEventBatchID, RequestID: &signalInfo.SignalRequestID,