Documentation
¶
Overview ¶
Package server exposes the store over an HTTP+JSON API and serves the embedded web UI. It binds localhost only and defends the no-auth API with Host/Origin checks. Live updates (SSE), search, attachments, and git status are layered on in later milestones.
Index ¶
- type FileItem
- type Server
- type StoreRegistry
- func (r *StoreRegistry) Active() *store.Store
- func (r *StoreRegistry) ActiveAlias() string
- func (r *StoreRegistry) AliasOf(st *store.Store) string
- func (r *StoreRegistry) All() []string
- func (r *StoreRegistry) Entries() []map[string]string
- func (r *StoreRegistry) Get(alias string) (*store.Store, bool)
- func (r *StoreRegistry) IsWorkspace() bool
- func (r *StoreRegistry) SetActive(alias string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server wires the store into HTTP handlers.
func NewWithRegistry ¶ added in v0.7.0
func NewWithRegistry(reg *StoreRegistry, version string) *Server
NewWithRegistry constructs a server over a multi-repo registry. The active store backs legacy /api routes; /api/r/{alias}/… addresses a specific repo.
func (*Server) Registry ¶ added in v0.7.0
func (srv *Server) Registry() *StoreRegistry
Registry returns the store registry (never nil after New/NewWithRegistry).
func (*Server) SetActiveRepo ¶ added in v0.7.0
SetActiveRepo switches the active store used by legacy /api routes.
func (*Server) StartLiveSync ¶
func (srv *Server) StartLiveSync() func()
StartLiveSync begins watching the .pine directory and broadcasting external changes over SSE. It returns a stop function. When the watcher cannot start, the server still runs (without live updates). In workspace mode every repo is watched; events are tagged with the repo alias.
type StoreRegistry ¶ added in v0.7.0
type StoreRegistry struct {
// contains filtered or unexported fields
}
StoreRegistry holds one or more open .pine stores for multi-repo serve. Repos register themselves on `pine init` into ~/.pine/repos.json, and `pine serve` auto-discovers them — no workspace name or flag is required.
func NewRegistry ¶ added in v0.7.0
func NewRegistry(ordered []string, stores map[string]*store.Store, paths map[string]string) (*StoreRegistry, error)
NewRegistry builds a registry from alias -> store. The first alias in order becomes active.
func SingleRegistry ¶ added in v0.7.0
func SingleRegistry(st *store.Store) *StoreRegistry
SingleRegistry wraps one store under alias "default".
func (*StoreRegistry) Active ¶ added in v0.7.0
func (r *StoreRegistry) Active() *store.Store
func (*StoreRegistry) ActiveAlias ¶ added in v0.7.0
func (r *StoreRegistry) ActiveAlias() string
func (*StoreRegistry) AliasOf ¶ added in v0.7.0
func (r *StoreRegistry) AliasOf(st *store.Store) string
func (*StoreRegistry) All ¶ added in v0.7.0
func (r *StoreRegistry) All() []string
All returns aliases in registration order.
func (*StoreRegistry) Entries ¶ added in v0.7.0
func (r *StoreRegistry) Entries() []map[string]string
Entries returns alias, project name, and repo path for each store.
func (*StoreRegistry) Get ¶ added in v0.7.0
func (r *StoreRegistry) Get(alias string) (*store.Store, bool)
func (*StoreRegistry) IsWorkspace ¶ added in v0.7.0
func (r *StoreRegistry) IsWorkspace() bool
IsWorkspace reports whether more than one repo is registered. The UI uses this to decide whether to render the repo switcher.
func (*StoreRegistry) SetActive ¶ added in v0.7.0
func (r *StoreRegistry) SetActive(alias string) error