platform

package
v2.3.4 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mode

type Mode string

Mode selects which backend the binary runs.

const (
	// ModeLocal runs the single-binary SQLite + stdio-MCP path.
	// This is byte-identical to pre-v2 behavior.
	ModeLocal Mode = "local"

	// ModeServer runs the multi-tenant PostgreSQL + authenticated HTTP path.
	// cmd/cortex is the sole bridge to the server composition root.
	ModeServer Mode = "server"
)
const DefaultMode Mode = ModeLocal

DefaultMode is used when no --mode flag is provided on the command line.

func ParseMode

func ParseMode(args []string) (Mode, []string)

ParseMode extracts the --mode flag from args, returning the resolved Mode and a cleaned copy of args with the flag removed.

When --mode is absent, DefaultMode (ModeLocal) is returned and args are returned unchanged (same slice values, no allocation).

Supports both syntactic forms:

cortex --mode local <command>    (space-separated)
cortex --mode=local <command>    (equals form)

The flag may appear before or after the subcommand without affecting downstream argument parsing in internal/cli.

type Runtime

type Runtime struct {
	// App is the local-mode composition root from internal/app.
	// Non-nil when Mode == ModeLocal; nil for server mode.
	App *app.App
}

Runtime holds the wired services for the selected Mode.

This type is the local composition selector. The server runtime is owned by internal/platform/server and wired directly by cmd/cortex.

func Local

func Local(ctx context.Context, opts app.Options) (*Runtime, error)

Local wires the local-mode Runtime by delegating to app.Open.

This function MUST NOT duplicate or alter app wiring. It calls app.Open with the exact same (ctx, opts) arguments, preserving byte-identical local behavior: the same SQLite database, the same store bundle, the same config defaults, the same archival lifecycle, the same stdio-MCP transport.

The returned Runtime wraps the *app.App unchanged.

func Select

func Select(mode Mode, ctx context.Context, opts app.Options) (*Runtime, error)

Select wires the Runtime for the given Mode.

ModeLocal → delegates to Local, which calls app.Open byte-identically

(same SQLite database, same stores, same config defaults).

ModeServer returns an error because this local-only API intentionally cannot import the server composition root. cmd/cortex performs that bridge.

func (*Runtime) Close

func (r *Runtime) Close() error

Close releases resources held by the Runtime.

Directories

Path Synopsis
Package server is the PostgreSQL composition root.
Package server is the PostgreSQL composition root.

Jump to

Keyboard shortcuts

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