Documentation
¶
Index ¶
- Constants
- Variables
- func MarkDurableReconnectTerminal(err error) error
- func SNIFromContext(ctx context.Context) string
- type Config
- type ControlPlaneFlightSQLHandler
- func (h *ControlPlaneFlightSQLHandler) BeginTransaction(ctx context.Context, req flightsql.ActionBeginTransactionRequest) ([]byte, error)
- func (h *ControlPlaneFlightSQLHandler) ClosePreparedStatement(ctx context.Context, req flightsql.ActionClosePreparedStatementRequest) error
- func (h *ControlPlaneFlightSQLHandler) CloseSession(ctx context.Context, req *flight.CloseSessionRequest) (*flight.CloseSessionResult, error)
- func (h *ControlPlaneFlightSQLHandler) CreatePreparedStatement(ctx context.Context, req flightsql.ActionCreatePreparedStatementRequest) (flightsql.ActionCreatePreparedStatementResult, error)
- func (h *ControlPlaneFlightSQLHandler) DoGetDBSchemas(ctx context.Context, cmd flightsql.GetDBSchemas) (*arrow.Schema, <-chan flight.StreamChunk, error)
- func (h *ControlPlaneFlightSQLHandler) DoGetPreparedStatement(ctx context.Context, cmd flightsql.PreparedStatementQuery) (*arrow.Schema, <-chan flight.StreamChunk, error)
- func (h *ControlPlaneFlightSQLHandler) DoGetStatement(ctx context.Context, ticket flightsql.StatementQueryTicket) (*arrow.Schema, <-chan flight.StreamChunk, error)
- func (h *ControlPlaneFlightSQLHandler) DoGetTables(ctx context.Context, cmd flightsql.GetTables) (*arrow.Schema, <-chan flight.StreamChunk, error)
- func (h *ControlPlaneFlightSQLHandler) DoPutCommandStatementUpdate(ctx context.Context, cmd flightsql.StatementUpdate) (int64, error)
- func (h *ControlPlaneFlightSQLHandler) EndTransaction(ctx context.Context, req flightsql.ActionEndTransactionRequest) error
- func (h *ControlPlaneFlightSQLHandler) GetFlightInfoPreparedStatement(ctx context.Context, cmd flightsql.PreparedStatementQuery, ...) (*flight.FlightInfo, error)
- func (h *ControlPlaneFlightSQLHandler) GetFlightInfoSchemas(ctx context.Context, cmd flightsql.GetDBSchemas, desc *flight.FlightDescriptor) (*flight.FlightInfo, error)
- func (h *ControlPlaneFlightSQLHandler) GetFlightInfoStatement(ctx context.Context, cmd flightsql.StatementQuery, ...) (*flight.FlightInfo, error)
- func (h *ControlPlaneFlightSQLHandler) GetFlightInfoTables(ctx context.Context, cmd flightsql.GetTables, desc *flight.FlightDescriptor) (*flight.FlightInfo, error)
- type CredentialValidator
- type DurableSessionMetadata
- type DurableSessionRecord
- type DurableSessionState
- type DurableSessionStore
- type FlightIngress
- type FuncCredentialValidator
- type Hooks
- type MapCredentialValidator
- type Options
- type SNIAwareCredentialValidator
- type SessionProvider
Constants ¶
const ( ReapTriggerPeriodic = "periodic" ReapTriggerForced = "forced" )
Variables ¶
var ErrDurableReconnectTerminal = errors.New("durable reconnect terminal")
Functions ¶
func SNIFromContext ¶
SNIFromContext returns the TLS ServerName (SNI) the client sent, or "" if the connection isn't TLS-terminated by this server (e.g. in unit tests). Exported so callers that route by org reuse the exact same extraction the auth path uses — auth and routing must never disagree on a connection's hostname.
Types ¶
type Config ¶
type Config struct {
SessionIdleTTL time.Duration
SessionReapTick time.Duration
HandleIdleTTL time.Duration
SessionTokenTTL time.Duration
WorkerQueueTimeout time.Duration // applied to CreateSession calls; 0 = use request context as-is
// RejectPersistentSecretDDL rejects CREATE/DROP PERSISTENT SECRET with a
// clear error. Set when the deployment runs the user persistent secret
// manager: that manager intercepts secret DDL on the PG wire protocol
// only, so a persistent secret created via Flight would execute, never be
// stored, and then be silently deleted by the next session's hygiene wipe
// — rejecting up front is the honest behavior until Flight gets its own
// interception.
RejectPersistentSecretDDL bool
}
type ControlPlaneFlightSQLHandler ¶
type ControlPlaneFlightSQLHandler struct {
flightsql.BaseServer
// contains filtered or unexported fields
}
ControlPlaneFlightSQLHandler implements Flight SQL over control-plane sessions.
func NewControlPlaneFlightSQLHandler ¶
func NewControlPlaneFlightSQLHandler(sessions *flightAuthSessionStore, validator CredentialValidator) (*ControlPlaneFlightSQLHandler, error)
func (*ControlPlaneFlightSQLHandler) BeginTransaction ¶
func (h *ControlPlaneFlightSQLHandler) BeginTransaction(ctx context.Context, req flightsql.ActionBeginTransactionRequest) ([]byte, error)
func (*ControlPlaneFlightSQLHandler) ClosePreparedStatement ¶
func (h *ControlPlaneFlightSQLHandler) ClosePreparedStatement(ctx context.Context, req flightsql.ActionClosePreparedStatementRequest) error
func (*ControlPlaneFlightSQLHandler) CloseSession ¶
func (h *ControlPlaneFlightSQLHandler) CloseSession(ctx context.Context, req *flight.CloseSessionRequest) (*flight.CloseSessionResult, error)
func (*ControlPlaneFlightSQLHandler) CreatePreparedStatement ¶
func (h *ControlPlaneFlightSQLHandler) CreatePreparedStatement(ctx context.Context, req flightsql.ActionCreatePreparedStatementRequest) (flightsql.ActionCreatePreparedStatementResult, error)
func (*ControlPlaneFlightSQLHandler) DoGetDBSchemas ¶
func (h *ControlPlaneFlightSQLHandler) DoGetDBSchemas(ctx context.Context, cmd flightsql.GetDBSchemas) (*arrow.Schema, <-chan flight.StreamChunk, error)
func (*ControlPlaneFlightSQLHandler) DoGetPreparedStatement ¶
func (h *ControlPlaneFlightSQLHandler) DoGetPreparedStatement(ctx context.Context, cmd flightsql.PreparedStatementQuery) (*arrow.Schema, <-chan flight.StreamChunk, error)
func (*ControlPlaneFlightSQLHandler) DoGetStatement ¶
func (h *ControlPlaneFlightSQLHandler) DoGetStatement(ctx context.Context, ticket flightsql.StatementQueryTicket) (*arrow.Schema, <-chan flight.StreamChunk, error)
func (*ControlPlaneFlightSQLHandler) DoGetTables ¶
func (h *ControlPlaneFlightSQLHandler) DoGetTables(ctx context.Context, cmd flightsql.GetTables) (*arrow.Schema, <-chan flight.StreamChunk, error)
func (*ControlPlaneFlightSQLHandler) DoPutCommandStatementUpdate ¶
func (h *ControlPlaneFlightSQLHandler) DoPutCommandStatementUpdate(ctx context.Context, cmd flightsql.StatementUpdate) (int64, error)
func (*ControlPlaneFlightSQLHandler) EndTransaction ¶
func (h *ControlPlaneFlightSQLHandler) EndTransaction(ctx context.Context, req flightsql.ActionEndTransactionRequest) error
func (*ControlPlaneFlightSQLHandler) GetFlightInfoPreparedStatement ¶
func (h *ControlPlaneFlightSQLHandler) GetFlightInfoPreparedStatement(ctx context.Context, cmd flightsql.PreparedStatementQuery, desc *flight.FlightDescriptor) (*flight.FlightInfo, error)
func (*ControlPlaneFlightSQLHandler) GetFlightInfoSchemas ¶
func (h *ControlPlaneFlightSQLHandler) GetFlightInfoSchemas(ctx context.Context, cmd flightsql.GetDBSchemas, desc *flight.FlightDescriptor) (*flight.FlightInfo, error)
func (*ControlPlaneFlightSQLHandler) GetFlightInfoStatement ¶
func (h *ControlPlaneFlightSQLHandler) GetFlightInfoStatement(ctx context.Context, cmd flightsql.StatementQuery, desc *flight.FlightDescriptor) (*flight.FlightInfo, error)
func (*ControlPlaneFlightSQLHandler) GetFlightInfoTables ¶
func (h *ControlPlaneFlightSQLHandler) GetFlightInfoTables(ctx context.Context, cmd flightsql.GetTables, desc *flight.FlightDescriptor) (*flight.FlightInfo, error)
type CredentialValidator ¶
CredentialValidator abstracts username/password authentication.
type DurableSessionMetadata ¶
type DurableSessionRecord ¶
type DurableSessionState ¶
type DurableSessionState string
const ( DurableSessionStateActive DurableSessionState = "active" DurableSessionStateClosed DurableSessionState = "closed" DurableSessionStateExpired DurableSessionState = "expired" )
type DurableSessionStore ¶
type FlightIngress ¶
type FlightIngress struct {
// contains filtered or unexported fields
}
FlightIngress serves Arrow Flight SQL on the control plane with Basic auth. It reuses worker sessions via SessionProvider.
func NewFlightIngress ¶
func NewFlightIngress(host string, port int, tlsConfig *tls.Config, validator CredentialValidator, provider SessionProvider, cfg Config, opts Options) (*FlightIngress, error)
func NewFlightIngressFromListener ¶
func NewFlightIngressFromListener(baseListener net.Listener, tlsConfig *tls.Config, validator CredentialValidator, provider SessionProvider, cfg Config, opts Options) (*FlightIngress, error)
func (*FlightIngress) Addr ¶
func (fi *FlightIngress) Addr() string
Addr returns the bound listener address.
func (*FlightIngress) BeginDrain ¶
func (fi *FlightIngress) BeginDrain()
func (*FlightIngress) Healthy ¶
func (fi *FlightIngress) Healthy() bool
func (*FlightIngress) Shutdown ¶
func (fi *FlightIngress) Shutdown()
Shutdown stops accepting new Flight connections and cleans up sessions.
func (*FlightIngress) Start ¶
func (fi *FlightIngress) Start()
Start begins serving in the background.
func (*FlightIngress) WaitForZeroSessions ¶
func (fi *FlightIngress) WaitForZeroSessions(ctx context.Context) bool
type FuncCredentialValidator ¶
FuncCredentialValidator wraps a function (multi-tenant config store).
func (FuncCredentialValidator) ValidateCredentials ¶
func (f FuncCredentialValidator) ValidateCredentials(username, password string) bool
type MapCredentialValidator ¶
MapCredentialValidator wraps a static users map (single-tenant / tests).
func (*MapCredentialValidator) ValidateCredentials ¶
func (v *MapCredentialValidator) ValidateCredentials(username, password string) bool
type Options ¶
type Options struct {
Hooks Hooks
RateLimiter *server.RateLimiter
}
type SNIAwareCredentialValidator ¶
type SNIAwareCredentialValidator interface {
ValidateCredentialsForSNI(sni, username, password string) bool
}
SNIAwareCredentialValidator is an optional extension. When the validator implements it, the Flight handler passes the TLS SNI value alongside the credentials so the validator can use the hostname for org routing (instead of scanning all orgs to match a username/password pair). Validators that don't implement this interface keep the legacy behavior.