devbox

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RenewalInterval is how often to renew the devbox session
	RenewalInterval = 22 * time.Second
	// RenewalJitter adds randomness to avoid thundering herd
	RenewalJitter = 5 * time.Second
)

Variables

This section is empty.

Functions

func GetDefaultDevboxID

func GetDefaultDevboxID() (string, error)

GetDefaultDevboxID reads the devbox ID from ~/.signadot/.devbox-id. If the file is not found, it returns an empty string and no error. For other errors, it returns the error.

func GetID

func GetID(ctx context.Context, apiConfig *config.API, claim bool, name string) (string, error)

func GetSessionID

func GetSessionID(ctx context.Context, apiConfig *config.API, devboxID string) (id string, err error)

GetSessionID tries to get the session id of devbox indicated by devboxID. Upon success err is nil and if the devbox is connected, a non-empty string id is returned. If the devbox is not connected, the empty string is returned.

func IDFile

func IDFile() (string, error)

func RegisterDevbox

func RegisterDevbox(ctx context.Context, cfg *config.API, claim bool, name string) (string, error)

RegisterDevbox registers a devbox with the API and returns the devbox ID. If name is empty, it will use the hostname. If claim is true, it will also claim a session.

func ValidateDevboxID

func ValidateDevboxID(ctx context.Context, apiConfig *config.API, devboxID string) error

ValidateDevboxID validates that a devbox ID exists and returns an error if it doesn't.

Types

type SessionManager

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

func NewSessionManager

func NewSessionManager(log *slog.Logger, ciConfig *config.ConnectInvocationConfig) (*SessionManager, error)

func (*SessionManager) GetStatus

func (dsm *SessionManager) GetStatus() (healthy bool, devboxID string, sessionID string, lastErrorTime time.Time, lastError error)

GetStatus returns the current session status.

func (*SessionManager) Start

func (dsm *SessionManager) Start(ctx context.Context)

func (*SessionManager) Stop

func (dsm *SessionManager) Stop(ctx context.Context)

Jump to

Keyboard shortcuts

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