daemon

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run() error

Run starts the daemon process. Called when argv[1] == "__daemon".

func SpawnOrConnect

func SpawnOrConnect() (string, error)

SpawnOrConnect ensures a daemon is running and returns the nonce for IPC auth. If no daemon is listening, it spawns one and waits for it to be ready.

Types

type Keepalive

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

Keepalive manages per-server sliding window timers. When a server is not touched within the idle timeout, its connection is closed.

func NewKeepalive

func NewKeepalive(pool *mcppool.Pool) *Keepalive

NewKeepalive creates a new keepalive manager.

func (*Keepalive) Begin

func (k *Keepalive) Begin(server string)

Begin marks the beginning of an in-flight request for a server. Any existing idle timer is canceled so a long-running request is never evicted.

func (*Keepalive) End

func (k *Keepalive) End(server string)

End marks completion of an in-flight request for a server. The idle timer starts only after the final in-flight request completes.

func (*Keepalive) SetOnAllIdle

func (k *Keepalive) SetOnAllIdle(fn func())

SetOnAllIdle configures an optional callback fired once the final idle timer expires and there are no in-flight requests remaining.

func (*Keepalive) Stop

func (k *Keepalive) Stop()

Stop cancels all keepalive timers.

func (*Keepalive) Touch

func (k *Keepalive) Touch(server string)

Touch resets the idle timer for a server when it has no in-flight requests.

Jump to

Keyboard shortcuts

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