Skip to content

Commit

Permalink
Switch all internals to protobuf
Browse files Browse the repository at this point in the history
  • Loading branch information
vytautas-karpavicius committed Jun 17, 2021
1 parent 77bf30e commit f033056
Show file tree
Hide file tree
Showing 115 changed files with 4,655 additions and 3,304 deletions.
4 changes: 2 additions & 2 deletions .gen/go/cadence/cadence.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .gen/go/cadence/workflowserviceclient/client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .gen/go/cadence/workflowservicefx/client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .gen/go/cadence/workflowservicefx/server.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .gen/go/cadence/workflowserviceserver/server.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .gen/go/cadence/workflowservicetest/client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .gen/go/shadower/shadower.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .gen/go/shared/shared.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Makefile
Expand Up @@ -6,7 +6,7 @@ default: test
OS = $(shell uname -s)
ARCH = $(shell uname -m)

IMPORT_ROOT := go.uber.org/cadence/v1
IMPORT_ROOT := go.uber.org/cadence/v2
THRIFT_GENDIR := .gen/go
THRIFTRW_SRC := idls/thrift/cadence.thrift idls/thrift/shadower.thrift
# one or more thriftrw-generated file(s), to create / depend on generated code
Expand Down
2 changes: 1 addition & 1 deletion activity/activity.go
Expand Up @@ -24,7 +24,7 @@ import (
"context"

"github.com/uber-go/tally"
"go.uber.org/cadence/v1/internal"
"go.uber.org/cadence/v2/internal"
"go.uber.org/zap"
)

Expand Down
2 changes: 1 addition & 1 deletion activity/doc.go
Expand Up @@ -35,7 +35,7 @@ string parameter, appends a word to it and then returns the result.
import (
"context"
"go.uber.org/cadence/v1/activity"
"go.uber.org/cadence/v2/activity"
"go.uber.org/zap"
)
Expand Down
8 changes: 7 additions & 1 deletion cadence.go
Expand Up @@ -121,7 +121,13 @@ API to allow you to capture a stack trace from any failed workflow execution his
*/
package cadence

import "go.uber.org/cadence/v1/internal"
import (
"go.uber.org/cadence/v2/internal"
"go.uber.org/cadence/v2/internal/api"
)

// RetryPolicy defines the retry policy for activity/workflow.
type RetryPolicy = internal.RetryPolicy

// Interface is an API interface to the Cadence server.
type Interface = api.Interface
42 changes: 21 additions & 21 deletions client/client.go
Expand Up @@ -26,11 +26,11 @@ package client
import (
"context"

"go.uber.org/cadence/v1/.gen/go/cadence/workflowserviceclient"
s "go.uber.org/cadence/v1/.gen/go/shared"
"go.uber.org/cadence/v1/encoded"
"go.uber.org/cadence/v1/internal"
"go.uber.org/cadence/v1/workflow"
apiv1 "go.uber.org/cadence/v2/.gen/proto/api/v1"
"go.uber.org/cadence/v2/encoded"
"go.uber.org/cadence/v2/internal"
"go.uber.org/cadence/v2/internal/api"
"go.uber.org/cadence/v2/workflow"
)

const (
Expand Down Expand Up @@ -187,7 +187,7 @@ type (
// }
// events = append(events, event)
// }
GetWorkflowHistory(ctx context.Context, workflowID string, runID string, isLongPoll bool, filterType s.HistoryEventFilterType) HistoryEventIterator
GetWorkflowHistory(ctx context.Context, workflowID string, runID string, isLongPoll bool, filterType apiv1.EventFilterType) HistoryEventIterator

// CompleteActivity reports activity completed.
// activity Execute method can return activity.ErrResultPending to
Expand Down Expand Up @@ -243,7 +243,7 @@ type (
// - BadRequestError
// - InternalServiceError
// - EntityNotExistError
ListClosedWorkflow(ctx context.Context, request *s.ListClosedWorkflowExecutionsRequest) (*s.ListClosedWorkflowExecutionsResponse, error)
ListClosedWorkflow(ctx context.Context, request *apiv1.ListClosedWorkflowExecutionsRequest) (*apiv1.ListClosedWorkflowExecutionsResponse, error)

// ListOpenWorkflow gets open workflow executions based on request filters.
// Retrieved workflow executions are sorted by start time in descending order.
Expand All @@ -252,7 +252,7 @@ type (
// - BadRequestError
// - InternalServiceError
// - EntityNotExistError
ListOpenWorkflow(ctx context.Context, request *s.ListOpenWorkflowExecutionsRequest) (*s.ListOpenWorkflowExecutionsResponse, error)
ListOpenWorkflow(ctx context.Context, request *apiv1.ListOpenWorkflowExecutionsRequest) (*apiv1.ListOpenWorkflowExecutionsResponse, error)

// ListWorkflow gets workflow executions based on query. This API only works with ElasticSearch,
// and will return BadRequestError when using Cassandra or MySQL. The query is basically the SQL WHERE clause,
Expand All @@ -265,7 +265,7 @@ type (
// The errors it can return:
// - BadRequestError
// - InternalServiceError
ListWorkflow(ctx context.Context, request *s.ListWorkflowExecutionsRequest) (*s.ListWorkflowExecutionsResponse, error)
ListWorkflow(ctx context.Context, request *apiv1.ListWorkflowExecutionsRequest) (*apiv1.ListWorkflowExecutionsResponse, error)

// ListArchivedWorkflow gets archived workflow executions based on query. This API will return BadRequest if Cadence
// cluster or target domain is not configured for visibility archival or read is not enabled. The query is basically the SQL WHERE clause.
Expand All @@ -274,7 +274,7 @@ type (
// The errors it can return:
// - BadRequestError
// - InternalServiceError
ListArchivedWorkflow(ctx context.Context, request *s.ListArchivedWorkflowExecutionsRequest) (*s.ListArchivedWorkflowExecutionsResponse, error)
ListArchivedWorkflow(ctx context.Context, request *apiv1.ListArchivedWorkflowExecutionsRequest) (*apiv1.ListArchivedWorkflowExecutionsResponse, error)

// ScanWorkflow gets workflow executions based on query. This API only works with ElasticSearch,
// and will return BadRequestError when using Cassandra or MySQL. The query is basically the SQL WHERE clause
Expand All @@ -285,20 +285,20 @@ type (
// The errors it can return:
// - BadRequestError
// - InternalServiceError
ScanWorkflow(ctx context.Context, request *s.ListWorkflowExecutionsRequest) (*s.ListWorkflowExecutionsResponse, error)
ScanWorkflow(ctx context.Context, request *apiv1.ScanWorkflowExecutionsRequest) (*apiv1.ScanWorkflowExecutionsResponse, error)

// CountWorkflow gets number of workflow executions based on query. This API only works with ElasticSearch,
// and will return BadRequestError when using Cassandra or MySQL. The query is basically the SQL WHERE clause
// (see ListWorkflow for query examples).
// The errors it can return:
// - BadRequestError
// - InternalServiceError
CountWorkflow(ctx context.Context, request *s.CountWorkflowExecutionsRequest) (*s.CountWorkflowExecutionsResponse, error)
CountWorkflow(ctx context.Context, request *apiv1.CountWorkflowExecutionsRequest) (*apiv1.CountWorkflowExecutionsResponse, error)

// GetSearchAttributes returns valid search attributes keys and value types.
// The search attributes can be used in query of List/Scan/Count APIs. Adding new search attributes requires cadence server
// to update dynamic config ValidSearchAttributes.
GetSearchAttributes(ctx context.Context) (*s.GetSearchAttributesResponse, error)
GetSearchAttributes(ctx context.Context) (*apiv1.GetSearchAttributesResponse, error)

// QueryWorkflow queries a given workflow's last execution and returns the query result synchronously. Parameter workflowID
// and queryType are required, other parameters are optional. The workflowID and runID (optional) identify the
Expand Down Expand Up @@ -335,7 +335,7 @@ type (
// - BadRequestError
// - InternalServiceError
// - EntityNotExistError
ResetWorkflow(ctx context.Context, request *s.ResetWorkflowExecutionRequest) (*s.ResetWorkflowExecutionResponse, error)
ResetWorkflow(ctx context.Context, request *apiv1.ResetWorkflowExecutionRequest) (*apiv1.ResetWorkflowExecutionResponse, error)

// DescribeWorkflowExecution returns information about the specified workflow execution.
// - runID can be default(empty string). if empty string then it will pick the last running execution of that workflow ID.
Expand All @@ -344,15 +344,15 @@ type (
// - BadRequestError
// - InternalServiceError
// - EntityNotExistError
DescribeWorkflowExecution(ctx context.Context, workflowID, runID string) (*s.DescribeWorkflowExecutionResponse, error)
DescribeWorkflowExecution(ctx context.Context, workflowID, runID string) (*apiv1.DescribeWorkflowExecutionResponse, error)

// DescribeTaskList returns information about the target tasklist, right now this API returns the
// pollers which polled this tasklist in last few minutes.
// The errors it can return:
// - BadRequestError
// - InternalServiceError
// - EntityNotExistError
DescribeTaskList(ctx context.Context, tasklist string, tasklistType s.TaskListType) (*s.DescribeTaskListResponse, error)
DescribeTaskList(ctx context.Context, tasklist string, tasklistType apiv1.TaskListType) (*apiv1.DescribeTaskListResponse, error)
}

// DomainClient is the client for managing operations on the domain.
Expand All @@ -363,7 +363,7 @@ type (
// - DomainAlreadyExistsError
// - BadRequestError
// - InternalServiceError
Register(ctx context.Context, request *s.RegisterDomainRequest) error
Register(ctx context.Context, request *apiv1.RegisterDomainRequest) error

// Describe a domain. The domain has 3 part of information
// DomainInfo - Which has Name, Status, Description, Owner Email
Expand All @@ -373,14 +373,14 @@ type (
// - EntityNotExistsError
// - BadRequestError
// - InternalServiceError
Describe(ctx context.Context, name string) (*s.DescribeDomainResponse, error)
Describe(ctx context.Context, name string) (*apiv1.DescribeDomainResponse, error)

// Update a domain.
// The errors it can throw:
// - EntityNotExistsError
// - BadRequestError
// - InternalServiceError
Update(ctx context.Context, request *s.UpdateDomainRequest) error
Update(ctx context.Context, request *apiv1.UpdateDomainRequest) error
}
)

Expand Down Expand Up @@ -412,12 +412,12 @@ const (
)

// NewClient creates an instance of a workflow client
func NewClient(service workflowserviceclient.Interface, domain string, options *Options) Client {
func NewClient(service api.Interface, domain string, options *Options) Client {
return internal.NewClient(service, domain, options)
}

// NewDomainClient creates an instance of a domain client, to manage lifecycle of domains.
func NewDomainClient(service workflowserviceclient.Interface, options *Options) DomainClient {
func NewDomainClient(service api.Interface, options *Options) DomainClient {
return internal.NewDomainClient(service, options)
}

Expand Down
5 changes: 3 additions & 2 deletions docker/buildkite/docker-compose-local.yml
Expand Up @@ -25,6 +25,7 @@ services:
cadence:
image: ubercadence/server:master-auto-setup
ports:
- "7833:7833"
- "7933:7933"
- "7934:7934"
- "7935:7935"
Expand Down Expand Up @@ -52,7 +53,7 @@ services:
- |
make integ_test_sticky_off
environment:
- "SERVICE_ADDR=cadence:7933"
- "SERVICE_ADDR=cadence:7833"
- "GO111MODULE=on"
depends_on:
- cadence
Expand All @@ -74,7 +75,7 @@ services:
- |
make integ_test_sticky_on
environment:
- "SERVICE_ADDR=cadence:7933"
- "SERVICE_ADDR=cadence:7833"
- "GO111MODULE=on"
depends_on:
- cadence
Expand Down
3 changes: 2 additions & 1 deletion docker/buildkite/docker-compose.yml
Expand Up @@ -25,6 +25,7 @@ services:
cadence:
image: ubercadence/server:master-auto-setup
ports:
- "7833:7833"
- "7933:7933"
- "7934:7934"
- "7935:7935"
Expand All @@ -46,7 +47,7 @@ services:
context: ../../
dockerfile: ./docker/buildkite/Dockerfile
environment:
- "SERVICE_ADDR=cadence:7933"
- "SERVICE_ADDR=cadence:7833"
- "GO111MODULE=on"
depends_on:
- cadence
Expand Down
2 changes: 1 addition & 1 deletion encoded/encoded.go
Expand Up @@ -21,7 +21,7 @@
// Package encoded contains wrappers that are used for binary payloads deserialization.
package encoded

import "go.uber.org/cadence/v1/internal"
import "go.uber.org/cadence/v2/internal"

type (

Expand Down
22 changes: 19 additions & 3 deletions error.go
Expand Up @@ -21,9 +21,10 @@
package cadence

import (
"go.uber.org/cadence/v1/.gen/go/shared"
"go.uber.org/cadence/v1/internal"
"go.uber.org/cadence/v1/workflow"
"go.uber.org/cadence/v2/.gen/go/shared"
"go.uber.org/cadence/v2/internal"
"go.uber.org/cadence/v2/internal/api"
"go.uber.org/cadence/v2/workflow"
)

type (
Expand All @@ -32,6 +33,21 @@ type (

// CanceledError returned when operation was canceled.
CanceledError = internal.CanceledError

AccessDeniedError = api.AccessDeniedError
BadRequestError = api.BadRequestError
CancellationAlreadyRequestedError = api.CancellationAlreadyRequestedError
ClientVersionNotSupportedError = api.ClientVersionNotSupportedError
DomainAlreadyExistsError = api.DomainAlreadyExistsError
DomainNotActiveError = api.DomainNotActiveError
EntityNotExistsError = api.EntityNotExistsError
WorkflowExecutionAlreadyCompletedError = api.WorkflowExecutionAlreadyCompletedError
InternalServiceError = api.InternalServiceError
LimitExceededError = api.LimitExceededError
QueryFailedError = api.QueryFailedError
ServiceBusyError = api.ServiceBusyError
WorkflowExecutionAlreadyStartedError = api.WorkflowExecutionAlreadyStartedError
EventAlreadyStartedError = api.EventAlreadyStartedError
)

// ErrNoData is returned when trying to extract strong typed data while there is no data available.
Expand Down

0 comments on commit f033056

Please sign in to comment.