apiserver

package
v0.50.0 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2026 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClusterMember

type ClusterMember struct {
	ID       string
	Addr     string
	Status   string
	VMCount  int
	CPUCap   int
	MemCap   int64
	LastSeen time.Time
}

type ClusterMemberLister

type ClusterMemberLister interface {
	Members() []ClusterMember
}

type Server

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

Server listens on a Unix socket and dispatches JSON-RPC requests to a vm.Manager.

func NewServer

func NewServer(mgr vm.Manager, netStore *network.Store, svcMgr *service.Manager, endpoint string, shutdownFn func(), version string, clusterLister ClusterMemberLister) (*Server, error)

NewServer creates a Server that will listen on endpoint. The endpoint may carry a scheme (unix:// or tcp://); a bare value is treated as a Unix socket path. For unix endpoints any stale socket file is removed before binding. shutdownFn is called (in a goroutine) when a Daemon.Shutdown RPC is received; pass nil to disable remote shutdown. version is returned by Daemon.Version RPC; pass "" if unknown.

func (*Server) EnableImageBuild

func (s *Server) EnableImageBuild(mkfs image.MkfsFunc)

EnableImageBuild turns on the Image.Build RPC with a fixed mkfs function. It requires an image store (see SetImageStore). Mostly used in tests; the daemon uses EnableImageBuildResolver to resolve mkfs lazily.

func (*Server) EnableImageBuildResolver

func (s *Server) EnableImageBuildResolver(resolver func(context.Context) (image.MkfsFunc, error))

EnableImageBuildResolver turns on the Image.Build RPC with a resolver that produces the mkfs function on first use. This lets the daemon download the kernel toolchain on the first build instead of blocking startup. A successful result is cached; errors are not, so a failed download can be retried.

func (*Server) Serve

func (s *Server) Serve(ctx context.Context) error

Serve accepts connections and handles them until ctx is canceled.

func (*Server) SetAuthToken

func (s *Server) SetAuthToken(token string)

SetAuthToken requires every connection to authenticate via an Auth.Hello handshake carrying token before any other method is dispatched. An empty token (the default) disables authentication. Call once before Serve.

func (*Server) SetImageStore

func (s *Server) SetImageStore(store *image.Store)

SetImageStore attaches the daemon's image store, enabling image resolution for VM.Run as well as the Image.List and Image.Remove RPCs. Call once after NewServer, before Serve.

Jump to

Keyboard shortcuts

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