Documentation
¶
Index ¶
- Variables
- func HashToken(token string) string
- type InviteRecord
- type InviteToken
- type NodeRegistration
- type NodeSummary
- type PGStore
- func (s PGStore) CloseSession(ctx context.Context, sessionID, nodeID string, now time.Time) error
- func (s PGStore) ConsumeBootstrap(ctx context.Context, nodeID, bootstrapHash string, now time.Time) error
- func (s PGStore) CreateInvite(ctx context.Context, invite InviteRecord) error
- func (s PGStore) ListNodes(ctx context.Context) ([]NodeSummary, error)
- func (s PGStore) MarkStale(ctx context.Context, cutoff, now time.Time) (int64, error)
- func (s PGStore) OpenSession(ctx context.Context, nodeID, protocolVersion, remoteAddr string, now time.Time) (string, error)
- func (s PGStore) PublicKeyForNode(ctx context.Context, nodeID string) (string, error)
- func (s PGStore) RecordHeartbeat(ctx context.Context, sessionID string, heartbeat protocol.NodeHeartbeatPayload, ...) error
- func (s PGStore) RecordSafetyEvent(ctx context.Context, event protocol.NodeSafetyEventPayload, ...) error
- func (s PGStore) RecordStateChanged(ctx context.Context, stateChanged protocol.NodeStateChangedPayload, ...) error
- func (s PGStore) RegisterNode(ctx context.Context, registration NodeRegistration) (RegistrationCreated, error)
- type RegisterRequest
- type RegisterResult
- type RegistrationCreated
- type Repository
- type ScheduleDefaults
- type Service
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidInvite = errors.New("invalid invite token") ErrInviteUsed = errors.New("invite token has already been used") ErrInviteExpired = errors.New("invite token has expired") ErrInvalidBootstrap = errors.New("invalid bootstrap token") ErrBootstrapUsed = errors.New("bootstrap token has already been used") ErrBootstrapExpired = errors.New("bootstrap token has expired") ErrRepositoryMissing = errors.New("registration repository is not configured") )
Functions ¶
Types ¶
type InviteRecord ¶
type InviteToken ¶
type NodeRegistration ¶
type NodeSummary ¶
type NodeSummary struct {
ID string `json:"id"`
State string `json:"state"`
CurrentModelID string `json:"current_model_id,omitempty"`
LastSeenAt *time.Time `json:"last_seen_at,omitempty"`
SessionStatus string `json:"session_status"`
LastHeartbeatAt *time.Time `json:"last_heartbeat_at,omitempty"`
ScheduleState string `json:"schedule_state,omitempty"`
ThermalState string `json:"thermal_state,omitempty"`
Paused bool `json:"paused"`
Draining bool `json:"draining"`
}
type PGStore ¶
func (PGStore) CloseSession ¶
func (PGStore) ConsumeBootstrap ¶
func (PGStore) CreateInvite ¶
func (s PGStore) CreateInvite(ctx context.Context, invite InviteRecord) error
func (PGStore) OpenSession ¶
func (PGStore) PublicKeyForNode ¶
func (PGStore) RecordHeartbeat ¶
func (PGStore) RecordSafetyEvent ¶
func (PGStore) RecordStateChanged ¶
func (PGStore) RegisterNode ¶
func (s PGStore) RegisterNode(ctx context.Context, registration NodeRegistration) (RegistrationCreated, error)
type RegisterRequest ¶
type RegisterResult ¶
type RegisterResult struct {
NodeID string `json:"node_id"`
BootstrapToken string `json:"bootstrap_token"`
BootstrapTokenExpiresAt time.Time `json:"bootstrap_token_expires_at"`
FleetSchedule *ScheduleDefaults `json:"fleet_schedule,omitempty"`
}
type RegistrationCreated ¶
type RegistrationCreated struct {
NodeID string
BootstrapTokenExpiresAt time.Time
FleetSchedule *ScheduleDefaults
}
type Repository ¶
type Repository interface {
CreateInvite(ctx context.Context, invite InviteRecord) error
RegisterNode(ctx context.Context, registration NodeRegistration) (RegistrationCreated, error)
ConsumeBootstrap(ctx context.Context, nodeID, bootstrapHash string, now time.Time) error
}
type ScheduleDefaults ¶
type Service ¶
type Service struct {
Repository Repository
Now func() time.Time
InviteTTL time.Duration
BootstrapTTL time.Duration
TokenBytes int
}
func (Service) ConsumeBootstrap ¶
func (Service) CreateInvite ¶
func (Service) RegisterNode ¶
func (s Service) RegisterNode(ctx context.Context, req RegisterRequest) (RegisterResult, error)
Click to show internal directories.
Click to hide internal directories.