setup

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2026 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Overview

Package setup holds the onboarding and configuration services: the documents the local API returns and the pure reads that build the same documents from state files when no server is running. Presentations (CLI, TUI, web) render these documents; they never compute next actions, order or validation themselves.

See decision 0006 and spec/features/configuration-parity#REQ:json-equals-api.

Index

Constants

View Source
const (
	KeyServerPort = "server.port"
	// KeyServerCORS lists the browser app origins allowed to call /v1/… and
	// /token with bearer tokens (capability 25, CLI only: exception E7).
	KeyServerCORS = "server.cors"
)

Configuration keys. Telemetry and the global context follow in later increments.

View Source
const (
	MinPort = 1
	MaxPort = 65535
)

MinPort and MaxPort bound every port ovdb accepts, from a flag, an environment variable, `ovdb config set server.port` or the TUI's own pre-submit check — one place so the range cannot drift between them.

View Source
const (
	// UnmountTimeout bounds the wait for in-flight requests when a database
	// is removed, reloaded or the server stops.
	UnmountTimeout = 10 * time.Second
	// DefaultMountTimeout bounds one database's mount.
	DefaultMountTimeout = 5 * time.Second
)

Timeouts.

View Source
const (
	ActionEditName     = "edit_name"
	ActionEditLocation = "edit_location"
	ActionDatabases    = "databases"
	ActionDone         = "done"
	// ActionUse makes the database current: for this project in the TUI,
	// as the default for all projects in the web console (parity E3).
	ActionUse = "use"
	// ActionBrowse opens Browse data for the database.
	ActionBrowse = "browse"
)

Next actions presentations can act on in place (envelope.Next.Action). For edit_name, a command naming a database (`ovdb databases create notes-2`) carries the suggested name: see SuggestedName.

View Source
const (
	DemoDefaultID = "todo"
	DemosDir      = "demos"
	// DemosFile, in OVDB home, records every demo install wrote: the demo is
	// the database registered with that id at that place, never whatever
	// happens to live in a folder named demos.
	DemosFile = "demos.json"
)

The built-in TODO demo's database id and folder (spec/features/todo-demo). The demo service lives in internal/setup/demo; the status document only needs to find an installed demo, so that part is here.

View Source
const (
	EngineInGitDB   = "ingitdb"
	EngineSQLite    = "sqlite"
	EngineFirestore = "firestore"
	EngineMySQL     = "mysql"
	EnginePostgres  = "postgres"
)

Engine ids. They are the storage.engine values the manifest parser and openvaultdb-go's mount accept; engines_test.go fails when the two drift.

View Source
const (
	SetupGuided   = "guided"
	SetupManifest = "manifest"
)

Setup kinds: an engine is created and connected in guided steps, or set up with a manifest file only (database-setup-and-providers#REQ:manifest-only-engines-are-honest).

View Source
const (
	// DatabasesDir holds one manifest per registered database, <id>.yaml.
	DatabasesDir = "databases"
	// CataloguesDir holds the inferred-schema catalogues OVDB keeps for
	// registered databases, so mounting never writes into user storage.
	CataloguesDir = "catalogues"
	// MountsFile is the running server's per-database mount state.
	MountsFile = "mounts.json"
)

Registry locations inside OVDB home and the runtime directory.

View Source
const (
	MountMounting       = "mounting" // loading after a start or reload
	MountMounted        = "mounted"
	MountNeedsAttention = "needs_attention"
	MountUnknown        = "unknown" // no server running
)

Mount states.

View Source
const (
	StateRunning    = "running"
	StateNotRunning = "not_running"
	StateStopping   = "stopping" // only in the shutdown response
)

Server states.

View Source
const (
	ScopeReadOnly  = "read-only"
	ScopeReadWrite = "read-write"
	ScopeCreateDB  = "create-db"
)

Token scopes: the capability sets `ovdb token create --scope` names.

View Source
const ConfigFile = "config.yaml"

ConfigFile is the configuration file in OVDB home.

View Source
const EnvPort = "OVDB_PORT"

EnvPort overrides the configured port for one shell.

View Source
const ManifestDocsURL = "https://github.com/openvaultdb/openvaultdb-go#manifest-examples"

ManifestDocsURL explains manifests, engines and schema modes.

View Source
const SchemaDocsURL = "https://github.com/openvaultdb/openvaultdb-go#schema-modes"

SchemaDocsURL explains schema modes and how to declare collections.

Variables

Keys lists the supported keys, for usage errors.

Functions

func CatalogueDir added in v0.11.0

func CatalogueDir(home string) string

CatalogueDir is <home>/catalogues.

func CreatedNext added in v0.11.0

func CreatedNext(database Database) []envelope.Next

CreatedNext is what to do after creating database: for SQLite, describing the data comes before anything that writes (database-setup-and-providers#REQ:sqlite-next-step-is-schema). Only implemented commands are offered; Browse data, Explore data and AI agent skills join as their increments land.

func DatabaseIDs added in v0.11.0

func DatabaseIDs(databases []Database) []string

DatabaseIDs are the ids of databases, in order.

func DefaultPath added in v0.11.0

func DefaultPath(dataHome, engine, id string) string

DefaultPath is where a new database lives unless the person picks another place: <data home>/<id>/ for inGitDB, <data home>/<id>.sqlite for SQLite (database-setup-and-providers#REQ:create-new-database). Clients call it with the data home they resolved.

func DemoLocation added in v0.12.0

func DemoLocation(dataHome, id string) string

DemoLocation is where database id keeps the demo under dataHome: <data home>/demos/<id>.

func FallbackAddress

func FallbackAddress(port int) string

FallbackAddress is the address that works where *.localhost does not.

func ForgetDemo added in v0.12.0

func ForgetDemo(home, id string) error

ForgetDemo removes the record for database id, if any.

func HasCreateDBCapability added in v0.13.0

func HasCreateDBCapability(caps []string) bool

HasCreateDBCapability reports whether caps contains databases:create (a server-level token needs no database).

func Location added in v0.11.0

func Location(m *manifest.Manifest, baseDir string) string

Location describes where m keeps its data without any credential: the absolute storage path, or for server engines where the connection comes from. baseDir resolves relative paths.

func ManifestPath added in v0.11.0

func ManifestPath(home, id string) string

ManifestPath is where database id is registered.

func ManifestSteps added in v0.11.0

func ManifestSteps(engine, home string) []envelope.Next

ManifestSteps is how to set up a manifest-only engine today: write a manifest, edit it, put it in the registry folder and load it; guided connect comes later. home is OVDB home ("" names it generically).

func MountsPath added in v0.11.0

func MountsPath(runtimeDir string) string

MountsPath is <runtime>/mounts.json.

func NormalizeOrigins added in v0.9.0

func NormalizeOrigins(origins []string) []string

NormalizeOrigins cleans origins read from a hand-edited config.yaml the way ParseOrigins cleans CLI input, dropping entries that are not origins (and a trailing slash, which browsers never send).

func ParseOrigins added in v0.9.0

func ParseOrigins(value string) ([]string, *envelope.Error)

ParseOrigins parses a comma-separated list of browser origins (scheme://host[:port], http or https, nothing after the host). An empty value clears the list.

func ParsePort

func ParsePort(value, source string) (int, *envelope.Error)

ParsePort validates a port number given through source (a flag, variable or key name).

func PrimaryAddress

func PrimaryAddress(port int) string

PrimaryAddress is the address people open.

func RecordDemo added in v0.12.0

func RecordDemo(home string, record DemoRecord) error

RecordDemo adds or replaces the record for record.Database. Only the server holding home.lock calls it.

func RegistryDir added in v0.11.0

func RegistryDir(home string) string

RegistryDir is <home>/databases.

func ReloadedNext added in v0.11.0

func ReloadedNext(database Database) []envelope.Next

ReloadedNext is what to do after a reload.

func ResolvePort

func ResolvePort(flagPort int, getenv paths.Getenv, config Config) (port int, explicit bool, err *envelope.Error)

ResolvePort applies --port > OVDB_PORT > server.port > 6832 (REQ:port-precedence). explicit is true for the flag and the variable, which must match a running server's port.

func SameLocation added in v0.12.0

func SameLocation(a, b string) bool

SameLocation reports whether two absolute locations name the same place, ignoring case where the file system usually does.

func ScopeCapabilities added in v0.13.0

func ScopeCapabilities(scope string) ([]string, error)

ScopeCapabilities maps a token scope to its capabilities; "" is read-write.

func SuggestedName added in v0.11.0

func SuggestedName(next envelope.Next) string

SuggestedName is the name an edit_name next action suggests, or "".

func UnknownConfigKey

func UnknownConfigKey(key string) *envelope.Error

UnknownConfigKey is invalid_argument naming the supported keys.

func ValidPort added in v0.10.0

func ValidPort(port int) bool

ValidPort reports whether port is in range for a TCP listener.

func ValidateCreate added in v0.11.0

func ValidateCreate(request *CreateRequest) *envelope.Error

ValidateCreate checks a request without touching anything. It fills the default engine and normalizes the location with this OS's path rules (so C:/Users/… is absolute on Windows, and a trailing separator is fine).

func WriteMounts added in v0.11.0

func WriteMounts(runtimeDir string, mounts Mounts) error

WriteMounts atomically writes mounts.json owner-only.

Types

type Badge added in v0.9.0

type Badge struct {
	Tone     string `json:"tone"` // ok, warn, neutral
	LabelKey string `json:"label_key"`
}

Badge is a server state as presentations show it: a tone and a copy key.

func StateBadge added in v0.9.0

func StateBadge(state string) Badge

StateBadge maps a server state to its badge.

type Config

type Config struct {
	Server ServerConfig `yaml:"server,omitempty" json:"server"`
}

Config is config.yaml. Unset values are omitted and mean "default".

func LoadConfig

func LoadConfig(home string) (Config, error)

LoadConfig reads config.yaml; a missing file is the empty configuration.

type ConfigChange

type ConfigChange struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

ConfigChange is the body of PUT /api/local/v1/config.

type ConfigDocument

type ConfigDocument struct {
	Schema int    `json:"schema"`
	Config Config `json:"config"`
	// Changed is set on a change's result: false when the value was
	// already the one asked for, so nothing needs a restart.
	Changed *bool           `json:"changed,omitempty"`
	Next    []envelope.Next `json:"next"`
}

ConfigDocument is the body of GET/PUT /api/local/v1/config and the --json output of `ovdb config get|set`.

func ApplyConfigChange

func ApplyConfigChange(dirs paths.Dirs, change ConfigChange, serverRunning bool) (ConfigDocument, error)

ApplyConfigChange validates change, writes config.yaml owner-only and returns the resulting document. The caller must be the home's single writer: the running server, or a client holding home.lock (serverRunning false).

func NewConfigDocument

func NewConfigDocument(config Config, changedWhileRunning bool) ConfigDocument

NewConfigDocument wraps config. A change made while the server runs gets the restart that applies it as its next action.

type CopyRef added in v0.9.0

type CopyRef struct {
	Key    string            `json:"key"`
	Params map[string]string `json:"params,omitempty"`
}

CopyRef is copy a presentation renders: a catalogue key and its params.

func ContextStatus added in v0.11.0

func ContextStatus(context *dbcontext.Context) CopyRef

ContextStatus is the status line part naming the current database and its scope (first-run-onboarding#REQ:home-status-line).

func DatabasesStatus added in v0.11.0

func DatabasesStatus(databases []Database) CopyRef

DatabasesStatus is the status line part counting databases and how many need attention (first-run-onboarding#REQ:home-status-line).

func StatusLine added in v0.11.0

func StatusLine(server Server, databases []Database, context *dbcontext.Context) []CopyRef

StatusLine is Home's status line and `ovdb status`'s summary: server and databases for a first run; databases, current database and server once there is a database.

type CreateRequest added in v0.11.0

type CreateRequest struct {
	ID     string `json:"id"`
	Engine string `json:"engine"`
	Path   string `json:"path"`
}

CreateRequest is the body of POST /api/local/v1/databases. Path is the absolute location the client resolved (by default under its data home).

type Database added in v0.11.0

type Database struct {
	ID       string `json:"id"`
	Engine   string `json:"engine,omitempty"`
	Location string `json:"location,omitempty"`
	State    string `json:"state,omitempty"` // mounted, needs_attention, unknown
	// Reason says, redacted, why a database needs attention.
	Reason string `json:"reason,omitempty"`
	// Manifest is the registry file, so a person can inspect or fix it.
	Manifest string `json:"manifest"`
}

Database is one registered database as every interface lists it.

func FindDemo added in v0.12.0

func FindDemo(home string, databases []Database) (Database, bool)

FindDemo is the installed demo among databases: a registered inGitDB database whose id and location match a recorded install. The default id wins over others.

func ListDatabases added in v0.11.0

func ListDatabases(home string, mounts *Mounts) ([]Database, error)

ListDatabases builds the databases list from the registry. mounts is the running server's state; nil means no server runs, and every database is "unknown (server not running)".

type DatabaseResult added in v0.11.0

type DatabaseResult struct {
	Schema   int             `json:"schema"`
	Database Database        `json:"database"`
	Next     []envelope.Next `json:"next"`
}

DatabaseResult is the body of a successful create, reload or remove, and the --json output of `ovdb databases create|reload|remove`.

func NewRemovedResult added in v0.11.0

func NewRemovedResult(database Database) DatabaseResult

NewRemovedResult is the result of removing database.

type DatabasesDocument added in v0.11.0

type DatabasesDocument struct {
	Schema    int             `json:"schema"`
	Databases []Database      `json:"databases"`
	Next      []envelope.Next `json:"next"`
}

DatabasesDocument is the body of GET /api/local/v1/databases and the --json output of `ovdb databases`.

func NewDatabasesDocument added in v0.11.0

func NewDatabasesDocument(databases []Database) DatabasesDocument

NewDatabasesDocument wraps databases with the next actions that apply.

type DemoRecord added in v0.12.0

type DemoRecord struct {
	App      string `json:"app"`
	Database string `json:"database"`
	Location string `json:"location"`
}

DemoRecord is one demo install: its app, database id and folder.

func DemoRecordFor added in v0.12.0

func DemoRecordFor(home, location string) (DemoRecord, bool)

DemoRecordFor is the recorded install at location, if any.

func ReadDemos added in v0.12.0

func ReadDemos(home string) []DemoRecord

ReadDemos lists the recorded demo installs; a missing or unreadable file is none.

type DemoStatus added in v0.12.0

type DemoStatus struct {
	Installed bool   `json:"installed"`
	Database  string `json:"database,omitempty"`
	Location  string `json:"location"`
}

DemoStatus is the demo field group of the status document (first-run-onboarding#REQ:status-command).

func NewDemoStatus added in v0.12.0

func NewDemoStatus(dirs paths.Dirs, databases []Database) DemoStatus

NewDemoStatus describes the demo among databases, or where it would go.

type Engine added in v0.11.0

type Engine struct {
	ID          string   `json:"id"`
	Name        string   `json:"name"`
	Description string   `json:"description"`
	SchemaModes []string `json:"schema_modes"`
	// Pinned engines come first, in catalogue order, and presentations
	// separate them from the rest.
	Pinned bool   `json:"pinned"`
	Setup  string `json:"setup"` // guided, manifest
	// Note adds a detail under the description, e.g. GitHub-backed inGitDB.
	Note string `json:"note,omitempty"`
	// ManifestSteps are the steps for a manifest-only engine, in order; the
	// last one points to the documentation.
	ManifestSteps []envelope.Next `json:"manifest_steps,omitempty"`
}

Engine is one storage choice in the catalogue.

func Engines added in v0.11.0

func Engines() []Engine

Engines is the storage catalogue in display order: inGitDB and SQLite pinned, then the rest by name (database-setup-and-providers#REQ:catalogue-order-and-filter). This order does not change the backend build order.

func FilterEngines added in v0.11.0

func FilterEngines(engines []Engine, filter string) []Engine

FilterEngines keeps the engines whose id, name or description contains filter, ignoring case, in their order (REQ:catalogue-order-and-filter). The web console applies the same rule in web/src/engines.ts.

func FindEngine added in v0.11.0

func FindEngine(id string) (Engine, bool)

FindEngine returns the catalogue entry for id.

type EnginesDocument added in v0.11.0

type EnginesDocument struct {
	Schema  int             `json:"schema"`
	Engines []Engine        `json:"engines"`
	Next    []envelope.Next `json:"next"`
}

EnginesDocument is the body of GET /api/local/v1/engines and the --json output of `ovdb engines`.

func NewEnginesDocument added in v0.11.0

func NewEnginesDocument(home string) EnginesDocument

NewEnginesDocument wraps the catalogue for OVDB home.

type HomeDocument added in v0.9.0

type HomeDocument struct {
	Schema      int          `json:"schema"`
	StatusLine  []CopyRef    `json:"status_line"`
	QuestionKey string       `json:"question_key"`
	Options     []HomeOption `json:"options"`
}

HomeDocument is the body of GET /api/local/v1/home: the status line and the implemented Home options in the founder's order (first-run-onboarding#REQ:home-menu-options, REQ:home-status-line). The TUI and the web console both render it, so neither builds the menu.

func NewHome added in v0.9.0

func NewHome(server Server, databases []Database, context *dbcontext.Context) HomeDocument

NewHome builds Home for server, the registered databases and the context that applies to the caller (nil when none does). Options appear here only once they are implemented; later increments insert theirs in the founder's order.

A returning user (at least one database) sees one summary line above the same question and menu: `2 databases · using todo (this project) · OVDB server running at …` (first-run-onboarding#REQ:returning-user-home).

type HomeOption added in v0.9.0

type HomeOption struct {
	ID             string `json:"id"`
	Group          string `json:"group"` // primary, secondary
	LabelKey       string `json:"label_key"`
	WebLabelKey    string `json:"web_label_key,omitempty"`
	DescriptionKey string `json:"description_key,omitempty"`
	Badge          *Badge `json:"badge,omitempty"`
	// Disabled options are shown with DescriptionKey saying why.
	Disabled bool `json:"disabled,omitempty"`
}

HomeOption is one Home menu option. LabelKey is the terminal wording; WebLabelKey, when set, replaces it in the web console, which cannot start the server that serves it (parity E1).

type MountRecord added in v0.11.0

type MountRecord struct {
	ID       string `json:"id"`
	Manifest string `json:"manifest"`
	State    string `json:"state"`
	Reason   string `json:"reason,omitempty"`
}

MountRecord is one database's entry in mounts.json.

type Mounter added in v0.11.0

type Mounter interface {
	Mount(db *core.Database) error
	UnmountContext(ctx context.Context, id string) error
}

Mounter is the part of the openvaultdb-go server the registry drives.

type Mounts added in v0.11.0

type Mounts struct {
	Schema    int           `json:"schema"`
	Databases []MountRecord `json:"databases"`
}

Mounts is mounts.json: what the running server mounted and what needs attention, with reasons already redacted.

func ReadMounts added in v0.11.0

func ReadMounts(runtimeDir string) (*Mounts, error)

ReadMounts reads mounts.json; nil when there is none.

type Registration added in v0.11.0

type Registration struct {
	ID       string
	Manifest string
	Parsed   *manifest.Manifest // nil when the file cannot be parsed
	Err      error              // why it cannot be parsed
}

Registration is one manifest file in the registry, read without mounting.

func ReadRegistry added in v0.11.0

func ReadRegistry(home string) ([]Registration, error)

ReadRegistry lists the manifests in <home>/databases, sorted by file name. A manifest that cannot be read or parsed is still listed, under its file name, with its error: one broken file never hides the others (local-server-and-web-console#REQ:registry-serving).

func (Registration) Describe added in v0.11.0

func (r Registration) Describe() Database

Describe is registration as listed, with state and reason left to the caller.

type Registry added in v0.11.0

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

Registry is the running server's view of <home>/databases: it mounts every manifest, keeps each one's mount state, and creates, reloads and removes registrations while serving. Only the server holding home.lock owns one (local-server-and-web-console#REQ:single-server-home-lock).

Database ids are unique ignoring case (registry files live on file systems that may ignore case); commands name a database by its exact id, or by any casing when exactly one registered id matches.

func OpenRegistry added in v0.11.0

func OpenRegistry(dirs paths.Dirs, srv Mounter, logf func(format string, args ...any), opts RegistryOptions) (*Registry, error)

OpenRegistry reads <home>/databases and records every registration as mounting, without mounting anything: call MountAll once the server listens. It never blocks on storage.

func (*Registry) AwaitMount added in v0.12.0

func (r *Registry) AwaitMount(ctx context.Context, id string)

AwaitMount waits while database id is still mounting after a start or reload, up to its mount deadline, so a data request that arrives right after a command auto-started the server finds the database served rather than not found (database-context-navigation#REQ:data-commands-use-server). It returns at once for a database in any other state, or none.

func (*Registry) Close added in v0.11.0

func (r *Registry) Close()

Close unmounts every database, releasing engine resources such as SQLite file handles, and removes mounts.json: without a server, mount state is unknown. Mounts still in flight are closed when they finish.

func (*Registry) Create added in v0.11.0

func (r *Registry) Create(request CreateRequest) (DatabaseResult, error)

Create registers, creates and mounts a new database without a restart. It never overwrites: a registered id is already_exists and a location in use is location_not_empty, both with nothing changed (database-setup-and-providers#REQ:create-never-overwrites).

func (*Registry) List added in v0.11.0

func (r *Registry) List() ([]Database, error)

List is the databases list with this server's mount state.

func (*Registry) MountAll added in v0.11.0

func (r *Registry) MountAll(ctx context.Context)

MountAll mounts every registration still mounting, each with its own deadline and in parallel, and returns when all are settled or ctx ends (a server stopping while storage is unreachable). A database that fails, times out or whose storage is missing needs attention, with a redacted reason in status, mounts.json and server.log (local-server-and-web-console#REQ:registry-serving).

func (*Registry) Mounts added in v0.11.0

func (r *Registry) Mounts() *Mounts

Mounts is the current mount state.

func (*Registry) Reconnect added in v0.12.0

func (r *Registry) Reconnect(request CreateRequest) (DatabaseResult, error)

Reconnect registers and serves an existing inGitDB folder without touching its files: a database OVDB created and a person later removed from OVDB (its data kept), such as the TODO demo installed again into its own folder. Connecting any other storage is `ovdb databases connect`.

func (*Registry) Reload added in v0.11.0

func (r *Registry) Reload(ctx context.Context, id string) (DatabaseResult, error)

Reload mounts database id again from its manifest, so an edited manifest (a SQLite schema, a fixed connection variable) or restored storage takes effect without restarting the server.

func (*Registry) ReloadAll added in v0.11.0

func (r *Registry) ReloadAll(ctx context.Context) (DatabasesDocument, error)

ReloadAll reloads every registration, picks up manifests added to <home>/databases by hand and forgets ones deleted by hand.

func (*Registry) Remove added in v0.11.0

func (r *Registry) Remove(ctx context.Context, id string) (DatabaseResult, error)

Remove unregisters database id without deleting its data, and says where the data remains (database-setup-and-providers#REQ:list-and-remove). The manifest goes first, so a failure leaves the database registered and served; the drain of in-flight requests happens without the registry lock, so status and lists never wait on it.

type RegistryOptions added in v0.11.0

type RegistryOptions struct {
	MountTimeout time.Duration
}

RegistryOptions tune a registry; the zero value is the default.

type Server

type Server struct {
	State           string     `json:"state"`
	Address         string     `json:"address"`
	FallbackAddress string     `json:"fallback_address"`
	Port            int        `json:"port"`
	Version         string     `json:"version,omitempty"`
	PID             int        `json:"pid,omitempty"`
	StartedAt       *time.Time `json:"started_at,omitempty"`
	Log             string     `json:"log"`
}

Server describes the local OVDB server in status and server documents. It carries no uptime: a start time keeps two reads of the same server byte-identical, and presentations format the uptime from it.

func RunningServer

func RunningServer(record *runtime.Record, dirs paths.Dirs) Server

RunningServer describes the server recorded in record.

func StoppedServer

func StoppedServer(port int, dirs paths.Dirs) Server

StoppedServer describes a server that is not running and would start on port.

type ServerConfig

type ServerConfig struct {
	Port int      `yaml:"port,omitempty" json:"port,omitempty"`
	CORS []string `yaml:"cors,omitempty" json:"cors,omitempty"`
}

ServerConfig is the server section of config.yaml.

type ServerDocument

type ServerDocument struct {
	Schema int             `json:"schema"`
	Server Server          `json:"server"`
	Next   []envelope.Next `json:"next"`
}

ServerDocument is the body of GET /api/local/v1/server and the --json output of `ovdb server start|stop|restart|status`. Next holds the commands that change the server's state, so every presentation shows the same ones (the web console cannot run them itself: parity E1 and E2).

func NewServerDocument

func NewServerDocument(server Server) ServerDocument

NewServerDocument wraps server in its document.

type Status

type Status struct {
	Schema    int        `json:"schema"`
	Version   string     `json:"version"`
	Locations paths.Dirs `json:"locations"`
	Server    Server     `json:"server"`
	Databases []Database `json:"databases"`
	// Context is the database and path that apply where the client runs
	// (capability 14); null when none does.
	Context *dbcontext.Context `json:"context"`
	// Demo says whether the TODO demo is installed, and where.
	Demo DemoStatus      `json:"demo"`
	Next []envelope.Next `json:"next"`
}

Status is the body of GET /api/local/v1/status and of `ovdb status --json` (first-run-onboarding#REQ:status-command). Later increments add databases, context, demo, skills and telemetry as they are implemented.

func NewStatus

func NewStatus(version string, dirs paths.Dirs, server Server, databases []Database, context *dbcontext.Context) Status

NewStatus builds the status for this ovdb version, locations, server and registered databases. next lists only implemented options, in the founder's order.

Directories

Path Synopsis
Package dbcontext is the one resolver for "which database and path does this command act on" (decision 0008, spec/features/database-context-navigation REQ:use-sets-scoped-context and REQ:context-lookup).
Package dbcontext is the one resolver for "which database and path does this command act on" (decision 0008, spec/features/database-context-navigation REQ:use-sets-scoped-context and REQ:context-lookup).
Package demo is the built-in TODO demo service (spec/features/todo-demo, decision 0010): two lists, To buy and To watch, in a schemaless inGitDB database registered as `todo` at <data home>/demos/todo, and the documents `ovdb demo install|open|status`, the TUI, the web console and the TODO app render.
Package demo is the built-in TODO demo service (spec/features/todo-demo, decision 0010): two lists, To buy and To watch, in a schemaless inGitDB database registered as `todo` at <data home>/demos/todo, and the documents `ovdb demo install|open|status`, the TUI, the web console and the TODO app render.

Jump to

Keyboard shortcuts

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