Documentation
¶
Overview ¶
Package flightserver serves the plugin Arrow Flight contract (internal/ plugin/contract) in-process, backed by a real source.Source or sink.Sink. It lets a Go .so plugin speak the SAME contract a subprocess plugin speaks: RegisterSource/RegisterSink stay unchanged for the plugin author, and driver.LoadPlugin wraps the registered driver with this server, dialing it back through the existing internal/plugin/client code over a unix socket. There is exactly one normative plugin contract — Arrow Flight — regardless of transport (in-process or subprocess).
Index ¶
- type Server
- type SinkServer
- func (s *SinkServer) DoAction(action *flight.Action, stream flight.FlightService_DoActionServer) error
- func (s *SinkServer) DoPut(stream flight.FlightService_DoPutServer) error
- func (s *SinkServer) Handshake(stream flight.FlightService_HandshakeServer) error
- func (s *SinkServer) ListActions(_ *flight.Empty, stream flight.FlightService_ListActionsServer) error
- type SourceServer
- func (s *SourceServer) DoAction(action *flight.Action, stream flight.FlightService_DoActionServer) error
- func (s *SourceServer) DoGet(tkt *flight.Ticket, stream flight.FlightService_DoGetServer) error
- func (s *SourceServer) GetFlightInfo(ctx context.Context, desc *flight.FlightDescriptor) (*flight.FlightInfo, error)
- func (s *SourceServer) Handshake(stream flight.FlightService_HandshakeServer) error
- func (s *SourceServer) ListActions(_ *flight.Empty, stream flight.FlightService_ListActionsServer) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server hosts one in-process Flight service (source and/or sink side) on a unix socket. Addr()+Token() are what driver.LoadPlugin hands to client.Connect — the same call a subprocess plugin's caller makes.
func Start ¶
func Start(dir, token string, svc flight.FlightServer) (*Server, error)
Start listens on a fresh unix socket in dir and serves svc (a flight.FlightServiceServer, normally *sourceServer or *sinkServer from this package) with bearer-token auth matching the client's handshake/ bearer-metadata contract. Returns once the listener is up; Serve runs in a background goroutine until Stop.
type SinkServer ¶
type SinkServer struct {
flight.BaseFlightServer
// contains filtered or unexported fields
}
SinkServer serves the plugin contract's sink RPC (DoPut) over a real sink.Sink, so the existing internal/plugin/client + internal/plugin. SinkAdapter can connect to it exactly as they would a subprocess plugin. It expects the plugin sink record shape internal/plugin/sink.go's recordsFromReader produces: op + stringified data columns + offset + ts_source, all in the DESCRIPTOR's table.
func NewSinkServer ¶
func NewSinkServer(snk sink.Sink) *SinkServer
NewSinkServer wraps snk for in-process Flight serving.
func (*SinkServer) DoAction ¶
func (s *SinkServer) DoAction(action *flight.Action, stream flight.FlightService_DoActionServer) error
func (*SinkServer) DoPut ¶
func (s *SinkServer) DoPut(stream flight.FlightService_DoPutServer) error
DoPut receives one plugin-shaped record stream (contract §10: op + stringified columns + offset + ts_source) and re-projects it into a dataplane.Batch committed through the wrapped sink.Sink's TableWriter.
func (*SinkServer) Handshake ¶
func (s *SinkServer) Handshake(stream flight.FlightService_HandshakeServer) error
func (*SinkServer) ListActions ¶
func (s *SinkServer) ListActions(_ *flight.Empty, stream flight.FlightService_ListActionsServer) error
type SourceServer ¶
type SourceServer struct {
flight.BaseFlightServer
// contains filtered or unexported fields
}
SourceServer serves the plugin contract's source RPCs (GetFlightInfo + DoGet) over a real source.Source, so the existing internal/plugin/client + internal/plugin.SourceAdapter can connect to it exactly as they would a subprocess plugin.
func NewSourceServer ¶
NewSourceServer wraps src for in-process Flight serving.
func (*SourceServer) DoAction ¶
func (s *SourceServer) DoAction(action *flight.Action, stream flight.FlightService_DoActionServer) error
func (*SourceServer) DoGet ¶
func (s *SourceServer) DoGet(tkt *flight.Ticket, stream flight.FlightService_DoGetServer) error
DoGet streams the table's rows in the shape GetFlightInfo announced for the ticket's mode: flat rows for snapshot, CDC before/after records for changes. It opens the wrapped source.Source's Reader once and re-projects every dataplane.Batch (flat wire schema) accordingly.
func (*SourceServer) GetFlightInfo ¶
func (s *SourceServer) GetFlightInfo(ctx context.Context, desc *flight.FlightDescriptor) (*flight.FlightInfo, error)
GetFlightInfo resolves the schema for one table via source.Source's Introspect. Per contract §6/§7/§8: snapshot mode announces the flat table schema; changes mode announces the CDC change-record schema (§8.1, before/after struct-shaped).
func (*SourceServer) Handshake ¶
func (s *SourceServer) Handshake(stream flight.FlightService_HandshakeServer) error
func (*SourceServer) ListActions ¶
func (s *SourceServer) ListActions(_ *flight.Empty, stream flight.FlightService_ListActionsServer) error