Documentation
¶
Overview ¶
Package sessionapi is the session view the hive TUI, the CLI, and Hive Desktop share. Local runs it on an in-process engine; the daemon client runs it over RPC.
Index ¶
- Variables
- type API
- type Local
- func (l *Local) CheckSessionRisk(ctx context.Context, id string) (sessionsvc.Risk, error)
- func (l *Local) CreateFromRequest(ctx context.Context, req sessionsvc.LaunchRequest) (session.Session, error)
- func (l *Local) CreateSession(ctx context.Context, opts sessionsvc.CreateOptions) (*session.Session, error)
- func (l *Local) CreateSessionWithWindows(ctx context.Context, req sessionsvc.NewSessionRequest, ...) (*session.Session, error)
- func (l *Local) DeleteSession(ctx context.Context, id string) error
- func (l *Local) EditSessionTags(ctx context.Context, id string, add, remove []string) (session.Session, error)
- func (l *Local) FetchBatch(ctx context.Context, sessions []*session.Session, ...) map[string]status.TerminalStatus
- func (l *Local) GetSession(ctx context.Context, id string) (session.Session, error)
- func (l *Local) GitStatuses(ctx context.Context, ids []string) (map[string]gitstatus.Status, error)
- func (l *Local) ListSessions(ctx context.Context) ([]session.Session, error)
- func (l *Local) Prune(ctx context.Context, all bool) (int, error)
- func (l *Local) RecycleSession(ctx context.Context, id string, w io.Writer) error
- func (l *Local) RenameSession(ctx context.Context, id, name string) error
- func (l *Local) SessionBranches(ctx context.Context, id string) ([]string, error)
- func (l *Local) SessionChanges(ctx context.Context, id string, target gitstatus.DiffTarget) (gitstatus.Changes, error)
- func (l *Local) SessionFileDiffs(ctx context.Context, id string, target gitstatus.DiffTarget, paths []string) ([]gitstatus.FileDiff, error)
- func (l *Local) SessionLaunchOptions(ctx context.Context) (sessionsvc.LaunchOptions, error)
- func (l *Local) SetSessionGroup(ctx context.Context, id, group string) error
- func (l *Local) SetSessionTags(ctx context.Context, id string, tags []string) (session.Session, error)
- func (l *Local) StartTmuxSession(ctx context.Context, id string) (multiplexer.LaunchResult, error)
- func (l *Local) StatusAvailable() bool
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrRiskCheckTimedOut = errors.New("the risk check timed out")
ErrRiskCheckTimedOut is a risk check that the server began and did not finish, as with a slow repository. A caller can offer to go on without the check.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API interface {
ListSessions(ctx context.Context) ([]session.Session, error)
GetSession(ctx context.Context, id string) (session.Session, error)
// CreateSession writes progress to opts.Progress when set. Callers
// resolve an empty opts.Remote and pass an absolute opts.Source, because
// the implementation may run in another process.
CreateSession(ctx context.Context, opts sessionsvc.CreateOptions) (*session.Session, error)
CreateFromRequest(ctx context.Context, req sessionsvc.LaunchRequest) (session.Session, error)
CreateSessionWithWindows(ctx context.Context, req sessionsvc.NewSessionRequest, windows []multiplexer.WindowSpec) (*session.Session, error)
RenameSession(ctx context.Context, id, name string) error
SetSessionGroup(ctx context.Context, id, group string) error
SetSessionTags(ctx context.Context, id string, tags []string) (session.Session, error)
EditSessionTags(ctx context.Context, id string, add, remove []string) (session.Session, error)
DeleteSession(ctx context.Context, id string) error
RecycleSession(ctx context.Context, id string, w io.Writer) error
Prune(ctx context.Context, all bool) (int, error)
CheckSessionRisk(ctx context.Context, id string) (sessionsvc.Risk, error)
SessionLaunchOptions(ctx context.Context) (sessionsvc.LaunchOptions, error)
SessionChanges(ctx context.Context, id string, target gitstatus.DiffTarget) (gitstatus.Changes, error)
SessionFileDiffs(ctx context.Context, id string, target gitstatus.DiffTarget, paths []string) ([]gitstatus.FileDiff, error)
SessionBranches(ctx context.Context, id string) ([]string, error)
// GitStatuses reads the checkouts of the sessions ids name on the machine
// that holds them, keyed by id. An id with no session is absent.
GitStatuses(ctx context.Context, ids []string) (map[string]gitstatus.Status, error)
// StartTmuxSession opens the tmux session of an active session in the
// background on the machine that holds it, and starts its agent when no
// tmux session runs. A client attaches to it afterwards.
StartTmuxSession(ctx context.Context, id string) (multiplexer.LaunchResult, error)
// StatusAvailable must not block: the TUI calls it inside Update. A false
// answer can turn true later (the daemon client answers false until its
// first Hello returns), so callers ask again instead of caching it.
StatusAvailable() bool
FetchBatch(ctx context.Context, sessions []*session.Session, roots []status.RootRepoTarget) map[string]status.TerminalStatus
}
API creates every session in the background, whatever opts.Background says: the implementation may run in a daemon with no terminal. A caller that wants the session in front attaches or switches to the one returned.
type Local ¶
type Local struct {
// contains filtered or unexported fields
}
Local reads the engine's services on every call, so it follows a Reload.
func (*Local) CheckSessionRisk ¶
func (*Local) CreateFromRequest ¶
func (l *Local) CreateFromRequest(ctx context.Context, req sessionsvc.LaunchRequest) (session.Session, error)
func (*Local) CreateSession ¶
func (l *Local) CreateSession(ctx context.Context, opts sessionsvc.CreateOptions) (*session.Session, error)
func (*Local) CreateSessionWithWindows ¶
func (l *Local) CreateSessionWithWindows(ctx context.Context, req sessionsvc.NewSessionRequest, windows []multiplexer.WindowSpec) (*session.Session, error)
func (*Local) EditSessionTags ¶
func (*Local) FetchBatch ¶
func (l *Local) FetchBatch(ctx context.Context, sessions []*session.Session, roots []status.RootRepoTarget) map[string]status.TerminalStatus
func (*Local) GetSession ¶
func (*Local) GitStatuses ¶ added in v0.69.0
func (*Local) ListSessions ¶
func (*Local) RecycleSession ¶
func (*Local) RenameSession ¶
func (*Local) SessionBranches ¶ added in v0.69.0
func (*Local) SessionChanges ¶ added in v0.69.0
func (*Local) SessionFileDiffs ¶ added in v0.69.0
func (*Local) SessionLaunchOptions ¶
func (l *Local) SessionLaunchOptions(ctx context.Context) (sessionsvc.LaunchOptions, error)
func (*Local) SetSessionGroup ¶
func (*Local) SetSessionTags ¶
func (*Local) StartTmuxSession ¶ added in v0.69.0
func (l *Local) StartTmuxSession(ctx context.Context, id string) (multiplexer.LaunchResult, error)
func (*Local) StatusAvailable ¶
Click to show internal directories.
Click to hide internal directories.