devbox

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: May 28, 2026 License: Apache-2.0 Imports: 18 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 IsNotFound added in v1.7.0

func IsNotFound(err error) bool

IsNotFound reports whether err represents a 404 response from the Signadot API. Used to detect a cached devbox ID that the server has since deleted (e.g. after the 30-day idle TTL). The SDK's transport middleware (transport.FixAPIErrors) wraps every 4xx/5xx response in *transport.APIError before the swagger reader sees it, so that is the type we unwrap to here.

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