Help us shape the future of Go! Take the 2026 Go Developer Survey

transfer

package
v0.239.0-rc.4 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Identity      string
	WorkspaceRoot string
	IdleExit      time.Duration
	Version       string
	StorageID     string
	Handshake     agui.Handshake
	Entries       []config.EnvironmentEntry
	// Denies reports whether the sandbox policy keeps a project file out of a
	// checkpoint.
	Denies func(projectDir, absPath string) bool
}

Config is what the daemon tells the service about itself.

type Deps

type Deps struct {
	Leases       agentdomain.LeaseStore
	Environments []agentdomain.Environment
	Keyring      *agentinfra.Keyring
	Launch       sessionsdomain.LaunchWorker
	// SelfSuspend parks the runtime this daemon runs in, told whether every
	// agent it ran is done and whether it ran any. Nil on bare metal.
	SelfSuspend func(ctx context.Context, done, known bool) error
}

Deps are the collaborators the service orchestrates.

type Service

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

Service runs agents on environments: it decides where a thread's worker runs (the launch seam the registry calls), moves sessions between environments, and receives the sessions other daemons move here.

func New

func New(cfg Config, deps Deps) *Service

New builds the service. AttachRegistry must follow once the registry exists, since the registry itself is built over LaunchWorker.

func (*Service) AckAttrs

func (s *Service) AckAttrs() map[string]any

AckAttrs are the facts the binding's ack declares about this daemon.

func (*Service) AttachRegistry

func (s *Service) AttachRegistry(registry *sessions.Registry)

AttachRegistry hands the service the thread registry its transfers quiesce, ask and notify.

func (*Service) Handle

func (s *Service) Handle(conn *agui.Conn, frame []byte) bool

Handle claims the environments and transfers frames: the client requests, and the peer frames when the connection is another daemon's.

func (*Service) LaunchWorker

LaunchWorker is the seam the registry launches threads through. It answers at once with a worker that connects in the background: to a process here when this daemon owns the session or nobody does, to the owning environment's daemon when another one does. The registry holds its lock while launching, so nothing here may block.

func (*Service) StopSession

func (s *Service) StopSession(ctx context.Context, to requester, key sessionsdomain.ThreadKey)

StopSession handles a client dropping a session: when a remote environment owns it, the session's runtime there is deleted and the lease released, so the session starts here next time. The client gets thread_stopped, naming the environment whose runtime went or the error that kept it.

func (*Service) Suspend

func (s *Service) Suspend(ctx context.Context)

Suspend parks the runtime this daemon runs in when it idles out, the way a pod daemon suspends its Sandbox before exiting, and says whether every agent it ran is done.

Jump to

Keyboard shortcuts

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