server

package
v2.2.3 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2026 License: MIT Imports: 39 Imported by: 0

Documentation

Overview

Package server is the PostgreSQL composition root. It is deliberately kept below internal/platform so the local composition never imports this package or any network-backed adapter.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Operations

type Operations interface {
	SaveObservation(context.Context, *domain.Observation) error
	SaveObservationWithEffect(context.Context, *domain.Observation) (domain.SaveEffect, error)
	ExecuteHandoff(context.Context, domain.HandoffRequest) (domain.ObservationWriteResult, error)
	GetObservationByID(context.Context, int64) (*domain.Observation, error)
	GetObservationByPublicID(context.Context, string) (*domain.Observation, error)
	UpdateObservation(context.Context, *domain.Observation) error
	DeleteObservation(context.Context, int64) error
	CreateSession(context.Context, *domain.Session) error
	ListSessions(context.Context, string) ([]*domain.Session, error)
	GetServerStats(context.Context) (*domain.ServerStats, error)
	ListAuditEvents(context.Context, int) ([]*domain.AuditEntry, error)
	ListProjects(context.Context) ([]string, error)
	ListObservations(context.Context, domain.ObservationFilter) ([]*domain.Observation, error)
	SearchObservations(context.Context, string, domain.SearchOptions) ([]*domain.SearchResult, error)
	CreateGraphEdge(context.Context, *domain.Edge) error
	GetGraphEdgeByPublicID(context.Context, string) (*domain.Edge, error)
	GetRelatedObservations(context.Context, int64, int) ([]*domain.Observation, error)
	GetGraphSubgraph(context.Context, string, int, int) (*domain.GraphSubgraph, error)
	DeleteGraphEdge(context.Context, int64) error
	GetImportanceScore(context.Context, int64) (*domain.ImportanceScore, error)
	CreateUser(context.Context, identity.UserCreate) (identity.UserRecord, error)
	ListUsers(context.Context) ([]identity.UserRecord, error)
	GetUserProfile(context.Context, string) (*identity.UserRecord, error)
	SetUserActive(context.Context, string, bool) error
	IssueToken(context.Context, identity.TokenIssue) (identity.IssuedToken, error)
	ListTokens(context.Context) ([]identity.TokenRecord, error)
	RevokeToken(context.Context, string) error
	RotateToken(context.Context, string) (identity.IssuedToken, error)
	PushSync(context.Context, *domain.SyncBatch) (*domain.SyncResult, error)
	PullSync(context.Context, int64, int) (*domain.SyncPage, error)
	GetProjectContext(context.Context, string) (*domain.ProjectContext, error)
	ListProjectSkills(context.Context, string) ([]*domain.ProjectSkill, error)
	GetProjectSkill(context.Context, string, string) (*domain.ProjectSkill, error)
	SaveProjectArtifact(context.Context, domain.SaveProjectArtifactInput) (*domain.ProjectArtifactItem, error)
	ListProjectArtifacts(context.Context, string, string) ([]*domain.ProjectArtifactItem, error)
	DeleteProjectArtifact(context.Context, string, string) error
	GetProjectDuplicates(context.Context) ([]domain.ProjectDuplicateGroup, error)
	MergeProject(context.Context, string, string) (*domain.ProjectMergeResult, error)
}

Operations is the operation-only server boundary implemented by postgres.AuthorizedStore. It deliberately contains no repository accessors.

type Runtime

type Runtime struct {
	Config     *config.Config
	Pool       *pgxpool.Pool
	Vectors    domain.VectorIndex
	Embeddings embedding.Service
	Lifecycle  *lifecycle.ArchivalService
	// contains filtered or unexported fields
}

Runtime owns every resource created by Open. Close is idempotent and follows the dependency order: HTTP transport, background lifecycle, vector client, SQL pool, then migration handle.

func Open

func Open(ctx context.Context, cfg config.Config) (*Runtime, error)

Open validates server-only configuration, applies the PostgreSQL migration, and constructs tenant-scoped repositories. It performs no work for local mode; callers select this root explicitly.

func (*Runtime) Address

func (r *Runtime) Address() string

Address is the configured HTTP listen address.

func (*Runtime) Close

func (r *Runtime) Close() error

Close gracefully shuts down background work before closing database handles.

func (*Runtime) Serve

func (r *Runtime) Serve(ctx context.Context) error

Serve listens until ctx is canceled or the HTTP server fails.

Jump to

Keyboard shortcuts

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