Documentation
¶
Index ¶
- func ProvisionDataSources(ctx context.Context, pool *db.Pool, appSource *Source, querier Querier, ...) error
- type AppInfo
- type DataSourceInfo
- type HeartbeatConfig
- type Querier
- type Source
- func (s *Source) Attach(ctx context.Context, pool *db.Pool) error
- func (s *Source) CatalogSource(ctx context.Context, pool *db.Pool) (cs.Catalog, error)
- func (s *Source) Definition() types.DataSource
- func (s *Source) Detach(ctx context.Context, pool *db.Pool) error
- func (s *Source) Engine() engines.Engine
- func (s *Source) Info() *AppInfo
- func (s *Source) IsAttached() bool
- func (s *Source) Name() string
- func (s *Source) Provision(ctx context.Context, querier sources.Querier) error
- func (s *Source) ReadOnly() bool
- func (s *Source) StartHeartbeat(config HeartbeatConfig, onSuspend func(ctx context.Context, name string) error, ...)
- func (s *Source) StopHeartbeat()
- type TemplateParams
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ProvisionDataSources ¶
func ProvisionDataSources( ctx context.Context, pool *db.Pool, appSource *Source, querier Querier, tmplParams TemplateParams, ) error
ProvisionDataSources reads data sources from _mount.data_sources, cleans up stale registrations, ensures DB schemas, then registers and loads all DS. Two-pass approach:
- ensureDB for PostgreSQL sources (create tables, migrate)
- register + load all sources (any type)
Types ¶
type AppInfo ¶
type AppInfo struct {
Name string
Description string
Version string
URI string
IsDBInitializer bool
IsDBMigrator bool
}
AppInfo holds metadata returned by _mount.info() from a hugr-app source.
type DataSourceInfo ¶
type DataSourceInfo struct {
Name string
Type string
Description string
ReadOnly bool
Path string
Version string
HugrSchema string
}
DataSourceInfo holds a data source declared by a hugr-app.
type HeartbeatConfig ¶
type HeartbeatConfig = sources.HeartbeatConfig
HeartbeatConfig is an alias for sources.HeartbeatConfig.
func DefaultHeartbeatConfig ¶
func DefaultHeartbeatConfig() HeartbeatConfig
DefaultHeartbeatConfig returns the default heartbeat configuration.
type Source ¶
type Source struct {
// contains filtered or unexported fields
}
Source implements the hugr-app data source type. It connects to an external application via DuckDB Airport extension and manages its lifecycle (heartbeat, DB provisioning, schema mounting).
func New ¶
func New(ds types.DataSource, attached bool) (*Source, error)
New creates a new hugr-app source.
func (*Source) Attach ¶
Attach implements sources.Source.
func (*Source) CatalogSource ¶
CatalogSource implements sources.SelfDescriber by reading _mount.schema_sdl() from the attached hugr-app and parsing the returned GraphQL SDL.
func (*Source) Definition ¶
func (s *Source) Definition() types.DataSource
Definition implements sources.Source.
func (*Source) Detach ¶
Detach implements sources.Source.
func (*Source) IsAttached ¶
IsAttached implements sources.Source.
func (*Source) Provision ¶
Provision implements sources.Provisioner. Called by the data source service after Attach() succeeds. Reads _mount.data_sources, registers/initializes/migrates app databases. Template params (VectorSize, EmbedderName) are queried from system config via Querier.
func (*Source) StartHeartbeat ¶
func (s *Source) StartHeartbeat( config HeartbeatConfig, onSuspend func(ctx context.Context, name string) error, onRecover func(ctx context.Context, name string) error, )
StartHeartbeat starts periodic health monitoring. onSuspend is called when the app becomes unreachable. onRecover is called when a suspended app becomes reachable again.
func (*Source) StopHeartbeat ¶
func (s *Source) StopHeartbeat()
StopHeartbeat stops the heartbeat monitor and waits for it to finish.
type TemplateParams ¶
type TemplateParams struct {
VectorSize int // Embedding vector dimension (0 = no embeddings)
EmbedderName string // Name of the system embedder (empty = not configured)
}
TemplateParams holds system-level parameters available for Go template expansion in app's SQL (init/migrate) and SDL (HugrSchema). Follows the same pattern as CoreDB's SchemaTemplateParams.