push

package
v0.0.372 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package push is the CLI→local-UI-server change publisher (epic:serve-split). When satelle.toml configures [server] endpoint, mutating verbs emit a fire-and-forget change event to the server ingest. Unset = inert (no network). Failures never alter verb outcomes or block the caller (sty_126228b2).

Index

Constants

View Source
const DefaultTimeout = 500 * time.Millisecond

DefaultTimeout bounds a single POST. Short so a black-holed endpoint cannot hang a process; the call is already asynchronous from the verb path.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	RepoKey string `json:"repo_key"`
	Topic   string `json:"topic"`  // coarse panel: stories | tasks | docs
	Entity  string `json:"entity"` // story | task | doc | ledger (derived)
	At      string `json:"at"`     // RFC3339 UTC
}

Event is the JSON body POSTed to the configured server's change ingest.

type Publisher

type Publisher struct {
	Endpoint string
	RepoKey  string
	// Client is optional; nil uses a client with DefaultTimeout.
	Client *http.Client
	// Path is the ingest path under Endpoint; default "/ingest/change".
	Path string
	// Now is optional; defaults to time.Now.
	Now func() time.Time
	// OnPost is an optional test hook invoked just before the request is sent
	// (after body marshal). Not used in production.
	OnPost func(*http.Request)
}

Publisher posts change events to Endpoint. Safe for concurrent use. A zero Publisher (empty Endpoint) is a no-op.

func (*Publisher) Active

func (p *Publisher) Active() bool

Active reports whether the publisher will attempt network I/O.

func (*Publisher) Notify

func (p *Publisher) Notify(topic string)

Notify is the ChangeNotifier sink: fire-and-forget POST. Never blocks the caller beyond the cost of scheduling a goroutine. Never panics. The CLI drain path uses PostContext instead so delivery completes before exit.

func (*Publisher) PostContext added in v0.0.282

func (p *Publisher) PostContext(ctx context.Context, topic string) (err error)

PostContext POSTs a change event, honouring ctx's deadline. When ctx has no deadline, DefaultTimeout is applied. Errors are returned for callers that care; the CLI drain swallows them (fail-silent). Never panics.

Jump to

Keyboard shortcuts

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