slot

package
v0.32.7 Latest Latest
Warning

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

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

Documentation

Overview

Package slot enforces modeld's single active local model invariant.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Service)

Option configures a slot Service.

func WithBackend

func WithBackend(backend string) Option

WithBackend records the backend mode for Status.

func WithClock added in v0.32.6

func WithClock(now func() time.Time) Option

WithClock overrides the time source (tests).

func WithIdleTTL added in v0.32.6

func WithIdleTTL(ttl time.Duration) Option

WithIdleTTL sets how long a resident model may sit idle before the background reaper releases it (freeing device memory so the GPU can return to idle). Zero (the default) disables idle reaping. Reaping requires StartReaper.

func WithOwner

func WithOwner(owner string) Option

WithOwner records the owner instance expected on direct calls. The gRPC layer also fences requests; this keeps direct tests and future in-process callers honest.

type Service

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

Service wraps a backend transport.Service and exposes it as one active model slot. The wrapped backend still owns native inference; this layer owns residency cardinality, generation fencing, and switch/unload safety.

func New

func New(backend transport.Service, opts ...Option) *Service

New returns a transport service that allows only one active resident model.

func (*Service) Describe

func (*Service) Embed

func (*Service) LoadModel

func (*Service) OpenSession

func (*Service) StartReaper added in v0.32.6

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

StartReaper runs the idle-reaper loop until ctx is canceled. While modeld holds the lease it periodically releases a resident model that has sat idle past the configured TTL, so device memory is freed and the GPU can return to idle (the 24/7-on-a-laptop case). It is a no-op when the TTL is zero. The tick is CPU-only and never touches the GPU.

func (*Service) Status

func (s *Service) Status(ctx context.Context) (transport.DaemonStatus, error)

func (*Service) UnloadModel

func (s *Service) UnloadModel(ctx context.Context, req transport.UnloadModelRequest) error

Jump to

Keyboard shortcuts

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