Versions in this module Expand all Collapse all v0 v0.0.7 Oct 27, 2026 v0.0.6 Oct 16, 2026 Changes in this version type Node + func (n *Node) DialStream(ctx context.Context, to Member, path string) (net.Conn, http.Header, error) v0.0.5 Oct 12, 2026 Changes in this version + const DefaultBusFlush + const DefaultBusPoll + const DefaultBusRetention + const DefaultCampaign + const DefaultHeartbeat + const DefaultMemberTTL + const DefaultOrphanRunGrace + const DefaultPeerHeaderTimeout + const DefaultProbeInterval + const DefaultProbeTimeout + const HeaderPeer + const HeaderPeerIP + const HeaderPeerNonce + const HeaderPeerSig + const HeaderPeerTime + const HeaderPeerTo + const HeaderServedBy + const OwnerKindRun + const PingPath + var ErrLegacyHub = errors.New("hubcluster: a hub that cannot join a cluster controls this state") + var ErrMemberUnresponsive = errors.New("hubcluster: the member is not answering") + var ErrNoRoute = errors.New("hubcluster: member advertises no URL") + var ErrNotPeer = errors.New("hubcluster: not a peer request") + func IsPeerRequest(r *http.Request) bool + func LiveMemberRows(dbPath string, now time.Time) ([]statedb.HubMemberRow, error) + func RowAlive(r statedb.HubMemberRow, now time.Time) bool + func RunClaimLive(o Owner, now time.Time, grace time.Duration) bool + func StripPeerHeaders(h http.Header) + func WithPeerCall(ctx context.Context, pc PeerCall) context.Context + type BusStats struct + Cursor int64 + Delivered uint64 + Dropped uint64 + Gaps uint64 + Published uint64 + type CallError struct + Member string + Message string + Status int + func (e *CallError) Error() string + type Client struct + Host string + IP string + Proto string + type Event struct + At time.Time + Key string + Origin string + Payload json.RawMessage + Seq int64 + Target string + Topic string + func (e Event) Decode(v any) error + type LegacyHubError struct + Age time.Duration + Holder statedb.HubLeaseRow + TTL time.Duration + func (e *LegacyHubError) Error() string + func (e *LegacyHubError) Unwrap() error + type Member struct + Address string + AdvertiseURL string + Alive bool + BootID string + Endpoints map[string]string + HeartbeatAt time.Time + Hostname string + ID string + Leader bool + LeftAt time.Time + PID int + Self bool + StartedAt time.Time + Unresponsive bool + UnresponsiveSince time.Time + Version string + func (m Member) Endpoint(name string) string + type Node struct + func Join(opts Options) (*Node, error) + func (n *Node) Adopt(o Owner, meta any) (bool, error) + func (n *Node) Assert(kind, key string, meta any) error + func (n *Node) BusStats() BusStats + func (n *Node) Call(ctx context.Context, to Member, method, path string, in, out any) error + func (n *Node) Claim(kind, key string, meta any) (Owner, bool, error) + func (n *Node) Close() error + func (n *Node) Drop(o Owner) (bool, error) + func (n *Node) FlushBus() + func (n *Node) Forward(w http.ResponseWriter, r *http.Request, to Member, clientIP string) error + func (n *Node) ForwardAs(w http.ResponseWriter, r *http.Request, to Member, c Client) error + func (n *Node) HasPeers() bool + func (n *Node) ID() string + func (n *Node) IsAlive(id string) bool + func (n *Node) IsLeader() bool + func (n *Node) LeaderID() string + func (n *Node) LeadsAdoption() bool + func (n *Node) LiveMembers() []Member + func (n *Node) Lookup(kind, key string) (o Owner, found bool, err error) + func (n *Node) MarkSeen(kind, key string, expires time.Time) (bool, error) + func (n *Node) Member(id string) (Member, bool) + func (n *Node) Members() []Member + func (n *Node) OnBusGap(fn func()) + func (n *Node) OnLeadership(fn func(leader bool)) + func (n *Node) OnMembership(fn func(live []Member)) + func (n *Node) Orphans(kind string) ([]Owner, error) + func (n *Node) Owned(kind string) ([]Owner, error) + func (n *Node) Owns(kind, key string) bool + func (n *Node) Peers() []Member + func (n *Node) PollBus() + func (n *Node) ProbePeers(ctx context.Context) + func (n *Node) Publish(topic, key string, payload any) + func (n *Node) PublishTo(target, topic, key string, payload any) + func (n *Node) Release(kind, key string) (bool, error) + func (n *Node) Responsive(id string) bool + func (n *Node) Self() Member + func (n *Node) Serving(id string) bool + func (n *Node) Start(ctx context.Context) + func (n *Node) Subscribe(topic string, fn func(Event)) + func (n *Node) Terms() int + func (n *Node) UpdateMeta(kind, key string, meta any) (bool, error) + func (n *Node) VerifyPeer(r *http.Request) (PeerCall, error) + func (n *Node) WhileLeader(name string, fn func(ctx context.Context)) + type Options struct + Address string + AdvertiseURL string + BusFlush time.Duration + BusPoll time.Duration + BusRetention time.Duration + Campaign time.Duration + DBPath string + Endpoints map[string]string + Heartbeat time.Duration + Identity hublease.Identity + InstanceID string + LeaderInterval time.Duration + LeaderTTL time.Duration + Logf func(format string, args ...any) + MemberTTL time.Duration + Now func() time.Time + Peer PeerOptions + ProbeInterval time.Duration + ProbeTimeout time.Duration + ProcessAlive func(pid int) bool + Store Store + UnresponsiveAfter time.Duration + Version string + type Owner struct + Alive bool + InstanceID string + Key string + Kind string + Member Member + Row statedb.HubOwnerRow + Self bool + func PeekRunClaims(dbPath string, now time.Time) ([]Owner, error) + func (o Owner) ClaimedAt() time.Time + func (o Owner) Meta(v any) error + type PeerCall struct + ClientIP string + From Member + func PeerCallFrom(ctx context.Context) (PeerCall, bool) + type PeerOptions struct + HeaderTimeout time.Duration + RootCAs *x509.CertPool + ServerName string + Timeout time.Duration + type RunClaimMeta struct + Dispatching bool + RunID string + func (m RunClaimMeta) MayHaveWorkload() bool + type Store interface + AppendHubEvents func(events []statedb.HubEventRow) (int64, error) + ClaimHubOwner func(row, expect statedb.HubOwnerRow) (bool, error) + GetHubOwner func(kind, key string) (statedb.HubOwnerRow, error) + HeartbeatHubMember func(instanceID string, at time.Time) (bool, error) + HubEventBounds func() (lowest, highest, issued int64, err error) + HubEventsAfter func(after int64, limit int) ([]statedb.HubEventRow, error) + HubMeta func(key string) (string, bool, error) + JoinHubMember func(row statedb.HubMemberRow) error + LeaveHubMember func(instanceID string, at time.Time) error + ListHubMembers func() ([]statedb.HubMemberRow, error) + ListHubOwners func(kind string) ([]statedb.HubOwnerRow, error) + MarkHubSeen func(kind, key string, expires, now time.Time) (bool, error) + PruneHubEvents func(cutoff time.Time) (int64, error) + PruneHubMembers func(cutoff time.Time) (int64, error) + PruneHubSeen func(now time.Time) (int64, error) + PutHubOwner func(row statedb.HubOwnerRow) error + ReleaseHubOwner func(kind, key, instanceID string) (bool, error) + ReleaseHubOwnerIfClaim func(expect statedb.HubOwnerRow) (bool, error) + SetHubMeta func(key, value string) error + SetHubMetaIfAbsent func(key, value string) (string, error) + UpdateHubOwnerMeta func(kind, key, instanceID, meta string, at time.Time) (bool, error)