nucleus

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: Apache-2.0 Imports: 16 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package nucleus is the Nucleus-backed implementation of Orbit's neutral datasource contract (ADR-001). It is the single place in Orbit that imports nucleus/pkg/model and pkg/db: it wraps a *model.Registry, per-alias *db.DB handles, and model.NewCRUD, and translates them to datasource.ModelInfo / datasource.RecordStore / datasource.Page. The Data Studio panel depends only on the datasource contract; the Quark adapter (quarkdatasource) implements the same contract, which is what proved the abstraction did not keep Nucleus's shape.

Deprecated: Nucleus retires pkg/model as a public data layer at its 2.0 (its DEP-2026-024), and this adapter leaves with it: the panel then reads Quark models only, through quarkdatasource. Mount the panel on a quarkdatasource adapter (orbit.Config.DataSource, agent.Config.DataSource) instead. See DEP-2026-002. Scheduled for removal in v2.0.0, no earlier than 2027-01-17.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter deprecated

type Adapter struct {
	// contains filtered or unexported fields
}

Adapter implements datasource.DataSource over Nucleus.

Deprecated: the adapter leaves with Nucleus's pkg/model; use quarkdatasource.Adapter. See DEP-2026-002. Scheduled for removal in v2.0.0, no earlier than 2027-01-17.

func New deprecated

func New(cfg Config) *Adapter

New returns a Nucleus-backed DataSource. Registry and Resolve are required.

Deprecated: the adapter leaves with Nucleus's pkg/model; use quarkdatasource.New. See DEP-2026-002. Scheduled for removal in v2.0.0, no earlier than 2027-01-17.

func (*Adapter) All

func (a *Adapter) All() []datasource.ModelInfo

All returns every registered model as neutral ModelInfo.

func (*Adapter) Get

func (a *Adapter) Get(name string) (datasource.ModelInfo, bool)

Get returns one model by name.

func (*Adapter) Store

func (a *Adapter) Store(modelName, dbAlias string) (datasource.RecordStore, error)

Store resolves the RecordStore for a (model, dbAlias). An empty dbAlias falls back to the model's declared alias, then to DefaultAlias — the same order the panel's handlers applied. Stores are cached per (alias, model), like getCRUD.

type Config deprecated

type Config struct {
	// Registry is the application's shared model registry (rt.Models()).
	Registry *model.Registry

	// DefaultAlias is the database alias used when a model declares none and a
	// request specifies none.
	DefaultAlias string

	// Resolve maps a database alias to its engine-aware handle and dialect
	// string. An empty alias means DefaultAlias. It replaces the panel's old
	// databaseHandle + databaseRuntimeInfoByAlias plumbing.
	Resolve func(alias string) (handle *db.DB, dialect string, err error)

	// Bus is passed to model.NewCRUD (may be nil).
	Bus *signals.Bus

	// Observer, when non-nil, is installed on each CRUD as the fallback live-SQL
	// feed unless BusConnected reports true — mirroring the panel's getCRUD,
	// which skipped the per-CRUD observer once the observability bus was wired.
	Observer     model.SQLQueryObserver
	BusConnected func() bool
}

Config wires the adapter from the same runtime accessors the panel used to hold directly (registry, per-alias handles, the signals bus).

Deprecated: the adapter leaves with Nucleus's pkg/model; use quarkdatasource.Config. See DEP-2026-002. Scheduled for removal in v2.0.0, no earlier than 2027-01-17.

Jump to

Keyboard shortcuts

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