Documentation
¶
Index ¶
- Constants
- func PrintMetadata(pluginFunc PluginFunc) int
- func Serve(opts *ServeOpts) error
- func TestDescribe(t *testing.T, p TailpipePlugin)
- func TestIdentifier(t *testing.T, p TailpipePlugin)
- func TestSources(t *testing.T, p TailpipePlugin)
- func TestTables(t *testing.T, p TailpipePlugin)
- func Validate(t *testing.T, ctor func() (TailpipePlugin, error))
- type ObserverWrapper
- type PluginFunc
- type PluginImpl
- func (p *PluginImpl) CloseSource(_ context.Context) error
- func (p *PluginImpl) Collect(ctx context.Context, req *proto.CollectRequest) (*row_source.ResolvedFromTime, *schema.TableSchema, error)
- func (p *PluginImpl) Describe(_ context.Context, req *proto.DescribeRequest) (*proto.DescribeResponse, error)
- func (p *PluginImpl) GetSupportedOperations(_ context.Context) (*proto.GetSupportedOperationsResponse, error)
- func (p *PluginImpl) Identifier() string
- func (p *PluginImpl) Impl() *PluginImpl
- func (p *PluginImpl) InitSource(ctx context.Context, req *proto.InitSourceRequest) (row_source.RowSource, error)
- func (p *PluginImpl) Notify(ctx context.Context, event events.Event) error
- func (p *PluginImpl) OnCompleted(ctx context.Context, executionId string, rowCount int64, chunksWritten int32, ...) error
- func (p *PluginImpl) OnStarted(ctx context.Context, executionId string) error
- func (p *PluginImpl) SaveCollectionState(_ context.Context) error
- func (p *PluginImpl) Shutdown(context.Context) error
- func (p *PluginImpl) SourceCollect(ctx context.Context, req *proto.SourceCollectRequest) error
- func (p *PluginImpl) SourceCollectionComplete(_ context.Context) error
- func (p *PluginImpl) SourcePause(_ context.Context) error
- func (p *PluginImpl) SourceResume(_ context.Context) error
- func (p *PluginImpl) UpdateCollectionState(ctx context.Context, req *proto.UpdateCollectionStateRequest) error
- type PluginServer
- func (s PluginServer) AddObserver(stream proto.TailpipePlugin_AddObserverServer) error
- func (s PluginServer) CloseSource(ctx context.Context, _ *proto.Empty) (*proto.Empty, error)
- func (s PluginServer) Collect(ctx context.Context, req *proto.CollectRequest) (*proto.CollectResponse, error)
- func (s PluginServer) Describe(ctx context.Context, req *proto.DescribeRequest) (*proto.DescribeResponse, error)
- func (s PluginServer) GetSupportedOperations(ctx context.Context, _ *proto.Empty) (*proto.GetSupportedOperationsResponse, error)
- func (s PluginServer) InitSource(ctx context.Context, req *proto.InitSourceRequest) (*proto.InitSourceResponse, error)
- func (s PluginServer) SaveCollectionState(ctx context.Context, _ *proto.Empty) (*proto.Empty, error)
- func (s PluginServer) Serve() error
- func (s PluginServer) SourceCollect(ctx context.Context, req *proto.SourceCollectRequest) (*proto.Empty, error)
- func (s PluginServer) SourceCollectionComplete(ctx context.Context, _ *proto.Empty) (*proto.Empty, error)
- func (s PluginServer) SourcePause(ctx context.Context, _ *proto.Empty) (*proto.Empty, error)
- func (s PluginServer) SourceResume(ctx context.Context, _ *proto.Empty) (*proto.Empty, error)
- func (s PluginServer) UpdateCollectionState(ctx context.Context, req *proto.UpdateCollectionStateRequest) (*proto.Empty, error)
- type ServeOpts
- type TailpipePlugin
Constants ¶
const ( UnrecognizedRemotePluginMessage = "Unrecognized remote plugin message:" UnrecognizedRemotePluginMessageSuffix = "\nThis usually means" PluginStartupFailureMessage = "Plugin startup failed: " )
Variables ¶
This section is empty.
Functions ¶
func PrintMetadata ¶ added in v0.2.0
func PrintMetadata(pluginFunc PluginFunc) int
func Serve ¶
Serve creates and starts the GRPC server which serves the plugin,
It is called from the main function of the plugin. ServeOpts.PluginFunc must be populated with the plugin constructor function
func TestDescribe ¶
func TestDescribe(t *testing.T, p TailpipePlugin)
func TestIdentifier ¶
func TestIdentifier(t *testing.T, p TailpipePlugin)
func TestSources ¶
func TestSources(t *testing.T, p TailpipePlugin)
func TestTables ¶
func TestTables(t *testing.T, p TailpipePlugin)
Types ¶
type ObserverWrapper ¶
type ObserverWrapper struct {
// contains filtered or unexported fields
}
ObserverWrapper mapd between proto Observer and the plugin Observer
func NewObserverWrapper ¶
func NewObserverWrapper(protoObserver proto.TailpipePlugin_AddObserverServer) ObserverWrapper
type PluginFunc ¶
type PluginFunc func() (TailpipePlugin, error)
type PluginImpl ¶
type PluginImpl struct {
observable.ObservableImpl
// contains filtered or unexported fields
}
PluginImpl should be created via NewPluginImpl method.
func NewPluginImpl ¶
func NewPluginImpl(identifier string) PluginImpl
NewPluginImpl creates a new PluginImpl instance with the given identifier.
func (*PluginImpl) CloseSource ¶
func (p *PluginImpl) CloseSource(_ context.Context) error
func (*PluginImpl) Collect ¶
func (p *PluginImpl) Collect(ctx context.Context, req *proto.CollectRequest) (*row_source.ResolvedFromTime, *schema.TableSchema, error)
Collect Implements plugin.TailpipePlugin
func (*PluginImpl) Describe ¶
func (p *PluginImpl) Describe(_ context.Context, req *proto.DescribeRequest) (*proto.DescribeResponse, error)
Describe implements TailpipePlugin
func (*PluginImpl) GetSupportedOperations ¶ added in v0.9.0
func (p *PluginImpl) GetSupportedOperations(_ context.Context) (*proto.GetSupportedOperationsResponse, error)
func (*PluginImpl) Identifier ¶
func (p *PluginImpl) Identifier() string
Identifier returns the plugin name
func (*PluginImpl) Impl ¶
func (p *PluginImpl) Impl() *PluginImpl
Impl returns the base instance - used for validation testing
func (*PluginImpl) InitSource ¶
func (p *PluginImpl) InitSource(ctx context.Context, req *proto.InitSourceRequest) (row_source.RowSource, error)
InitSource is called to initialise the source when this plugin is being used as a source It performs the same role as CollectorImpl.initSource for in-plugin sources the flow for using a plugin from an external plugin is as follows:
func (*PluginImpl) OnCompleted ¶
func (*PluginImpl) OnStarted ¶
func (p *PluginImpl) OnStarted(ctx context.Context, executionId string) error
OnStarted is called by the plugin when it starts processing a collection request any observers are notified
func (*PluginImpl) SaveCollectionState ¶
func (p *PluginImpl) SaveCollectionState(_ context.Context) error
func (*PluginImpl) Shutdown ¶
func (p *PluginImpl) Shutdown(context.Context) error
Shutdown is called by Serve when the plugin exits
func (*PluginImpl) SourceCollect ¶
func (p *PluginImpl) SourceCollect(ctx context.Context, req *proto.SourceCollectRequest) error
func (*PluginImpl) SourceCollectionComplete ¶ added in v0.7.0
func (p *PluginImpl) SourceCollectionComplete(_ context.Context) error
func (*PluginImpl) SourcePause ¶ added in v0.5.0
func (p *PluginImpl) SourcePause(_ context.Context) error
func (*PluginImpl) SourceResume ¶ added in v0.5.0
func (p *PluginImpl) SourceResume(_ context.Context) error
func (*PluginImpl) UpdateCollectionState ¶
func (p *PluginImpl) UpdateCollectionState(ctx context.Context, req *proto.UpdateCollectionStateRequest) error
type PluginServer ¶
type PluginServer struct {
// contains filtered or unexported fields
}
PluginServer is a wrapper for the actual plugin - this allows us to map between the GRPC interface and the interface implemented by the plugin this is use in particular for AddObserver which has a different signature - this wrapping enables us to define plugin-scoped events which are supported by all plugin components which do not need to know about the GRPC interface and with no corresponding protobuff events
func NewPluginServer ¶
func NewPluginServer(opts *ServeOpts) (*PluginServer, error)
func (PluginServer) AddObserver ¶
func (s PluginServer) AddObserver(stream proto.TailpipePlugin_AddObserverServer) error
func (PluginServer) CloseSource ¶
func (PluginServer) Collect ¶
func (s PluginServer) Collect(ctx context.Context, req *proto.CollectRequest) (*proto.CollectResponse, error)
func (PluginServer) Describe ¶
func (s PluginServer) Describe(ctx context.Context, req *proto.DescribeRequest) (*proto.DescribeResponse, error)
Describe returns the schema for the plugin
func (PluginServer) GetSupportedOperations ¶ added in v0.9.0
func (s PluginServer) GetSupportedOperations(ctx context.Context, _ *proto.Empty) (*proto.GetSupportedOperationsResponse, error)
func (PluginServer) InitSource ¶
func (s PluginServer) InitSource(ctx context.Context, req *proto.InitSourceRequest) (*proto.InitSourceResponse, error)
func (PluginServer) SaveCollectionState ¶
func (PluginServer) Serve ¶
func (s PluginServer) Serve() error
func (PluginServer) SourceCollect ¶
func (s PluginServer) SourceCollect(ctx context.Context, req *proto.SourceCollectRequest) (*proto.Empty, error)
func (PluginServer) SourceCollectionComplete ¶ added in v0.7.0
func (PluginServer) SourcePause ¶ added in v0.5.0
func (PluginServer) SourceResume ¶ added in v0.5.0
func (PluginServer) UpdateCollectionState ¶
func (s PluginServer) UpdateCollectionState(ctx context.Context, req *proto.UpdateCollectionStateRequest) (*proto.Empty, error)
type ServeOpts ¶
type ServeOpts struct {
PluginFunc PluginFunc
}
ServeOpts are the configurations to serve a plugin.
type TailpipePlugin ¶
type TailpipePlugin interface {
// Identifier returns the plugin name
// this must be implemented by the plugin implementation
Identifier() string
// Describe returns the duck DB schema for all tables
// this must be implemented by the plugin implementation
Describe(ctx context.Context, req *proto.DescribeRequest) (*proto.DescribeResponse, error)
// AddObserver adda an observer to the plugin to receive status events
// this is implemented by plugin.PluginImpl and should not be overridden
AddObserver(observable.Observer) error
// Collect is called to start a collection run
// this is implemented by plugin.PluginImpl
Collect(context.Context, *proto.CollectRequest) (*row_source.ResolvedFromTime, *schema.TableSchema, error)
// UpdateCollectionState is called to update the collection state
UpdateCollectionState(ctx context.Context, req *proto.UpdateCollectionStateRequest) error
InitSource(context.Context, *proto.InitSourceRequest) (row_source.RowSource, error)
CloseSource(context.Context) error
SaveCollectionState(context.Context) error
SourceCollect(context.Context, *proto.SourceCollectRequest) error
SourcePause(context.Context) error
SourceResume(context.Context) error
SourceCollectionComplete(context.Context) error
GetSupportedOperations(context.Context) (*proto.GetSupportedOperationsResponse, error)
// Shutdown is implemented by plugin.PluginImpl (empty implementation)
// it may be overridden by the plugin
Shutdown(context.Context) error
// Impl returns the common plugin implementation - used for validation testing
Impl() *PluginImpl
}
TailpipePlugin is the interface that all tailpipe plugins must implement It is in its own package to avoid circular dependencies as many people need to reference it