Documentation ¶
Overview ¶
package clients is a wrapper around grpc clients so clients can work with non protobuf structs and handle unmarshaling
Index ¶
- Constants
- func DownloadPluginFromGithub(ctx context.Context, localPath string, org string, name string, version string, ...) error
- func IsUnimplemented(err error) bool
- func WithDestinationDirectory(directory string) func(*DestinationClient)
- func WithDestinationGrpcConn(userConn *grpc.ClientConn) func(*DestinationClient)
- func WithDestinationLogger(logger zerolog.Logger) func(*DestinationClient)
- func WithDestinationNoSentry() func(*DestinationClient)
- func WithSourceDirectory(directory string) func(*SourceClient)
- func WithSourceGRPCConnection(userConn *grpc.ClientConn) func(*SourceClient)
- func WithSourceLogger(logger zerolog.Logger) func(*SourceClient)
- func WithSourceNoSentry() func(*SourceClient)
- type DestinationClient
- func (c *DestinationClient) Close(ctx context.Context) error
- func (c *DestinationClient) DeleteStale(ctx context.Context, tables schema.Tables, source string, timestamp time.Time) error
- func (c *DestinationClient) GetMetrics(ctx context.Context) (*destination.Metrics, error)
- func (c *DestinationClient) GetProtocolVersion(ctx context.Context) (uint64, error)
- func (c *DestinationClient) Initialize(ctx context.Context, spec specs.Destination) error
- func (c *DestinationClient) Migrate(ctx context.Context, tables []*schema.Table) error
- func (c *DestinationClient) Name(ctx context.Context) (string, error)
- func (c *DestinationClient) Terminate() error
- func (c *DestinationClient) Version(ctx context.Context) (string, error)
- func (c *DestinationClient) Write(ctx context.Context, source string, syncTime time.Time, ...) (uint64, error)
- func (c *DestinationClient) Write2(ctx context.Context, tables schema.Tables, source string, syncTime time.Time, ...) error
- type DestinationClientOption
- type FetchResultMessage
- type PluginType
- type SourceClient
- func (c *SourceClient) GetMetrics(ctx context.Context) (*source.Metrics, error)
- func (c *SourceClient) GetProtocolVersion(ctx context.Context) (uint64, error)
- func (c *SourceClient) GetSyncSummary(ctx context.Context) (*schema.SyncSummary, error)
- func (c *SourceClient) GetTables(ctx context.Context) ([]*schema.Table, error)
- func (c *SourceClient) GetTablesForSpec(ctx context.Context, spec *specs.Source) ([]*schema.Table, error)
- func (c *SourceClient) Name(ctx context.Context) (string, error)
- func (c *SourceClient) Sync(ctx context.Context, spec specs.Source, res chan<- []byte) error
- func (c *SourceClient) Sync2(ctx context.Context, spec specs.Source, res chan<- []byte) error
- func (c *SourceClient) Terminate() error
- func (c *SourceClient) Version(ctx context.Context) (string, error)
- type SourceClientOption
Constants ¶
const ( PluginTypeSource PluginType = "source" PluginTypeDestination PluginType = "destination" DefaultDownloadDir = ".cq" RetryAttempts = 5 RetryWaitTime = 1 * time.Second )
Variables ¶
This section is empty.
Functions ¶
func DownloadPluginFromGithub ¶ added in v0.11.1
func IsUnimplemented ¶ added in v1.10.0
IsUnimplemented returns true if an error indicates that the underlying grpc call was unimplemented on the server side.
func WithDestinationDirectory ¶ added in v0.11.2
func WithDestinationDirectory(directory string) func(*DestinationClient)
func WithDestinationGrpcConn ¶ added in v0.11.2
func WithDestinationGrpcConn(userConn *grpc.ClientConn) func(*DestinationClient)
func WithDestinationLogger ¶ added in v0.11.1
func WithDestinationLogger(logger zerolog.Logger) func(*DestinationClient)
func WithDestinationNoSentry ¶ added in v1.0.3
func WithDestinationNoSentry() func(*DestinationClient)
func WithSourceDirectory ¶ added in v0.11.2
func WithSourceDirectory(directory string) func(*SourceClient)
func WithSourceGRPCConnection ¶ added in v0.11.2
func WithSourceGRPCConnection(userConn *grpc.ClientConn) func(*SourceClient)
func WithSourceLogger ¶ added in v0.11.1
func WithSourceLogger(logger zerolog.Logger) func(*SourceClient)
func WithSourceNoSentry ¶ added in v1.0.3
func WithSourceNoSentry() func(*SourceClient)
Types ¶
type DestinationClient ¶
type DestinationClient struct {
// contains filtered or unexported fields
}
func NewDestinationClient ¶
func NewDestinationClient(ctx context.Context, registry specs.Registry, path string, version string, opts ...DestinationClientOption) (*DestinationClient, error)
func (*DestinationClient) Close ¶ added in v0.11.1
func (c *DestinationClient) Close(ctx context.Context) error
func (*DestinationClient) DeleteStale ¶ added in v0.12.0
func (*DestinationClient) GetMetrics ¶ added in v0.13.15
func (c *DestinationClient) GetMetrics(ctx context.Context) (*destination.Metrics, error)
func (*DestinationClient) GetProtocolVersion ¶ added in v0.13.8
func (c *DestinationClient) GetProtocolVersion(ctx context.Context) (uint64, error)
func (*DestinationClient) Initialize ¶ added in v0.0.4
func (c *DestinationClient) Initialize(ctx context.Context, spec specs.Destination) error
func (*DestinationClient) Name ¶ added in v0.0.10
func (c *DestinationClient) Name(ctx context.Context) (string, error)
func (*DestinationClient) Terminate ¶ added in v0.12.0
func (c *DestinationClient) Terminate() error
Terminate is used only in conjunction with NewManagedDestinationClient. It closes the connection it created, kills the spawned process and removes the socket file.
func (*DestinationClient) Version ¶ added in v0.0.10
func (c *DestinationClient) Version(ctx context.Context) (string, error)
func (*DestinationClient) Write ¶ added in v0.0.4
func (c *DestinationClient) Write(ctx context.Context, source string, syncTime time.Time, resources <-chan []byte) (uint64, error)
Write writes rows as they are received from the channel to the destination plugin. resources is marshaled schema.Resource. We are not marshalling this inside the function because usually it is alreadun marshalled from the destination plugin.
type DestinationClientOption ¶ added in v0.11.1
type DestinationClientOption func(*DestinationClient)
type FetchResultMessage ¶
type FetchResultMessage struct {
Resource []byte
}
type PluginType ¶ added in v0.11.1
type PluginType string
type SourceClient ¶
type SourceClient struct {
// contains filtered or unexported fields
}
SourceClient
func NewSourceClient ¶
func NewSourceClient(ctx context.Context, registry specs.Registry, path string, version string, opts ...SourceClientOption) (*SourceClient, error)
NewSourceClient connect to gRPC server running source plugin and returns a new SourceClient
func (*SourceClient) GetMetrics ¶ added in v0.13.15
func (*SourceClient) GetProtocolVersion ¶ added in v0.13.8
func (c *SourceClient) GetProtocolVersion(ctx context.Context) (uint64, error)
func (*SourceClient) GetSyncSummary ¶ added in v0.12.0
func (c *SourceClient) GetSyncSummary(ctx context.Context) (*schema.SyncSummary, error)
func (*SourceClient) GetTablesForSpec ¶ added in v1.10.0
func (*SourceClient) Name ¶ added in v0.0.10
func (c *SourceClient) Name(ctx context.Context) (string, error)
func (*SourceClient) Sync ¶ added in v0.0.4
Sync start syncing for the source client per the given spec and returning the results in the given channel. res is marshaled schema.Resource. We are not unmarshalling this for performance reasons as usually this is sent over-the-wire anyway to a source plugin
func (*SourceClient) Sync2 ¶ added in v0.13.16
Sync start syncing for the source client per the given spec and returning the results in the given channel. res is marshaled schema.Resource. We are not unmarshalling this for performance reasons as usually this is sent over-the-wire anyway to a source plugin
func (*SourceClient) Terminate ¶ added in v0.12.0
func (c *SourceClient) Terminate() error
Terminate is used only in conjunction with NewManagedSourceClient. It closes the connection it created, kills the spawned process and removes the socket file.
type SourceClientOption ¶ added in v0.11.1
type SourceClientOption func(*SourceClient)