Documentation
¶
Overview ¶
Package preview implements server-local job preview leases and loopback proxying.
Index ¶
- Variables
- type Lease
- type Manager
- func (m *Manager) Close(id, reason string) error
- func (m *Manager) CloseAll()
- func (m *Manager) CloseJob(jobID string)
- func (m *Manager) Create(ctx context.Context, jobID, caller, host string, port, ttl int, ...) (Lease, string, error)
- func (m *Manager) Get(id string) (Lease, bool, error)
- func (m *Manager) List(jobID string) ([]Lease, error)
- func (m *Manager) Renew(id string, ttl int, actor string) (Lease, error)
- func (m *Manager) Revoke(id, actor string) error
- func (m *Manager) String() string
- func (m *Manager) Sweep()
Constants ¶
This section is empty.
Variables ¶
var ErrNotActive = errors.New("preview lease is not active")
ErrNotActive is returned when an operation needs a live lease and the lease is gone.
Functions ¶
This section is empty.
Types ¶
type Lease ¶
type Lease struct {
ID string `json:"id"`
JobID string `json:"job_id"`
CallerID string `json:"caller_id"`
WorkerID string `json:"worker_id"`
Port int `json:"port"`
State string `json:"state"`
CreatedAt int64 `json:"created_at"`
ExpiresAt int64 `json:"expires_at"`
CloseReason string `json:"close_reason,omitempty"`
}
Lease is the non-secret view of a preview lease. Port is the preview port the browser opens (not the job's target port).
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func (*Manager) Renew ¶ added in v0.205.0
Renew moves an active lease's expiry to now + ttl (ttl defaults and is capped like on create, so a lease never runs longer than max_ttl_sec from the renewal) and restarts its timer.