Skip to content

Commit

Permalink
Event thrift encoding and refactoring dataInterfaces (cadence-workflo…
Browse files Browse the repository at this point in the history
…w#1145)

* dataInteface and historySerializer

* schema changes

* rename DataBlob data field

* half done dataStoreImpl

* finish dataStoreImpl.go

* add type alias

* finish refactor GetWorkflowExecutionHistory

* add event_data_encoding columns

* GetWorkflowExecution

* UpdateWorkflowExecution and ResetWorkflowExecution

* persistence-tests

* fix new datastoreImpl

* fix sql compile

* remove unused tests

* mutableState interface and mock

* fix mutableStateBuilder.go

* fix stats

* add nil check

* move unit test

* fix size limiting

* fix size for getHistory

* fix app layer

* fix all

* gofmt

* fix lint

* fix lint

* fix lint

* fix tests

* finish all tests

* fix

* fix tests

* fix

* nil check

* nil check

* fix

* fix nil error

* fix unit test

* fix tests

* fix int ptr

* fix

* fix history

* merge conflict

* fix tests

* cr feedbacks

* fix

* rename

* rename

* fix history size test

* make fmt

* fix last 2 tests

* remove debug code
  • Loading branch information
longquanzheng authored Sep 28, 2018
1 parent 6b5af52 commit e49263d
Show file tree
Hide file tree
Showing 64 changed files with 2,612 additions and 2,141 deletions.
6 changes: 4 additions & 2 deletions common/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,10 @@ const (

// Data encoding types
const (
EncodingTypeJSON EncodingType = "json"
EncodingTypeGob = "gob"
EncodingTypeJSON EncodingType = "json"
EncodingTypeThriftRW = "thriftrw"
EncodingTypeGob = "gob"
EncodingTypeUnknown = "unknow"
)

// NoRetryBackoff is used to represent backoff when no retry is needed
Expand Down
198 changes: 103 additions & 95 deletions common/mocks/ExecutionManager.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,104 +20,74 @@

package mocks

import mock "github.com/stretchr/testify/mock"
import persistence "github.com/uber/cadence/common/persistence"
import "github.com/uber/cadence/common/persistence"
import "github.com/stretchr/testify/mock"

// ExecutionManager is an autogenerated mock type for the ExecutionManager type
type ExecutionManager struct {
mock.Mock
}

// Close provides a mock function with given fields:
func (_m *ExecutionManager) Close() {
_m.Called()
}

// CompleteTimerTask provides a mock function with given fields: request
func (_m *ExecutionManager) CompleteTimerTask(request *persistence.CompleteTimerTaskRequest) error {
ret := _m.Called(request)

var r0 error
if rf, ok := ret.Get(0).(func(*persistence.CompleteTimerTaskRequest) error); ok {
r0 = rf(request)
} else {
r0 = ret.Error(0)
}

return r0
}

// RangeCompleteTimerTask provides a mock function with given fields: request
func (_m *ExecutionManager) RangeCompleteTimerTask(request *persistence.RangeCompleteTimerTaskRequest) error {
// CreateWorkflowExecution provides a mock function with given fields: request
func (_m *ExecutionManager) CreateWorkflowExecution(request *persistence.CreateWorkflowExecutionRequest) (*persistence.CreateWorkflowExecutionResponse, error) {
ret := _m.Called(request)

var r0 error
if rf, ok := ret.Get(0).(func(*persistence.RangeCompleteTimerTaskRequest) error); ok {
var r0 *persistence.CreateWorkflowExecutionResponse
if rf, ok := ret.Get(0).(func(*persistence.CreateWorkflowExecutionRequest) *persistence.CreateWorkflowExecutionResponse); ok {
r0 = rf(request)
} else {
r0 = ret.Error(0)
if ret.Get(0) != nil {
r0 = ret.Get(0).(*persistence.CreateWorkflowExecutionResponse)
}
}

return r0
}

// CompleteTransferTask provides a mock function with given fields: request
func (_m *ExecutionManager) CompleteTransferTask(request *persistence.CompleteTransferTaskRequest) error {
ret := _m.Called(request)

var r0 error
if rf, ok := ret.Get(0).(func(*persistence.CompleteTransferTaskRequest) error); ok {
r0 = rf(request)
var r1 error
if rf, ok := ret.Get(1).(func(*persistence.CreateWorkflowExecutionRequest) error); ok {
r1 = rf(request)
} else {
r0 = ret.Error(0)
r1 = ret.Error(1)
}

return r0
return r0, r1
}

// RangeCompleteTransferTask provides a mock function with given fields: request
func (_m *ExecutionManager) RangeCompleteTransferTask(request *persistence.RangeCompleteTransferTaskRequest) error {
// GetWorkflowExecution provides a mock function with given fields: request
func (_m *ExecutionManager) GetWorkflowExecution(request *persistence.GetWorkflowExecutionRequest) (*persistence.GetWorkflowExecutionResponse, error) {
ret := _m.Called(request)

var r0 error
if rf, ok := ret.Get(0).(func(*persistence.RangeCompleteTransferTaskRequest) error); ok {
var r0 *persistence.GetWorkflowExecutionResponse
if rf, ok := ret.Get(0).(func(*persistence.GetWorkflowExecutionRequest) *persistence.GetWorkflowExecutionResponse); ok {
r0 = rf(request)
} else {
r0 = ret.Error(0)
if ret.Get(0) != nil {
r0 = ret.Get(0).(*persistence.GetWorkflowExecutionResponse)
}
}

return r0
}

// CompleteReplicationTask provides a mock function with given fields: request
func (_m *ExecutionManager) CompleteReplicationTask(request *persistence.CompleteReplicationTaskRequest) error {
ret := _m.Called(request)

var r0 error
if rf, ok := ret.Get(0).(func(*persistence.CompleteReplicationTaskRequest) error); ok {
r0 = rf(request)
var r1 error
if rf, ok := ret.Get(1).(func(*persistence.GetWorkflowExecutionRequest) error); ok {
r1 = rf(request)
} else {
r0 = ret.Error(0)
r1 = ret.Error(1)
}

return r0
return r0, r1
}

// CreateWorkflowExecution provides a mock function with given fields: request
func (_m *ExecutionManager) CreateWorkflowExecution(request *persistence.CreateWorkflowExecutionRequest) (*persistence.CreateWorkflowExecutionResponse, error) {
// UpdateWorkflowExecution provides a mock function with given fields: request
func (_m *ExecutionManager) UpdateWorkflowExecution(request *persistence.UpdateWorkflowExecutionRequest) (*persistence.UpdateWorkflowExecutionResponse, error) {
ret := _m.Called(request)

var r0 *persistence.CreateWorkflowExecutionResponse
if rf, ok := ret.Get(0).(func(*persistence.CreateWorkflowExecutionRequest) *persistence.CreateWorkflowExecutionResponse); ok {
var r0 *persistence.UpdateWorkflowExecutionResponse
if rf, ok := ret.Get(0).(func(*persistence.UpdateWorkflowExecutionRequest) *persistence.UpdateWorkflowExecutionResponse); ok {
r0 = rf(request)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*persistence.CreateWorkflowExecutionResponse)
r0 = ret.Get(0).(*persistence.UpdateWorkflowExecutionResponse)
}
}

var r1 error
if rf, ok := ret.Get(1).(func(*persistence.CreateWorkflowExecutionRequest) error); ok {
if rf, ok := ret.Get(1).(func(*persistence.UpdateWorkflowExecutionRequest) error); ok {
r1 = rf(request)
} else {
r1 = ret.Error(1)
Expand All @@ -126,6 +96,20 @@ func (_m *ExecutionManager) CreateWorkflowExecution(request *persistence.CreateW
return r0, r1
}

// ResetMutableState provides a mock function with given fields: request
func (_m *ExecutionManager) ResetMutableState(request *persistence.ResetMutableStateRequest) error {
ret := _m.Called(request)

var r0 error
if rf, ok := ret.Get(0).(func(*persistence.ResetMutableStateRequest) error); ok {
r0 = rf(request)
} else {
r0 = ret.Error(0)
}

return r0
}

// DeleteWorkflowExecution provides a mock function with given fields: request
func (_m *ExecutionManager) DeleteWorkflowExecution(request *persistence.DeleteWorkflowExecutionRequest) error {
ret := _m.Called(request)
Expand All @@ -140,21 +124,21 @@ func (_m *ExecutionManager) DeleteWorkflowExecution(request *persistence.DeleteW
return r0
}

// GetTimerIndexTasks provides a mock function with given fields: request
func (_m *ExecutionManager) GetTimerIndexTasks(request *persistence.GetTimerIndexTasksRequest) (*persistence.GetTimerIndexTasksResponse, error) {
// GetCurrentExecution provides a mock function with given fields: request
func (_m *ExecutionManager) GetCurrentExecution(request *persistence.GetCurrentExecutionRequest) (*persistence.GetCurrentExecutionResponse, error) {
ret := _m.Called(request)

var r0 *persistence.GetTimerIndexTasksResponse
if rf, ok := ret.Get(0).(func(*persistence.GetTimerIndexTasksRequest) *persistence.GetTimerIndexTasksResponse); ok {
var r0 *persistence.GetCurrentExecutionResponse
if rf, ok := ret.Get(0).(func(*persistence.GetCurrentExecutionRequest) *persistence.GetCurrentExecutionResponse); ok {
r0 = rf(request)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*persistence.GetTimerIndexTasksResponse)
r0 = ret.Get(0).(*persistence.GetCurrentExecutionResponse)
}
}

var r1 error
if rf, ok := ret.Get(1).(func(*persistence.GetTimerIndexTasksRequest) error); ok {
if rf, ok := ret.Get(1).(func(*persistence.GetCurrentExecutionRequest) error); ok {
r1 = rf(request)
} else {
r1 = ret.Error(1)
Expand Down Expand Up @@ -186,6 +170,34 @@ func (_m *ExecutionManager) GetTransferTasks(request *persistence.GetTransferTas
return r0, r1
}

// CompleteTransferTask provides a mock function with given fields: request
func (_m *ExecutionManager) CompleteTransferTask(request *persistence.CompleteTransferTaskRequest) error {
ret := _m.Called(request)

var r0 error
if rf, ok := ret.Get(0).(func(*persistence.CompleteTransferTaskRequest) error); ok {
r0 = rf(request)
} else {
r0 = ret.Error(0)
}

return r0
}

// RangeCompleteTransferTask provides a mock function with given fields: request
func (_m *ExecutionManager) RangeCompleteTransferTask(request *persistence.RangeCompleteTransferTaskRequest) error {
ret := _m.Called(request)

var r0 error
if rf, ok := ret.Get(0).(func(*persistence.RangeCompleteTransferTaskRequest) error); ok {
r0 = rf(request)
} else {
r0 = ret.Error(0)
}

return r0
}

// GetReplicationTasks provides a mock function with given fields: request
func (_m *ExecutionManager) GetReplicationTasks(request *persistence.GetReplicationTasksRequest) (*persistence.GetReplicationTasksResponse, error) {
ret := _m.Called(request)
Expand All @@ -209,44 +221,35 @@ func (_m *ExecutionManager) GetReplicationTasks(request *persistence.GetReplicat
return r0, r1
}

// GetWorkflowExecution provides a mock function with given fields: request
func (_m *ExecutionManager) GetWorkflowExecution(request *persistence.GetWorkflowExecutionRequest) (*persistence.GetWorkflowExecutionResponse, error) {
// CompleteReplicationTask provides a mock function with given fields: request
func (_m *ExecutionManager) CompleteReplicationTask(request *persistence.CompleteReplicationTaskRequest) error {
ret := _m.Called(request)

var r0 *persistence.GetWorkflowExecutionResponse
if rf, ok := ret.Get(0).(func(*persistence.GetWorkflowExecutionRequest) *persistence.GetWorkflowExecutionResponse); ok {
var r0 error
if rf, ok := ret.Get(0).(func(*persistence.CompleteReplicationTaskRequest) error); ok {
r0 = rf(request)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*persistence.GetWorkflowExecutionResponse)
}
}

var r1 error
if rf, ok := ret.Get(1).(func(*persistence.GetWorkflowExecutionRequest) error); ok {
r1 = rf(request)
} else {
r1 = ret.Error(1)
r0 = ret.Error(0)
}

return r0, r1
return r0
}

// GetCurrentExecution provides a mock function with given fields: request
func (_m *ExecutionManager) GetCurrentExecution(request *persistence.GetCurrentExecutionRequest) (*persistence.GetCurrentExecutionResponse, error) {
// GetTimerIndexTasks provides a mock function with given fields: request
func (_m *ExecutionManager) GetTimerIndexTasks(request *persistence.GetTimerIndexTasksRequest) (*persistence.GetTimerIndexTasksResponse, error) {
ret := _m.Called(request)

var r0 *persistence.GetCurrentExecutionResponse
if rf, ok := ret.Get(0).(func(*persistence.GetCurrentExecutionRequest) *persistence.GetCurrentExecutionResponse); ok {
var r0 *persistence.GetTimerIndexTasksResponse
if rf, ok := ret.Get(0).(func(*persistence.GetTimerIndexTasksRequest) *persistence.GetTimerIndexTasksResponse); ok {
r0 = rf(request)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*persistence.GetCurrentExecutionResponse)
r0 = ret.Get(0).(*persistence.GetTimerIndexTasksResponse)
}
}

var r1 error
if rf, ok := ret.Get(1).(func(*persistence.GetCurrentExecutionRequest) error); ok {
if rf, ok := ret.Get(1).(func(*persistence.GetTimerIndexTasksRequest) error); ok {
r1 = rf(request)
} else {
r1 = ret.Error(1)
Expand All @@ -255,12 +258,12 @@ func (_m *ExecutionManager) GetCurrentExecution(request *persistence.GetCurrentE
return r0, r1
}

// UpdateWorkflowExecution provides a mock function with given fields: request
func (_m *ExecutionManager) UpdateWorkflowExecution(request *persistence.UpdateWorkflowExecutionRequest) error {
// CompleteTimerTask provides a mock function with given fields: request
func (_m *ExecutionManager) CompleteTimerTask(request *persistence.CompleteTimerTaskRequest) error {
ret := _m.Called(request)

var r0 error
if rf, ok := ret.Get(0).(func(*persistence.UpdateWorkflowExecutionRequest) error); ok {
if rf, ok := ret.Get(0).(func(*persistence.CompleteTimerTaskRequest) error); ok {
r0 = rf(request)
} else {
r0 = ret.Error(0)
Expand All @@ -269,12 +272,12 @@ func (_m *ExecutionManager) UpdateWorkflowExecution(request *persistence.UpdateW
return r0
}

// ResetMutableState provides a mock function with given fields: request
func (_m *ExecutionManager) ResetMutableState(request *persistence.ResetMutableStateRequest) error {
// RangeCompleteTimerTask provides a mock function with given fields: request
func (_m *ExecutionManager) RangeCompleteTimerTask(request *persistence.RangeCompleteTimerTaskRequest) error {
ret := _m.Called(request)

var r0 error
if rf, ok := ret.Get(0).(func(*persistence.ResetMutableStateRequest) error); ok {
if rf, ok := ret.Get(0).(func(*persistence.RangeCompleteTimerTaskRequest) error); ok {
r0 = rf(request)
} else {
r0 = ret.Error(0)
Expand All @@ -283,4 +286,9 @@ func (_m *ExecutionManager) ResetMutableState(request *persistence.ResetMutableS
return r0
}

// Close provides a mock function with given fields:
func (_m *ExecutionManager) Close() {
_m.Called()
}

var _ persistence.ExecutionManager = (*ExecutionManager)(nil)
Loading

0 comments on commit e49263d

Please sign in to comment.