Skip to content

Commit

Permalink
Protocol v2 tweaks (#94)
Browse files Browse the repository at this point in the history
* extract specification into separate proto message

* return concrete types in client constructors

* rename Start to Open

* use config.Config

* generate mock for cplugin interfaces
  • Loading branch information
lovromazgon authored Jun 10, 2024
1 parent edc19d4 commit 192e55f
Show file tree
Hide file tree
Showing 39 changed files with 1,449 additions and 951 deletions.
4 changes: 2 additions & 2 deletions cplugin/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ import (
"google.golang.org/grpc"
)

// NewClient creates a new plugin client. Path should point to the plugin
// New creates a new plugin client. Path should point to the plugin
// executable. The client will support both v1 and v2 of the connector protocol.
func NewClient(
func New(
logger hclog.Logger,
path string,
opts ...Option,
Expand Down
19 changes: 11 additions & 8 deletions cplugin/destination.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,15 @@ package cplugin
import (
"context"

"github.com/conduitio/conduit-commons/config"
"github.com/conduitio/conduit-commons/opencdc"
)

//go:generate mockgen -destination=mock/destination.go -package=mock -mock_names=DestinationPlugin=DestinationPlugin . DestinationPlugin

type DestinationPlugin interface {
Configure(context.Context, DestinationConfigureRequest) (DestinationConfigureResponse, error)
Start(context.Context, DestinationStartRequest) (DestinationStartResponse, error)
Open(context.Context, DestinationOpenRequest) (DestinationOpenResponse, error)
Run(context.Context, DestinationRunStream) error
Stop(context.Context, DestinationStopRequest) (DestinationStopResponse, error)
Teardown(context.Context, DestinationTeardownRequest) (DestinationTeardownResponse, error)
Expand Down Expand Up @@ -56,12 +59,12 @@ type DestinationRunStreamServer interface {
}

type DestinationConfigureRequest struct {
Config map[string]string
Config config.Config
}
type DestinationConfigureResponse struct{}

type DestinationStartRequest struct{}
type DestinationStartResponse struct{}
type DestinationOpenRequest struct{}
type DestinationOpenResponse struct{}

type DestinationRunRequest struct {
Records []opencdc.Record
Expand All @@ -84,17 +87,17 @@ type DestinationTeardownRequest struct{}
type DestinationTeardownResponse struct{}

type DestinationLifecycleOnCreatedRequest struct {
Config map[string]string
Config config.Config
}
type DestinationLifecycleOnCreatedResponse struct{}

type DestinationLifecycleOnUpdatedRequest struct {
ConfigBefore map[string]string
ConfigAfter map[string]string
ConfigBefore config.Config
ConfigAfter config.Config
}
type DestinationLifecycleOnUpdatedResponse struct{}

type DestinationLifecycleOnDeletedRequest struct {
Config map[string]string
Config config.Config
}
type DestinationLifecycleOnDeletedResponse struct{}
160 changes: 160 additions & 0 deletions cplugin/mock/destination.go

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

160 changes: 160 additions & 0 deletions cplugin/mock/source.go

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

Loading

0 comments on commit 192e55f

Please sign in to comment.