Documentation
¶
Index ¶
- Constants
- Variables
- func BindMetadataPlan(plan proofevidence.MetadataPlan, config json.RawMessage, credentialKind string) (proofevidence.MetadataPlan, error)
- func Execute(ctx context.Context, conn Connector, statement json.RawMessage, ...) (*result.ExecutionResult, error)
- func FTPArtifactConnector(conn Connector) (*ftp.Connector, bool)
- func MetadataPolicies(limits proofevidence.Limits) []proofevidence.OperationPolicy
- func NormalizeCustomerConfig(dsType model.DataSourceType, raw []byte) ([]byte, bool, error)
- func PublicConfigDigest(kind model.DataSourceType, raw []byte) (string, error)
- func ValidateTransportConfig(config any, allowPlaintext bool) error
- func WithDataSourceIdentity(ctx context.Context, organization, dataSource slug.Slug) context.Context
- func WithOrganizationSlug(ctx context.Context, organizationSlug slug.Slug) context.Context
- type BigQueryDefaults
- type Connector
- type DecodedConnectorPayloads
- type HubSpotDefaults
- type Manager
- type NewConnectorFunc
- func NewConnectorWithBigQueryDefaults(base NewConnectorFunc, defaults BigQueryDefaults) NewConnectorFunc
- func NewConnectorWithHubSpotDefaults(base NewConnectorFunc, defaults HubSpotDefaults) NewConnectorFunc
- func NewConnectorWithPrivatePostgres(base NewConnectorFunc, endpoint PrivatePostgresEndpoint) NewConnectorFunc
- func NewConnectorWithPrivatePostgresPolicy(base NewConnectorFunc, policy PrivatePostgresPolicy) NewConnectorFunc
- func NewConnectorWithSnowflakeDefaults(base NewConnectorFunc, defaults SnowflakeDefaults) NewConnectorFunc
- func NewConnectorWithTracing(base NewConnectorFunc) NewConnectorFunc
- func NewConnectorWithTransportPolicy(base NewConnectorFunc, allowPlaintext bool) NewConnectorFunc
- type PrivatePostgresEndpoint
- type PrivatePostgresPolicy
- type ReleaseFunc
- type ResourceMetadataObserver
- type RuntimeIdentity
- type RuntimePoolSettings
- type RuntimePoolSnapshot
- type SnowflakeDefaults
Constants ¶
const ( // DefaultRuntimePoolMaxEntries bounds SQL pools retained by one process. DefaultRuntimePoolMaxEntries = 128 // DefaultRuntimePoolIdleTimeout retires a pool unused by connector work. DefaultRuntimePoolIdleTimeout = 10 * time.Minute // DefaultRuntimePoolMaxLifetime bounds reuse of one connector pool revision. DefaultRuntimePoolMaxLifetime = time.Hour // DefaultRuntimePoolCleanupInterval controls background idle and lifetime eviction. DefaultRuntimePoolCleanupInterval = time.Minute )
Variables ¶
var ( // ErrRuntimePoolClosed reports acquisition after manager shutdown. ErrRuntimePoolClosed = xerror.ExecutionUnavailable().Detail("connector runtime pool is closed") // ErrRuntimePoolExhausted reports that every bounded entry is still active. ErrRuntimePoolExhausted = xerror.ExecutionUnavailable().Detail("connector runtime pool is full") // ErrRuntimePoolRevisionRetired reports an older revision that is still draining. ErrRuntimePoolRevisionRetired = xerror.ExecutionUnavailable().Detail( "connector runtime pool revision is retired", ) )
var ErrMetadataUnsupported = xerror.Unsupported(xerror.DataSource).Detail("selected-resource Proof metadata is unsupported for this connector operation")
var ErrUnsafeConfigIdentity = xerror.New(xerror.KindInvalidInput, "DATA_SOURCE_CONFIG_IDENTITY_UNAVAILABLE", "data source configuration cannot be pinned safely")
Functions ¶
func BindMetadataPlan ¶
func BindMetadataPlan(plan proofevidence.MetadataPlan, config json.RawMessage, credentialKind string) (proofevidence.MetadataPlan, error)
BindMetadataPlan derives protocol/authentication settings from the tenant's actual connection, without credentials or a provider call.
func Execute ¶
func Execute(ctx context.Context, conn Connector, statement json.RawMessage, params map[string]types.TypedParam, scope *resourcescope.Scope, limits types.ExecutionLimits) (*result.ExecutionResult, error)
Execute preserves ordinary execution for historical requests. A scoped request cannot fall back to a connector that does not implement its policy.
func FTPArtifactConnector ¶
FTPArtifactConnector obtains the private artifact capability from the configured factory, including when ordinary execution tracing wraps it.
func MetadataPolicies ¶
func MetadataPolicies(limits proofevidence.Limits) []proofevidence.OperationPolicy
MetadataPolicies is the explicit connector portfolio allowlist, independent of connection tests, introspection, pipeline execution and transport choice.
func NormalizeCustomerConfig ¶
NormalizeCustomerConfig enforces the public data-source config contract before customer payloads are validated, tested, or persisted.
func PublicConfigDigest ¶
func PublicConfigDigest(kind model.DataSourceType, raw []byte) (string, error)
PublicConfigDigest hashes only the public connector contract. URL credentials and late substitutions cannot become provenance, even through a hash.
func ValidateTransportConfig ¶
ValidateTransportConfig rejects unsafe endpoints before a customer config can be saved or tested.
Types ¶
type BigQueryDefaults ¶
BigQueryDefaults configures operator-controlled endpoint defaults for the BigQuery connector. It keeps private endpoint routing out of the public data source API shape.
type Connector ¶
type Connector interface {
// Execute runs the query described by queryData with the provided TypedParam values.
// Each connector is responsible for normalizing parameter values based on DataType.
// Returns a structured ExecutionResult containing type-specific data and metadata.
Execute(
ctx context.Context,
queryData json.RawMessage,
params map[string]types.TypedParam,
limits ...types.ExecutionLimits,
) (*result.ExecutionResult, error)
// TestConnection verifies that a connection to the data source can be established
// with the configured credentials.
TestConnection(ctx context.Context) error
// Close closes the connector and releases any held resources (connection pools, etc.).
Close() error
}
Connector verifies connectivity and manages connector lifecycle.
func NewConnector ¶
func NewConnector( ctx context.Context, dsType model.DataSourceType, configJSON, credentialsJSON []byte, ) (Connector, error)
NewConnector is the production connector factory function. It handles config/credentials unmarshaling and instantiation for all supported data source types.
type DecodedConnectorPayloads ¶
DecodedConnectorPayloads carries typed connector config and credentials for callers that need validation without constructing a live connector.
func DecodeConnectorPayloads ¶
func DecodeConnectorPayloads( dsType model.DataSourceType, configJSON, credentialsJSON []byte, ) (DecodedConnectorPayloads, bool, error)
DecodeConnectorPayloads decodes config and credentials through the production registry without constructing a connector.
type HubSpotDefaults ¶
HubSpotDefaults configures runtime-only defaults for the HubSpot connector. It is intended for local development and test environments where HubSpot requests should be redirected to a mock service without exposing those knobs on the public data source contract.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager owns reusable PostgreSQL and MySQL connector pools for one process. Other connector types pass through the factory and are closed by their release function.
func NewManager ¶
func NewManager(factory NewConnectorFunc, settings RuntimePoolSettings) (*Manager, error)
NewManager creates and starts a process-local connector runtime pool manager.
func (*Manager) Acquire ¶
func (m *Manager) Acquire( ctx context.Context, identity RuntimeIdentity, configJSON, credentialsJSON []byte, ) (Connector, ReleaseFunc, error)
Acquire returns a connector and a release function. PostgreSQL and MySQL connectors are reused only for an exact runtime identity.
func (*Manager) Close ¶
Close prevents new acquisitions and closes every connector currently owned by the manager. It is safe to call more than once.
func (*Manager) Snapshot ¶
func (m *Manager) Snapshot() RuntimePoolSnapshot
Snapshot returns aggregate cache and database/sql pool utilization.
type NewConnectorFunc ¶
type NewConnectorFunc func(ctx context.Context, dsType model.DataSourceType, configJSON, credentialsJSON []byte) (Connector, error)
NewConnectorFunc is the signature for a connector factory function. It creates a connector for the given data source type with raw config and credentials payloads.
func NewConnectorWithBigQueryDefaults ¶
func NewConnectorWithBigQueryDefaults( base NewConnectorFunc, defaults BigQueryDefaults, ) NewConnectorFunc
NewConnectorWithBigQueryDefaults applies runtime BigQuery defaults before delegating to the provided connector factory.
func NewConnectorWithHubSpotDefaults ¶
func NewConnectorWithHubSpotDefaults( base NewConnectorFunc, defaults HubSpotDefaults, ) NewConnectorFunc
NewConnectorWithHubSpotDefaults applies runtime HubSpot defaults before delegating to the provided connector factory.
func NewConnectorWithPrivatePostgres ¶
func NewConnectorWithPrivatePostgres(base NewConnectorFunc, endpoint PrivatePostgresEndpoint) NewConnectorFunc
NewConnectorWithPrivatePostgres grants only the configured tenant and source destination access to the pinned socket. Pool identities retain tenant scoping.
func NewConnectorWithPrivatePostgresPolicy ¶
func NewConnectorWithPrivatePostgresPolicy(base NewConnectorFunc, policy PrivatePostgresPolicy) NewConnectorFunc
func NewConnectorWithSnowflakeDefaults ¶
func NewConnectorWithSnowflakeDefaults(base NewConnectorFunc, defaults SnowflakeDefaults) NewConnectorFunc
NewConnectorWithSnowflakeDefaults selects an operator-authorized customer identity, or the separately configured organization-bound staging fixture.
func NewConnectorWithTracing ¶
func NewConnectorWithTracing(base NewConnectorFunc) NewConnectorFunc
NewConnectorWithTracing wraps connector operations with safe OpenTelemetry spans.
func NewConnectorWithTransportPolicy ¶
func NewConnectorWithTransportPolicy(base NewConnectorFunc, allowPlaintext bool) NewConnectorFunc
NewConnectorWithTransportPolicy carries an operator-only local policy through every execution role.
type PrivatePostgresEndpoint ¶
type PrivatePostgresEndpoint struct {
Authorize func(context.Context) error
MaxConns int
OrganizationSlug slug.Slug
SourceSlug slug.Slug
Host string
Address netip.AddrPort
}
PrivatePostgresEndpoint is deployment-owned routing, never customer source configuration.
type PrivatePostgresPolicy ¶
type PrivatePostgresPolicy func(context.Context, slug.Slug, slug.Slug, model.DataSourceType, []byte, []byte) (PrivatePostgresEndpoint, error)
PrivatePostgresPolicy grants deployment-owned routing after checking the resource identity and payload.
type ResourceMetadataObserver ¶
type ResourceMetadataObserver interface {
proofevidence.MetadataObserver
MatchesResource(json.RawMessage, json.RawMessage, bool) bool
Description() string
AssessMetadata(json.RawMessage) (model.ProofVerdict, []model.ProofDiagnostic, error)
}
ResourceMetadataObserver owns resource admission and claim semantics alongside its native client. Shared services never interpret provider selectors.
func NewMetadataObserver ¶
func NewMetadataObserver(plan proofevidence.MetadataPlan) (ResourceMetadataObserver, error)
NewMetadataObserver reconstructs trusted connector code, never executable routes from a delivery. Its regenerated plan must match the admitted plan.
type RuntimeIdentity ¶
type RuntimeIdentity struct {
OrganizationSlug slug.Slug
DataSourceSlug slug.Slug
DataSourceType model.DataSourceType
ConfigVersion string
CredentialVersion string
}
RuntimeIdentity identifies one reusable connector configuration without carrying credential material. Version values are opaque to the manager.
type RuntimePoolSettings ¶
type RuntimePoolSettings struct {
MaxEntries int
IdleTimeout time.Duration
MaxLifetime time.Duration
CleanupInterval time.Duration
}
RuntimePoolSettings controls the process-local cache of reusable SQL pools.
type RuntimePoolSnapshot ¶
type RuntimePoolSnapshot struct {
Entries int
Creating int
Retired int
ActiveLeases int
MaxEntries int
OpenConnections int
InUseConnections int
IdleConnections int
MaxOpenConnections int
WaitCount int64
WaitDuration time.Duration
MaxIdleClosed int64
MaxIdleTimeClosed int64
MaxLifetimeClosed int64
}
RuntimePoolSnapshot contains aggregate, tenant-safe process-local pool state.
type SnowflakeDefaults ¶
type SnowflakeDefaults struct {
WIFResolve func(context.Context, slug.Slug, slug.Slug, string) (snowflakewif.Identity, error)
WIFTokenFile string
WIFOrganizationSlug slug.Slug
WIFSocketPath string
}
SnowflakeDefaults configures deployment-owned Snowflake workload identity inputs. These values are applied after customer config normalization and are never persisted.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package filedata provides shared file-format detection, CSV/JSON/spreadsheet parsing, and schema inference helpers used by file-backed data source connectors (FTP, Git).
|
Package filedata provides shared file-format detection, CSV/JSON/spreadsheet parsing, and schema inference helpers used by file-backed data source connectors (FTP, Git). |
|
Package git provides a Git connector for Braidplane data sources.
|
Package git provides a Git connector for Braidplane data sources. |
|
Package param provides utilities for template parameter substitution in query strings.
|
Package param provides utilities for template parameter substitution in query strings. |
|
Package remotefile adapts provider-owned file transports to Braidplane's shared file connector execution contract.
|
Package remotefile adapts provider-owned file transports to Braidplane's shared file connector execution contract. |
|
Package s3 provides an S3-compatible object-store connector for Braidplane.
|
Package s3 provides an S3-compatible object-store connector for Braidplane. |
|
Package stripe implements bounded revenue reads from the Stripe API.
|
Package stripe implements bounded revenue reads from the Stripe API. |