flightsqlingress

package
v0.0.0-...-6d28b5b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 27, 2026 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ReapTriggerPeriodic = "periodic"
	ReapTriggerForced   = "forced"
)

Variables

View Source
var ErrDurableReconnectTerminal = errors.New("durable reconnect terminal")

Functions

func MarkDurableReconnectTerminal

func MarkDurableReconnectTerminal(err error) error

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
}

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 (*ControlPlaneFlightSQLHandler) ClosePreparedStatement

func (*ControlPlaneFlightSQLHandler) CloseSession

func (*ControlPlaneFlightSQLHandler) DoGetDBSchemas

func (*ControlPlaneFlightSQLHandler) DoGetPreparedStatement

func (*ControlPlaneFlightSQLHandler) DoGetStatement

func (*ControlPlaneFlightSQLHandler) DoGetTables

func (*ControlPlaneFlightSQLHandler) DoPutCommandStatementUpdate

func (h *ControlPlaneFlightSQLHandler) DoPutCommandStatementUpdate(ctx context.Context, cmd flightsql.StatementUpdate) (int64, error)

func (*ControlPlaneFlightSQLHandler) EndTransaction

func (*ControlPlaneFlightSQLHandler) GetFlightInfoPreparedStatement

func (*ControlPlaneFlightSQLHandler) GetFlightInfoSchemas

func (*ControlPlaneFlightSQLHandler) GetFlightInfoStatement

func (*ControlPlaneFlightSQLHandler) GetFlightInfoTables

type CredentialValidator

type CredentialValidator interface {
	ValidateCredentials(username, password string) bool
}

CredentialValidator abstracts username/password authentication.

type DurableSessionMetadata

type DurableSessionMetadata struct {
	Username     string
	OrgID        string
	WorkerID     int
	OwnerEpoch   int64
	CPInstanceID string
}

type DurableSessionRecord

type DurableSessionRecord struct {
	SessionToken string
	Username     string
	OrgID        string
	WorkerID     int
	OwnerEpoch   int64
	CPInstanceID string
	State        DurableSessionState
	ExpiresAt    time.Time
	LastSeenAt   time.Time
}

type DurableSessionState

type DurableSessionState string
const (
	DurableSessionStateActive  DurableSessionState = "active"
	DurableSessionStateClosed  DurableSessionState = "closed"
	DurableSessionStateExpired DurableSessionState = "expired"
)

type DurableSessionStore

type DurableSessionStore interface {
	UpsertSession(record DurableSessionRecord) error
	GetSession(sessionToken string) (*DurableSessionRecord, error)
	TouchSession(sessionToken string, lastSeenAt time.Time) error
	CloseSession(sessionToken string, closedAt time.Time) error
}

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

type FuncCredentialValidator func(username, password string) bool

FuncCredentialValidator wraps a function (multi-tenant config store).

func (FuncCredentialValidator) ValidateCredentials

func (f FuncCredentialValidator) ValidateCredentials(username, password string) bool

type Hooks

type Hooks struct {
	OnSessionCountChanged func(int)
	OnSessionsReaped      func(trigger string, count int)
}

type MapCredentialValidator

type MapCredentialValidator struct {
	Users map[string]string
}

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 SessionProvider

type SessionProvider interface {
	CreateSession(ctx context.Context, username string, pid int32, memoryLimit string, threads int) (int32, *server.FlightExecutor, error)
	DestroySession(int32)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL