Documentation
¶
Overview ¶
Package vm owns persistent VM identities and reuses sandbox scheduling and durable disks for each cold boot.
Index ¶
- func New(ctx context.Context, opts ServiceOpts) error
- type Gateway
- type ICESession
- type ImageVerifier
- type Runtime
- type Service
- type ServiceOpts
- type VMRedisRepository
- func (r *VMRedisRepository) AcquireICELease(ctx context.Context, fragment, lease string, ttl time.Duration) (int, error)
- func (r *VMRedisRepository) GetICESession(ctx context.Context, fragment string) (*ICESession, error)
- func (r *VMRedisRepository) HasActivity(ctx context.Context, id string) (bool, error)
- func (r *VMRedisRepository) IncrementICERegistrations(ctx context.Context, id string) (int, error)
- func (r *VMRedisRepository) RegisterICESession(ctx context.Context, fragment string, session ICESession, ttl time.Duration) (bool, error)
- func (r *VMRedisRepository) ReleaseActivity(ctx context.Context, id, lease string) error
- func (r *VMRedisRepository) ReleaseICELease(ctx context.Context, fragment, lease string) error
- func (r *VMRedisRepository) RenewActivity(ctx context.Context, id, lease string) error
- func (r *VMRedisRepository) RenewICELease(ctx context.Context, fragment, lease string, ttl time.Duration) error
- type VMRepository
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Gateway ¶
type Gateway interface {
GetOrCreateStub(context.Context, *pb.GetOrCreateStubRequest) (*pb.GetOrCreateStubResponse, error)
StopContainer(context.Context, *pb.StopContainerRequest) (*pb.StopContainerResponse, error)
ResolveCPUTier(ctx context.Context, workspace *types.Workspace, requested types.CPUTier, pool string, eligible bool) (types.CPUTier, error)
IsHostedCPUPool(string) bool
}
type ICESession ¶
type ImageVerifier ¶
type ImageVerifier interface {
VerifyImageBuild(context.Context, *pb.VerifyImageBuildRequest) (*pb.VerifyImageBuildResponse, error)
}
type Runtime ¶
type Runtime interface {
pb.PodServiceServer
RunVM(context.Context, *auth.AuthInfo, string, string, types.VMSpec, string, map[string]string) error
VMPortReady(context.Context, string, string, uint32) (bool, error)
ForwardVM(echo.Context, string, string) error
TunnelVM(echo.Context, string, uint32) error
SetVMICEHandler(func(net.Conn))
}
type ServiceOpts ¶
type ServiceOpts struct {
StateRepo VMRepository
Config types.VMConfig
BackendRepo repository.BackendRepository
ContainerRepo repository.ContainerRepository
Runtime Runtime
Gateway Gateway
Images ImageVerifier
RouteGroup *echo.Group
Server *echo.Echo
BackendDialer *network.BackendDialer
TCPConfig types.PodTCPConfig // Shared raw TCP listener used by ICE-TCP media.
}
type VMRedisRepository ¶
type VMRedisRepository struct {
// contains filtered or unexported fields
}
func (*VMRedisRepository) AcquireICELease ¶
func (*VMRedisRepository) GetICESession ¶
func (r *VMRedisRepository) GetICESession(ctx context.Context, fragment string) (*ICESession, error)
func (*VMRedisRepository) HasActivity ¶
func (*VMRedisRepository) IncrementICERegistrations ¶
func (*VMRedisRepository) RegisterICESession ¶
func (r *VMRedisRepository) RegisterICESession(ctx context.Context, fragment string, session ICESession, ttl time.Duration) (bool, error)
func (*VMRedisRepository) ReleaseActivity ¶
func (r *VMRedisRepository) ReleaseActivity(ctx context.Context, id, lease string) error
func (*VMRedisRepository) ReleaseICELease ¶
func (r *VMRedisRepository) ReleaseICELease(ctx context.Context, fragment, lease string) error
func (*VMRedisRepository) RenewActivity ¶
func (r *VMRedisRepository) RenewActivity(ctx context.Context, id, lease string) error
func (*VMRedisRepository) RenewICELease ¶
type VMRepository ¶
type VMRepository interface {
RenewActivity(ctx context.Context, id, lease string) error
HasActivity(ctx context.Context, id string) (bool, error)
ReleaseActivity(ctx context.Context, id, lease string) error
IncrementICERegistrations(ctx context.Context, id string) (int, error)
// RegisterICESession returns false for a colliding registration.
RegisterICESession(ctx context.Context, fragment string, session ICESession, ttl time.Duration) (bool, error)
// GetICESession returns nil for an absent or expired registration.
GetICESession(ctx context.Context, fragment string) (*ICESession, error)
AcquireICELease(ctx context.Context, fragment, lease string, ttl time.Duration) (int, error)
RenewICELease(ctx context.Context, fragment, lease string, ttl time.Duration) error
ReleaseICELease(ctx context.Context, fragment, lease string) error
}
VMRepository owns ephemeral activity and media coordination.
func NewVMRedisRepository ¶
func NewVMRedisRepository(rdb *common.RedisClient) VMRepository
Click to show internal directories.
Click to hide internal directories.