Documentation
¶
Index ¶
- Constants
- func GetDefaultDevboxID() (string, error)
- func GetID(ctx context.Context, apiConfig *config.API, claim bool, name string) (string, error)
- func GetSessionID(ctx context.Context, apiConfig *config.API, devboxID string) (id string, err error)
- func IDFile() (string, error)
- func RegisterDevbox(ctx context.Context, cfg *config.API, claim bool, name string) (string, error)
- func ValidateDevboxID(ctx context.Context, apiConfig *config.API, devboxID string) error
- type SessionManager
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 ¶
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 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 RegisterDevbox ¶
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.
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)
Click to show internal directories.
Click to hide internal directories.