server

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: MIT Imports: 38 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChangeSet

type ChangeSet = recorddiff.ChangeSet

type Options

type Options struct {
	Config  *appconfig.Manager
	Version version.Info
}

type RecordChange

type RecordChange = recorddiff.RecordChange

Compatibility aliases keep the existing server API while sharing one diff implementation with CLI watch-mode webhooks.

type Server

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

Server represents the HTTP/WebSocket server

func NewServer

func NewServer(dbPath string, charMap converter.CharMapping, useTempFile ...bool) (*Server, error)

NewServer creates a new server instance

func NewServerWithOptions

func NewServerWithOptions(dbPath string, charMap converter.CharMapping, options Options, useTempFile ...bool) (*Server, error)

func (*Server) AppMetadata

func (s *Server) AppMetadata() map[string]interface{}

AppMetadata returns version/resource/config metadata for embedded and IPC clients.

func (*Server) Close

func (s *Server) Close() error

Close cleans up server resources

func (*Server) Config

func (s *Server) Config() appconfig.Config

Config returns the active configuration snapshot.

func (*Server) Info

func (s *Server) Info() (map[string]interface{}, error)

Info returns database schema and metadata using the same shape served by GET /api/info.

func (*Server) RecordResult

func (s *Server) RecordResult() (recordpipe.Result, error)

func (*Server) Records

func (s *Server) Records() (map[string]interface{}, error)

Records returns the current records using the same transformed shape served by GET /api/records.

func (*Server) RecordsPayload

func (s *Server) RecordsPayload() (interface{}, error)

func (*Server) Refresh

func (s *Server) Refresh()

Refresh forces a data refresh broadcast to browser, IPC, and embedded subscribers.

func (*Server) ReplaceConfig

func (s *Server) ReplaceConfig(cfg appconfig.Config) (appconfig.Config, error)

ReplaceConfig persists and broadcasts a new configuration snapshot.

func (*Server) Router

func (s *Server) Router() http.Handler

Router returns the HTTP router used by the standalone server. Embedded hosts can mount it in their own HTTP stack instead of opening a patris-export port.

func (*Server) ShowToast

func (s *Server) ShowToast(req ToastRequest) error

ShowToast displays a native notification and/or broadcasts it to connected browser, IPC, and embedded subscribers.

func (*Server) Start

func (s *Server) Start(addr string) error

Start starts the HTTP server

func (*Server) StartWatching

func (s *Server) StartWatching(debounceDuration time.Duration) error

StartWatching starts watching the database file for changes with the specified debounce duration

func (*Server) Status

func (s *Server) Status() map[string]interface{}

Status returns process and database lock status using the same shape served by GET /api/status.

func (*Server) SubscribeEvents

func (s *Server) SubscribeEvents(buffer int) (<-chan map[string]interface{}, func())

SubscribeEvents subscribes to the same event stream used by the WebSocket broadcaster. The returned unsubscribe function must be called by the host.

type ToastRequest

type ToastRequest struct {
	Type      string `json:"type,omitempty"`
	Title     string `json:"title"`
	Message   string `json:"message"`
	Icon      string `json:"icon,omitempty"`
	Source    string `json:"source,omitempty"`
	Native    *bool  `json:"native,omitempty"`
	Broadcast *bool  `json:"broadcast,omitempty"`
}

ToastRequest represents a desktop/browser notification request.

Jump to

Keyboard shortcuts

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