Documentation ¶
Index ¶
- Constants
- Variables
- func RegisterReconcilerInitializer(resourceKind string, initializer ReconcilerInitializer)
- type Controller
- func (c *Controller) AcquireConn(ctx context.Context, connector string) (drivers.Handle, func(), error)
- func (c *Controller) AcquireOLAP(ctx context.Context, connector string) (drivers.OLAPStore, func(), error)
- func (c *Controller) Create(ctx context.Context, name *runtimev1.ResourceName, ...) error
- func (c *Controller) Delete(ctx context.Context, names ...*runtimev1.ResourceName) error
- func (c *Controller) Flush(ctx context.Context) error
- func (c *Controller) Get(ctx context.Context, name *runtimev1.ResourceName) (*runtimev1.Resource, error)
- func (c *Controller) List(ctx context.Context) ([]*runtimev1.Resource, error)
- func (c *Controller) Lock()
- func (c *Controller) Retrigger(ctx context.Context, name *runtimev1.ResourceName, t time.Time) error
- func (c *Controller) Run(ctx context.Context) error
- func (c *Controller) Unlock()
- func (c *Controller) UpdateError(ctx context.Context, name *runtimev1.ResourceName, err error) error
- func (c *Controller) UpdateMeta(ctx context.Context, name *runtimev1.ResourceName, opts *UpdateMetaOptions) error
- func (c *Controller) UpdateSpec(ctx context.Context, name *runtimev1.ResourceName, ...) error
- func (c *Controller) UpdateState(ctx context.Context, name *runtimev1.ResourceName, r *runtimev1.Resource) error
- type ControllerOptions
- type ExportOptions
- type Options
- type Query
- type QueryResult
- type ReconcileResult
- type Reconciler
- type ReconcilerInitializer
- type Runtime
- func (r *Runtime) AcquireHandle(ctx context.Context, instanceID, connector string) (drivers.Handle, func(), error)
- func (r *Runtime) AcquireSystemHandle(ctx context.Context, connector string) (drivers.Handle, func(), error)
- func (r *Runtime) AllowHostAccess() bool
- func (r *Runtime) Catalog(ctx context.Context, instanceID string) (drivers.CatalogStore, func(), error)
- func (r *Runtime) Close() error
- func (r *Runtime) CreateInstance(ctx context.Context, inst *drivers.Instance) error
- func (r *Runtime) DeleteFile(ctx context.Context, instanceID, path string) error
- func (r *Runtime) DeleteInstance(ctx context.Context, instanceID string, dropDB bool) error
- func (r *Runtime) EditInstance(ctx context.Context, inst *drivers.Instance) error
- func (r *Runtime) EvictHandle(ctx context.Context, instanceID, connector string, drop bool) error
- func (r *Runtime) FindInstance(ctx context.Context, instanceID string) (*drivers.Instance, error)
- func (r *Runtime) FindInstances(ctx context.Context) ([]*drivers.Instance, error)
- func (r *Runtime) GetCatalogEntry(ctx context.Context, instanceID, name string) (*drivers.CatalogEntry, error)
- func (r *Runtime) GetFile(ctx context.Context, instanceID, path string) (string, time.Time, error)
- func (r *Runtime) GetInstanceAttributes(ctx context.Context, instanceID string) []attribute.KeyValue
- func (r *Runtime) ListCatalogEntries(ctx context.Context, instanceID string, t drivers.ObjectType) ([]*drivers.CatalogEntry, error)
- func (r *Runtime) ListFiles(ctx context.Context, instanceID, glob string) ([]string, error)
- func (r *Runtime) NewCatalogService(ctx context.Context, instanceID string) (*catalog.Service, error)
- func (r *Runtime) OLAP(ctx context.Context, instanceID string) (drivers.OLAPStore, func(), error)
- func (r *Runtime) PutFile(ctx context.Context, instanceID, path string, blob io.Reader, ...) error
- func (r *Runtime) Query(ctx context.Context, instanceID string, query Query, priority int) error
- func (r *Runtime) Reconcile(ctx context.Context, instanceID string, changedPaths, forcedPaths []string, ...) (*catalog.ReconcileResult, error)
- func (r *Runtime) RefreshSource(ctx context.Context, instanceID, name string) error
- func (r *Runtime) Registry() drivers.RegistryStore
- func (r *Runtime) RenameFile(ctx context.Context, instanceID, fromPath, toPath string) error
- func (r *Runtime) Repo(ctx context.Context, instanceID string) (drivers.RepoStore, func(), error)
- func (r *Runtime) SyncExistingTables(ctx context.Context, instanceID string) error
- type UpdateMetaOptions
Constants ¶
const ( ResourceKindProjectParser string = "rill.runtime.v1.ProjectParser" ResourceKindSource string = "rill.runtime.v1.SourceV2" ResourceKindModel string = "rill.runtime.v1.ModelV2" ResourceKindMetricsView string = "rill.runtime.v1.MetricsViewV2" ResourceKindMigration string = "rill.runtime.v1.Migration" ResourceKindPullTrigger string = "rill.runtime.v1.PullTrigger" ResourceKindRefreshTrigger string = "rill.runtime.v1.RefreshTrigger" ResourceKindBucketPlanner string = "rill.runtime.v1.BucketPlanner" )
Built-in resource kinds
Variables ¶
var ErrInconsistentControllerVersion = errors.New("controller: inconsistent version")
ErrInconsistentControllerVersion is returned from Controller when an unexpected controller version is observed in the DB. An unexpected controller version will only be observed if multiple controllers are running simultanesouly (split brain).
var ErrInconsistentResourceVersion = errors.New("controller: inconsistent version")
ErrInconsistentResourceVersion is returned from catalog update functions when an unexpected resource version is observed in the DB. An unexpected resource version will only be observed if multiple controllers are running simultanesouly (split brain).
var ErrResourceNotFound = errors.New("controller: resource not found")
ErrResourceNotFound is returned from catalog functions when a referenced resource does not exist.
var ReconcilerInitializers = make(map[string]ReconcilerInitializer)
ReconcilerInitializers is a registry of reconciler initializers for different resource kinds. There can be only one reconciler per resource kind.
Functions ¶
func RegisterReconcilerInitializer ¶ added in v0.32.0
func RegisterReconcilerInitializer(resourceKind string, initializer ReconcilerInitializer)
RegisterReconciler registers a reconciler initializer for a specific resource kind
Types ¶
type Controller ¶ added in v0.32.0
type Controller struct { Runtime *Runtime InstanceID string Logger *slog.Logger // contains filtered or unexported fields }
Controller manages the catalog for a single instance and runs reconcilers to migrate the catalog (and related resources in external databases) into the desired state.
func NewController ¶ added in v0.32.0
func NewController(ctx context.Context, rt *Runtime, instanceID string, logger *zap.Logger, opts *ControllerOptions) *Controller
NewController creates a new Controller
func (*Controller) AcquireConn ¶ added in v0.32.0
func (*Controller) AcquireOLAP ¶ added in v0.32.0
func (*Controller) Create ¶ added in v0.32.0
func (c *Controller) Create(ctx context.Context, name *runtimev1.ResourceName, refs []*runtimev1.ResourceName, owner *runtimev1.ResourceName, paths []string, r *runtimev1.Resource) error
func (*Controller) Delete ¶ added in v0.32.0
func (c *Controller) Delete(ctx context.Context, names ...*runtimev1.ResourceName) error
func (*Controller) Get ¶ added in v0.32.0
func (c *Controller) Get(ctx context.Context, name *runtimev1.ResourceName) (*runtimev1.Resource, error)
func (*Controller) Lock ¶ added in v0.32.0
func (c *Controller) Lock()
func (*Controller) Retrigger ¶ added in v0.32.0
func (c *Controller) Retrigger(ctx context.Context, name *runtimev1.ResourceName, t time.Time) error
func (*Controller) Run ¶ added in v0.32.0
func (c *Controller) Run(ctx context.Context) error
Run starts and runs the controller's event loop. It returns when ctx is cancelled or an unrecoverable error occurs.
func (*Controller) Unlock ¶ added in v0.32.0
func (c *Controller) Unlock()
func (*Controller) UpdateError ¶ added in v0.32.0
func (c *Controller) UpdateError(ctx context.Context, name *runtimev1.ResourceName, err error) error
func (*Controller) UpdateMeta ¶ added in v0.32.0
func (c *Controller) UpdateMeta(ctx context.Context, name *runtimev1.ResourceName, opts *UpdateMetaOptions) error
func (*Controller) UpdateSpec ¶ added in v0.32.0
func (c *Controller) UpdateSpec(ctx context.Context, name *runtimev1.ResourceName, refs []*runtimev1.ResourceName, owner *runtimev1.ResourceName, paths []string, r *runtimev1.Resource) error
func (*Controller) UpdateState ¶ added in v0.32.0
func (c *Controller) UpdateState(ctx context.Context, name *runtimev1.ResourceName, r *runtimev1.Resource) error
type ControllerOptions ¶ added in v0.32.0
type ControllerOptions struct { EmbedCatalogInConnector string PersistDeletedResourcesDuration time.Duration }
ControllerOptions provides additional configuration of a controller
type ExportOptions ¶ added in v0.29.1
type ExportOptions struct { Format runtimev1.ExportFormat Priority int PreWriteHook func(filename string) error }
type Query ¶ added in v0.16.0
type Query interface { // Key should return a cache key that uniquely identifies the query Key() string // Deps should return the source and model names that the query targets. // It's used to invalidate cached queries when the underlying data changes. Deps() []string // MarshalResult should return the query result and estimated cost in bytes for caching MarshalResult() *QueryResult // UnmarshalResult should populate a query with a cached result UnmarshalResult(v any) error // Resolve should execute the query against the instance's infra. // Error can be nil along with a nil result in general, i.e. when a model contains no rows aggregation results can be nil. Resolve(ctx context.Context, rt *Runtime, instanceID string, priority int) error // Export resolves the query and serializes the result to the writer. Export(ctx context.Context, rt *Runtime, instanceID string, w io.Writer, opts *ExportOptions) error }
type QueryResult ¶ added in v0.26.0
type ReconcileResult ¶ added in v0.32.0
ReconcileResult propagates results from a reconciler invocation
type Reconciler ¶ added in v0.32.0
type Reconciler interface { Reconcile(ctx context.Context, n *runtimev1.ResourceName) ReconcileResult Close(ctx context.Context) error }
Reconciler implements reconciliation logic for all resources of a specific kind. Reconcilers are managed and invoked by a Controller.
type ReconcilerInitializer ¶ added in v0.32.0
type ReconcilerInitializer func(*Controller) Reconciler
ReconcilerInitializer is a function that initializes a new reconciler for a specific controller
type Runtime ¶
type Runtime struct {
// contains filtered or unexported fields
}
func (*Runtime) AcquireHandle ¶ added in v0.32.0
func (r *Runtime) AcquireHandle(ctx context.Context, instanceID, connector string) (drivers.Handle, func(), error)
AcquireHandle returns instance specific handle
func (*Runtime) AcquireSystemHandle ¶ added in v0.32.0
func (*Runtime) AllowHostAccess ¶ added in v0.27.0
func (*Runtime) CreateInstance ¶
func (*Runtime) DeleteFile ¶ added in v0.16.0
func (*Runtime) DeleteInstance ¶ added in v0.16.0
func (*Runtime) EditInstance ¶ added in v0.23.0
EditInstance edits exisiting instance. The API compares and only evicts caches if drivers or dsn is changed. This is done to ensure that db handlers are not unnecessarily closed
func (*Runtime) EvictHandle ¶ added in v0.32.0
EvictHandle flushes the db handle for the specific connector from the cache
func (*Runtime) FindInstance ¶ added in v0.16.0
func (*Runtime) FindInstances ¶ added in v0.16.0
func (*Runtime) GetCatalogEntry ¶ added in v0.16.0
func (*Runtime) GetInstanceAttributes ¶ added in v0.32.0
func (r *Runtime) GetInstanceAttributes(ctx context.Context, instanceID string) []attribute.KeyValue
GetInstanceAttributes fetches an instance and converts its annotations to attributes nil is returned if an error occurred or instance was not found
func (*Runtime) ListCatalogEntries ¶ added in v0.16.0
func (r *Runtime) ListCatalogEntries(ctx context.Context, instanceID string, t drivers.ObjectType) ([]*drivers.CatalogEntry, error)
func (*Runtime) NewCatalogService ¶ added in v0.24.0
func (*Runtime) RefreshSource ¶ added in v0.16.0
func (*Runtime) Registry ¶ added in v0.16.0
func (r *Runtime) Registry() drivers.RegistryStore
func (*Runtime) RenameFile ¶ added in v0.16.0
type UpdateMetaOptions ¶ added in v0.32.0
type UpdateMetaOptions struct { NewName *runtimev1.ResourceName Refs []*runtimev1.ResourceName Owner *runtimev1.ResourceName Paths []string }
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
compilers
|
|
pkg
|
|
duration
Package duration copied as it is from github.com/senseyeio/duration
|
Package duration copied as it is from github.com/senseyeio/duration |
singleflight
Package singleflight provides a duplicate function call suppression mechanism.
|
Package singleflight provides a duplicate function call suppression mechanism. |
services
|
|
catalog/artifacts/yaml
Package yaml reads and writes artifacts that exactly mirror the internal representation
|
Package yaml reads and writes artifacts that exactly mirror the internal representation |