Documentation
¶
Overview ¶
Package rpc carries core.Core over a connection (daemon stage 2): newline-delimited JSON frames, a Server serving a core.Loop, and a Client implementing core.Core.
The client keeps a replica of the model's published state: it is sent the whole state when it connects (core.Model.Snapshot) and every change after (the state events Sync publishes), and answers every query from it, so only actions cross the wire. A request's reply follows the events the request produced, so a client that reads right after a request sees its effect. methods_gen.go, generated from core/iface.go, holds each method's wire types, the method table, the server's dispatch and the client's methods.
Index ¶
- Constants
- func Build() string
- func SetVersion(v string)
- type AccountEnvParams
- type AccountEnvResult
- type AccountLoggedOutParams
- type AccountLoggedOutResult
- type AccountNamesParams
- type AccountNamesResult
- type AccountParams
- type AccountResult
- type AccountSyncParams
- type AccountSyncResult
- type AccountUsageParams
- type AccountUsageResult
- type AccountsLoadedParams
- type AccountsLoadedResult
- type AddAccountParams
- type AddAccountResult
- type Backend
- type ClaudeProgramParams
- type ClaudeProgramResult
- type Client
- func (c *Client) Account(name string) (account.Account, bool)
- func (c *Client) AccountEnv(name string) ([]string, error)
- func (c *Client) AccountLoggedOut(acct string) bool
- func (c *Client) AccountNames() core.AccountNames
- func (c *Client) AccountSync(name string) (account.SyncReport, bool)
- func (c *Client) AccountUsage(name string) (account.Usage, error)
- func (c *Client) AccountsLoaded() bool
- func (c *Client) AddAccount(name string) (string, error)
- func (c *Client) ClaudeProgram() string
- func (c *Client) Close()
- func (c *Client) Create(id core.WorkspaceID, spec core.NewInstance, req core.ReqID)
- func (c *Client) CredentialOverride() string
- func (c *Client) Err() error
- func (c *Client) ExpediteGitHub()
- func (c *Client) FetchIssue(repo string, number int, req core.ReqID)
- func (c *Client) FlushForTest() error
- func (c *Client) GitHubErr(repo string) error
- func (c *Client) GitHubSnapshot(repo string) (github.Snapshot, bool)
- func (c *Client) GitHubUnavailable() bool
- func (c *Client) GitHubUnavailableReason() string
- func (c *Client) HasExtraAccounts() bool
- func (c *Client) IsLoaded(id core.WorkspaceID) bool
- func (c *Client) Kill(id core.InstanceID, req core.ReqID)
- func (c *Client) MarkOutput(sessionName string)
- func (c *Client) Merge(target core.InstanceID, source core.InstanceID, req core.ReqID)
- func (c *Client) Open(id core.WorkspaceID) (core.WorkspaceView, error)
- func (c *Client) PaneOutput(id core.InstanceID)
- func (c *Client) PaneQuiet(id core.InstanceID)
- func (c *Client) Pause(id core.InstanceID, req core.ReqID)
- func (c *Client) Peer() Hello
- func (c *Client) PersistOpenList(names []string)
- func (c *Client) Push(id core.InstanceID, req core.ReqID)
- func (c *Client) RCAuth() session.RemoteControlAuth
- func (c *Client) RCAuthFor(acct string) session.RemoteControlAuth
- func (c *Client) Recover(id core.InstanceID, req core.ReqID)
- func (c *Client) Register(name string, dir string) (core.WorkspaceView, error)
- func (c *Client) Registry() core.RegistryView
- func (c *Client) ReloadAccounts()
- func (c *Client) ReloadRegistry() error
- func (c *Client) RemoveAccount(name string, force bool) error
- func (c *Client) RenameWorkspace(from string, to string) error
- func (c *Client) RequestAccountsRefresh(withDefault bool)
- func (c *Client) RequestUsageProbe()
- func (c *Client) Reset(id core.WorkspaceID, req core.ReqID) error
- func (c *Client) Resume(id core.InstanceID, req core.ReqID)
- func (c *Client) ResumeWith(id core.InstanceID, opts launch.Options, base string, req core.ReqID)
- func (c *Client) RunningAsAccount() string
- func (c *Client) SaveForQuit() error
- func (c *Client) SaveSettings(id core.WorkspaceID, settings config.Settings) error
- func (c *Client) SendPrompt(id core.InstanceID, text string, req core.ReqID)
- func (c *Client) SetDefaultAccount(name string) error
- func (c *Client) SetHelpScreensSeen(id core.WorkspaceID, seen uint32) error
- func (c *Client) SetLastUsed(name string) error
- func (c *Client) SetSelected(id core.InstanceID)
- func (c *Client) SetUIPrefs(id core.WorkspaceID, prefs config.UIPrefs) error
- func (c *Client) Stopping() bool
- func (c *Client) Sync() []core.Event
- func (c *Client) TakeRefused() []core.ReqID
- func (c *Client) Unregister(name string) error
- func (c *Client) VerifyDead(id core.InstanceID)
- func (c *Client) View(id core.InstanceID) (core.InstanceView, bool)
- func (c *Client) Views(id core.WorkspaceID) []core.InstanceView
- func (c *Client) Wakes() <-chan struct{}
- func (c *Client) WatchGitHub(repo string)
- func (c *Client) Workspace(id core.WorkspaceID) (core.WorkspaceView, bool)
- func (c *Client) Workspaces() []core.WorkspaceView
- type CreateParams
- type CreateResult
- type CredentialOverrideParams
- type CredentialOverrideResult
- type ExpediteGitHubParams
- type ExpediteGitHubResult
- type FetchIssueParams
- type FetchIssueResult
- type Frame
- type GitHubErrParams
- type GitHubErrResult
- type GitHubSnapshotParams
- type GitHubSnapshotResult
- type GitHubUnavailableParams
- type GitHubUnavailableReasonParams
- type GitHubUnavailableReasonResult
- type GitHubUnavailableResult
- type HasExtraAccountsParams
- type HasExtraAccountsResult
- type Hello
- type IsLoadedParams
- type IsLoadedResult
- type KillParams
- type KillResult
- type MarkOutputParams
- type MarkOutputResult
- type MergeParams
- type MergeResult
- type MismatchError
- type OpenParams
- type OpenResult
- type Order
- type PaneOutputParams
- type PaneOutputResult
- type PaneQuietParams
- type PaneQuietResult
- type PauseParams
- type PauseResult
- type PersistOpenListParams
- type PersistOpenListResult
- type PushParams
- type PushResult
- type RCAuthForParams
- type RCAuthForResult
- type RCAuthParams
- type RCAuthResult
- type RecoverParams
- type RecoverResult
- type RegisterParams
- type RegisterResult
- type RegistryParams
- type RegistryResult
- type ReloadAccountsParams
- type ReloadAccountsResult
- type ReloadRegistryParams
- type ReloadRegistryResult
- type RemoveAccountParams
- type RemoveAccountResult
- type RenameWorkspaceParams
- type RenameWorkspaceResult
- type RequestAccountsRefreshParams
- type RequestAccountsRefreshResult
- type RequestUsageProbeParams
- type RequestUsageProbeResult
- type ResetParams
- type ResetResult
- type ResumeParams
- type ResumeResult
- type ResumeWithParams
- type ResumeWithResult
- type RunningAsAccountParams
- type RunningAsAccountResult
- type SaveForQuitParams
- type SaveForQuitResult
- type SaveSettingsParams
- type SaveSettingsResult
- type SendPromptParams
- type SendPromptResult
- type Server
- type SetDefaultAccountParams
- type SetDefaultAccountResult
- type SetHelpScreensSeenParams
- type SetHelpScreensSeenResult
- type SetLastUsedParams
- type SetLastUsedResult
- type SetSelectedParams
- type SetSelectedResult
- type SetUIPrefsParams
- type SetUIPrefsResult
- type UnregisterParams
- type UnregisterResult
- type VerifyDeadParams
- type VerifyDeadResult
- type ViewParams
- type ViewResult
- type ViewsParams
- type ViewsResult
- type WatchGitHubParams
- type WatchGitHubResult
- type WorkspaceParams
- type WorkspaceResult
- type WorkspacesParams
- type WorkspacesResult
Constants ¶
const Protocol = 2
Protocol is the wire's version. Both sides send it in their hello and refuse a different one; the hello's build tells which side is newer. Adding a method or an optional field is compatible and needs no bump: a peer that lacks the method answers CodeUnsupported, an ordinary error, a peer ignores a field it does not know, and an event it does not know is dropped. Removing or renaming a method, event or field, or changing what a field means or a frame's shape, is incompatible and bumps it.
Variables ¶
This section is empty.
Functions ¶
func Build ¶
func Build() string
Build names this binary: its module version, VCS revision and whether the tree was modified. A daemon records it in its lock.
func SetVersion ¶
func SetVersion(v string)
SetVersion names this binary's release (main's version) for its hello. main calls it before any connection is made.
Types ¶
type AccountEnvParams ¶
type AccountEnvParams struct {
Name string `json:"name"`
}
AccountEnvParams are AccountEnv's parameters on the wire.
type AccountEnvResult ¶
type AccountEnvResult struct {
Value []string `json:"value"`
}
AccountEnvResult is AccountEnv's result on the wire; an error travels in the reply.
type AccountLoggedOutParams ¶
type AccountLoggedOutParams struct {
Acct string `json:"acct"`
}
AccountLoggedOutParams are AccountLoggedOut's parameters on the wire.
type AccountLoggedOutResult ¶
type AccountLoggedOutResult struct {
Value bool `json:"value"`
}
AccountLoggedOutResult is AccountLoggedOut's result on the wire; an error travels in the reply.
type AccountNamesParams ¶
type AccountNamesParams struct {
}
AccountNamesParams are AccountNames's parameters on the wire.
type AccountNamesResult ¶
type AccountNamesResult struct {
Value core.AccountNames `json:"value"`
}
AccountNamesResult is AccountNames's result on the wire; an error travels in the reply.
type AccountParams ¶
type AccountParams struct {
Name string `json:"name"`
}
AccountParams are Account's parameters on the wire.
type AccountResult ¶
AccountResult is Account's result on the wire; an error travels in the reply.
type AccountSyncParams ¶
type AccountSyncParams struct {
Name string `json:"name"`
}
AccountSyncParams are AccountSync's parameters on the wire.
type AccountSyncResult ¶
type AccountSyncResult struct {
Value account.SyncReport `json:"value"`
OK bool `json:"ok"`
}
AccountSyncResult is AccountSync's result on the wire; an error travels in the reply.
type AccountUsageParams ¶
type AccountUsageParams struct {
Name string `json:"name"`
}
AccountUsageParams are AccountUsage's parameters on the wire.
type AccountUsageResult ¶
AccountUsageResult is AccountUsage's result on the wire; an error travels in the reply.
type AccountsLoadedParams ¶
type AccountsLoadedParams struct {
}
AccountsLoadedParams are AccountsLoaded's parameters on the wire.
type AccountsLoadedResult ¶
type AccountsLoadedResult struct {
Value bool `json:"value"`
}
AccountsLoadedResult is AccountsLoaded's result on the wire; an error travels in the reply.
type AddAccountParams ¶
type AddAccountParams struct {
Name string `json:"name"`
}
AddAccountParams are AddAccount's parameters on the wire.
type AddAccountResult ¶
type AddAccountResult struct {
Value string `json:"value"`
}
AddAccountResult is AddAccount's result on the wire; an error travels in the reply.
type Backend ¶
type Backend interface {
core.Core
SyncAndSnapshot() (published, snapshot []core.Event)
SetSelection(ids []core.InstanceID)
Wakes() <-chan struct{}
}
Backend is what a Server serves: the model's Core, a Sync and the whole state in one call for a client that connects (SyncAndSnapshot), every client's selected row at once (SetSelection), and its wakes (core.Loop has them all).
type ClaudeProgramParams ¶
type ClaudeProgramParams struct {
}
ClaudeProgramParams are ClaudeProgram's parameters on the wire.
type ClaudeProgramResult ¶
type ClaudeProgramResult struct {
Value string `json:"value"`
}
ClaudeProgramResult is ClaudeProgram's result on the wire; an error travels in the reply.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is core.Core over a connection to a Server. It keeps a replica of the model's published state (sent whole when it connects, then every change), answers every rpc:local query from it, sends casts one way, and waits for each request's reply, which follows the events the request produced: a read right after a request sees its effect. Sync returns the events received since the last Sync, the state events coalesced to the newest state. Wakes signals when events arrive.
A server stopping gracefully says bye first (Stopping): from then on a request is refused at once, unavailable (core.ErrUnavailable), and a cast dropped, while the replies to requests in flight still arrive.
Losing the model (the connection lost, or the model failed: a panic, or a frame either side could not use) is fatal, and Wakes signals it. A daemon's client (Dial) then reports it (Err: unavailable when the server had said bye, so a stop is told from a crash) and panics nowhere: local reads answer from the last replica, requests are refused as unavailable and casts are dropped, so the TUI can quit or wait cleanly. An in-process client (InProcess) raises it instead: the caller that met it panics, and every call after it, so a model's own panic reaches its caller's recovery.
func Dial ¶
func Dial(nc io.ReadWriteCloser) (*Client, error)
Dial says hello on nc, starts reading, and returns once the replica holds the server's snapshot: a daemon's client, which reports the model's loss rather than raising it (Err). A server of another protocol is a *MismatchError, carrying its hello when it sent one.
func InProcess ¶
InProcess runs model, booted already (core.Model.Boot), as the daemon does (internal/daemon), inside this process: on its own loop (core.Start), served by a Server over one end of an in-memory pipe, with a Client on the other, which raises the model's loss (a panic reaches its caller). The loop starts its background work (core.Loop.Begin) once the client has connected, so nothing its first jobs publish (a Notice) goes to no one. It returns the client, which implements core.Core, and the function that stops all three. Tests use it for the production stack in one process.
func InProcessForTest ¶
InProcessForTest is InProcess for a test of the client's user (the TUI): model runs on a loop that holds its jobs (core.StartForTest, returned for its seams) and has not begun (the test drives its jobs and tick by hand), and the client is synchronous, as the TUI's in-process calls were in stage 1E: it pings before every local read, so a read sees whatever the model published by then (a change the test made to the model directly included), and after every cast, so a cast has reached the model before the test reads it. Production code never calls it.
func (*Client) AccountEnv ¶
AccountEnv is core.Core's AccountEnv (local).
func (*Client) AccountLoggedOut ¶
AccountLoggedOut is core.Core's AccountLoggedOut (local).
func (*Client) AccountNames ¶
func (c *Client) AccountNames() core.AccountNames
AccountNames is core.Core's AccountNames (local).
func (*Client) AccountSync ¶
func (c *Client) AccountSync(name string) (account.SyncReport, bool)
AccountSync is core.Core's AccountSync (local).
func (*Client) AccountUsage ¶
AccountUsage is core.Core's AccountUsage (local).
func (*Client) AccountsLoaded ¶
AccountsLoaded is core.Core's AccountsLoaded (local).
func (*Client) AddAccount ¶
AddAccount is core.Core's AddAccount (request).
func (*Client) ClaudeProgram ¶
ClaudeProgram is core.Core's ClaudeProgram (local).
func (*Client) Close ¶
func (c *Client) Close()
Close ends the connection and waits for the reader, the only sender on Wakes, then closes Wakes.
func (*Client) Create ¶
func (c *Client) Create(id core.WorkspaceID, spec core.NewInstance, req core.ReqID)
Create is core.Core's Create (request).
func (*Client) CredentialOverride ¶
CredentialOverride is core.Core's CredentialOverride (local).
func (*Client) Err ¶
Err is the model's loss: the connection lost, or the model failed (a panic, or a frame either side could not use). A connection lost after the server said bye is the daemon stopping, and matches core.ErrUnavailable; one lost without is a crash, and does not. Nil while the model is reachable, while it is only stopping, and after Close.
func (*Client) ExpediteGitHub ¶
func (c *Client) ExpediteGitHub()
ExpediteGitHub is core.Core's ExpediteGitHub (cast).
func (*Client) FetchIssue ¶
FetchIssue is core.Core's FetchIssue (request).
func (*Client) FlushForTest ¶
FlushForTest is the client's barrier (a ping): when it returns, everything the server published before answering is in the replica.
func (*Client) GitHubSnapshot ¶
GitHubSnapshot is core.Core's GitHubSnapshot (local).
func (*Client) GitHubUnavailable ¶
GitHubUnavailable is core.Core's GitHubUnavailable (local).
func (*Client) GitHubUnavailableReason ¶
GitHubUnavailableReason is core.Core's GitHubUnavailableReason (local).
func (*Client) HasExtraAccounts ¶
HasExtraAccounts is core.Core's HasExtraAccounts (local).
func (*Client) IsLoaded ¶
func (c *Client) IsLoaded(id core.WorkspaceID) bool
IsLoaded is core.Core's IsLoaded (local).
func (*Client) Kill ¶
func (c *Client) Kill(id core.InstanceID, req core.ReqID)
Kill is core.Core's Kill (request).
func (*Client) MarkOutput ¶
MarkOutput is core.Core's MarkOutput (cast).
func (*Client) Merge ¶
func (c *Client) Merge(target core.InstanceID, source core.InstanceID, req core.ReqID)
Merge is core.Core's Merge (request).
func (*Client) Open ¶
func (c *Client) Open(id core.WorkspaceID) (core.WorkspaceView, error)
Open is core.Core's Open (request).
func (*Client) PaneOutput ¶
func (c *Client) PaneOutput(id core.InstanceID)
PaneOutput is core.Core's PaneOutput (cast).
func (*Client) PaneQuiet ¶
func (c *Client) PaneQuiet(id core.InstanceID)
PaneQuiet is core.Core's PaneQuiet (cast).
func (*Client) Pause ¶
func (c *Client) Pause(id core.InstanceID, req core.ReqID)
Pause is core.Core's Pause (request).
func (*Client) PersistOpenList ¶
PersistOpenList is core.Core's PersistOpenList (request).
func (*Client) Push ¶
func (c *Client) Push(id core.InstanceID, req core.ReqID)
Push is core.Core's Push (request).
func (*Client) RCAuth ¶
func (c *Client) RCAuth() session.RemoteControlAuth
RCAuth is core.Core's RCAuth (local).
func (*Client) RCAuthFor ¶
func (c *Client) RCAuthFor(acct string) session.RemoteControlAuth
RCAuthFor is core.Core's RCAuthFor (local).
func (*Client) Recover ¶
func (c *Client) Recover(id core.InstanceID, req core.ReqID)
Recover is core.Core's Recover (request).
func (*Client) Registry ¶
func (c *Client) Registry() core.RegistryView
Registry is core.Core's Registry (local).
func (*Client) ReloadAccounts ¶
func (c *Client) ReloadAccounts()
ReloadAccounts is core.Core's ReloadAccounts (request).
func (*Client) ReloadRegistry ¶
ReloadRegistry is core.Core's ReloadRegistry (request).
func (*Client) RemoveAccount ¶
RemoveAccount is core.Core's RemoveAccount (request).
func (*Client) RenameWorkspace ¶
RenameWorkspace is core.Core's RenameWorkspace (request).
func (*Client) RequestAccountsRefresh ¶
RequestAccountsRefresh is core.Core's RequestAccountsRefresh (cast).
func (*Client) RequestUsageProbe ¶
func (c *Client) RequestUsageProbe()
RequestUsageProbe is core.Core's RequestUsageProbe (cast).
func (*Client) Resume ¶
func (c *Client) Resume(id core.InstanceID, req core.ReqID)
Resume is core.Core's Resume (request).
func (*Client) ResumeWith ¶
ResumeWith is core.Core's ResumeWith (request).
func (*Client) RunningAsAccount ¶
RunningAsAccount is core.Core's RunningAsAccount (local).
func (*Client) SaveForQuit ¶
SaveForQuit is core.Core's SaveForQuit (request).
func (*Client) SaveSettings ¶
SaveSettings is core.Core's SaveSettings (request).
func (*Client) SendPrompt ¶
SendPrompt is core.Core's SendPrompt (request).
func (*Client) SetDefaultAccount ¶
SetDefaultAccount is core.Core's SetDefaultAccount (request).
func (*Client) SetHelpScreensSeen ¶
func (c *Client) SetHelpScreensSeen(id core.WorkspaceID, seen uint32) error
SetHelpScreensSeen is core.Core's SetHelpScreensSeen (request).
func (*Client) SetLastUsed ¶
SetLastUsed is core.Core's SetLastUsed (request).
func (*Client) SetSelected ¶
func (c *Client) SetSelected(id core.InstanceID)
SetSelected is core.Core's SetSelected (cast).
func (*Client) SetUIPrefs ¶
SetUIPrefs is core.Core's SetUIPrefs (request).
func (*Client) Stopping ¶
Stopping reports whether the server has said bye: it is stopping, takes no request, and will close the connection once the replies to requests in flight are sent.
func (*Client) Sync ¶
Sync returns the events received since the last Sync (rpc:client): first the state events, coalesced to the newest state, in the model's order, then the others in the order they arrived.
func (*Client) TakeRefused ¶
TakeRefused returns, and forgets, the request IDs of the calls refused as unavailable since the last TakeRefused (noteRefused): requests no Reply will answer, whichever side of a bye they were made on. A request whose connection went before its reply counts too, though its Reply may have arrived first: a caller fails only the requests still waiting.
func (*Client) Unregister ¶
Unregister is core.Core's Unregister (request).
func (*Client) VerifyDead ¶
func (c *Client) VerifyDead(id core.InstanceID)
VerifyDead is core.Core's VerifyDead (cast).
func (*Client) View ¶
func (c *Client) View(id core.InstanceID) (core.InstanceView, bool)
View is core.Core's View (local).
func (*Client) Views ¶
func (c *Client) Views(id core.WorkspaceID) []core.InstanceView
Views is core.Core's Views (local).
func (*Client) Wakes ¶
func (c *Client) Wakes() <-chan struct{}
Wakes signals that events arrived for Sync. Wakes coalesce; Close closes it.
func (*Client) WatchGitHub ¶
WatchGitHub is core.Core's WatchGitHub (cast).
func (*Client) Workspace ¶
func (c *Client) Workspace(id core.WorkspaceID) (core.WorkspaceView, bool)
Workspace is core.Core's Workspace (local).
func (*Client) Workspaces ¶
func (c *Client) Workspaces() []core.WorkspaceView
Workspaces is core.Core's Workspaces (local).
type CreateParams ¶
type CreateParams struct {
ID core.WorkspaceID `json:"id"`
Spec core.NewInstance `json:"spec"`
Req core.ReqID `json:"req"`
}
CreateParams are Create's parameters on the wire.
type CreateResult ¶
type CreateResult struct {
}
CreateResult is Create's result on the wire; an error travels in the reply.
type CredentialOverrideParams ¶
type CredentialOverrideParams struct {
}
CredentialOverrideParams are CredentialOverride's parameters on the wire.
type CredentialOverrideResult ¶
type CredentialOverrideResult struct {
Value string `json:"value"`
}
CredentialOverrideResult is CredentialOverride's result on the wire; an error travels in the reply.
type ExpediteGitHubParams ¶
type ExpediteGitHubParams struct {
}
ExpediteGitHubParams are ExpediteGitHub's parameters on the wire.
type ExpediteGitHubResult ¶
type ExpediteGitHubResult struct {
}
ExpediteGitHubResult is ExpediteGitHub's result on the wire; an error travels in the reply.
type FetchIssueParams ¶
type FetchIssueParams struct {
Repo string `json:"repo"`
Number int `json:"number"`
Req core.ReqID `json:"req"`
}
FetchIssueParams are FetchIssue's parameters on the wire.
type FetchIssueResult ¶
type FetchIssueResult struct {
}
FetchIssueResult is FetchIssue's result on the wire; an error travels in the reply.
type Frame ¶
type Frame struct {
Hello *Hello `json:"hello,omitempty"`
ID uint64 `json:"id,omitempty"`
Method string `json:"method,omitempty"`
Params json.RawMessage `json:"params,omitempty"`
Result json.RawMessage `json:"result,omitempty"`
Error *core.WireError `json:"error,omitempty"`
Event string `json:"event,omitempty"`
Data json.RawMessage `json:"data,omitempty"`
Fatal *core.WireError `json:"fatal,omitempty"`
Bye string `json:"bye,omitempty"`
}
Frame is one line on the wire. Exactly one of its shapes is set:
- a hello: Hello;
- a request: Method, Params and a non-zero ID (a cast has no ID);
- a reply: ID, Result and Error;
- an event: Event (its Go type name) and Data;
- a fatal error: Fatal, which every later call re-raises;
- a bye: Bye, the reason a server is going ("stopping"). It takes no request after it, replies to the requests in flight still follow, then the connection closes. Optional: a peer that does not know it decodes past the field, and the frame matches nothing it reads.
type GitHubErrParams ¶
type GitHubErrParams struct {
Repo string `json:"repo"`
}
GitHubErrParams are GitHubErr's parameters on the wire.
type GitHubErrResult ¶
type GitHubErrResult struct {
}
GitHubErrResult is GitHubErr's result on the wire; an error travels in the reply.
type GitHubSnapshotParams ¶
type GitHubSnapshotParams struct {
Repo string `json:"repo"`
}
GitHubSnapshotParams are GitHubSnapshot's parameters on the wire.
type GitHubSnapshotResult ¶
GitHubSnapshotResult is GitHubSnapshot's result on the wire; an error travels in the reply.
type GitHubUnavailableParams ¶
type GitHubUnavailableParams struct {
}
GitHubUnavailableParams are GitHubUnavailable's parameters on the wire.
type GitHubUnavailableReasonParams ¶
type GitHubUnavailableReasonParams struct {
}
GitHubUnavailableReasonParams are GitHubUnavailableReason's parameters on the wire.
type GitHubUnavailableReasonResult ¶
type GitHubUnavailableReasonResult struct {
}
GitHubUnavailableReasonResult is GitHubUnavailableReason's result on the wire; an error travels in the reply.
type GitHubUnavailableResult ¶
type GitHubUnavailableResult struct {
}
GitHubUnavailableResult is GitHubUnavailable's result on the wire; an error travels in the reply.
type HasExtraAccountsParams ¶
type HasExtraAccountsParams struct {
}
HasExtraAccountsParams are HasExtraAccounts's parameters on the wire.
type HasExtraAccountsResult ¶
type HasExtraAccountsResult struct {
Value bool `json:"value"`
}
HasExtraAccountsResult is HasExtraAccounts's result on the wire; an error travels in the reply.
type Hello ¶
type Hello struct {
Protocol int `json:"protocol"`
Build string `json:"build"`
// Version is the release (main's version, SetVersion).
Version string `json:"version,omitempty"`
// Time is when the VCS revision was committed (RFC 3339): vcs.time,
// else the commit time the build stamped (commitUnix, as Nix does).
Time string `json:"time,omitempty"`
// Modified says the tree was modified when built (vcs.modified).
Modified bool `json:"modified,omitempty"`
// Exe is the SHA-256 of the running executable, in hex: two builds of
// one commit with different edits agree on everything else.
Exe string `json:"exe,omitempty"`
// ExeTime is when the running executable was last modified (UTC, RFC
// 3339), which breaks a tie nothing else decides when both sides name
// their commit (Time): a rebuild at one commit is newer. One at or
// before the epoch's first second (a Nix store's) tells nothing.
ExeTime string `json:"exe_time,omitempty"`
// Tmux is the tmux server the server's sessions run on (its socket's
// path), which its clients use too (Server.SetTmux). Servers only.
Tmux string `json:"tmux,omitempty"`
}
Hello is each side's first frame: its protocol and its build, which a client compares with the server's (CompareBuilds: the newer side wins). A server sends its own even to a peer of another protocol, ahead of the mismatch error, so every client learns the server's build. The fields after Build are optional: a peer that lacks them leaves them empty.
type IsLoadedParams ¶
type IsLoadedParams struct {
ID core.WorkspaceID `json:"id"`
}
IsLoadedParams are IsLoaded's parameters on the wire.
type IsLoadedResult ¶
type IsLoadedResult struct {
Value bool `json:"value"`
}
IsLoadedResult is IsLoaded's result on the wire; an error travels in the reply.
type KillParams ¶
type KillParams struct {
ID core.InstanceID `json:"id"`
Req core.ReqID `json:"req"`
}
KillParams are Kill's parameters on the wire.
type KillResult ¶
type KillResult struct {
}
KillResult is Kill's result on the wire; an error travels in the reply.
type MarkOutputParams ¶
type MarkOutputParams struct {
SessionName string `json:"sessionName"`
}
MarkOutputParams are MarkOutput's parameters on the wire.
type MarkOutputResult ¶
type MarkOutputResult struct {
}
MarkOutputResult is MarkOutput's result on the wire; an error travels in the reply.
type MergeParams ¶
type MergeParams struct {
Target core.InstanceID `json:"target"`
Source core.InstanceID `json:"source"`
Req core.ReqID `json:"req"`
}
MergeParams are Merge's parameters on the wire.
type MergeResult ¶
type MergeResult struct {
}
MergeResult is Merge's result on the wire; an error travels in the reply.
type MismatchError ¶
type MismatchError struct {
Peer *Hello
}
MismatchError is Dial's error when the server speaks another protocol. Peer is the server's hello, nil when it sent none (a server from before servers said hello first), so a client can still tell which build is newer and replace an older server.
func (*MismatchError) Error ¶
func (e *MismatchError) Error() string
type OpenParams ¶
type OpenParams struct {
ID core.WorkspaceID `json:"id"`
}
OpenParams are Open's parameters on the wire.
type OpenResult ¶
type OpenResult struct {
Value core.WorkspaceView `json:"value"`
}
OpenResult is Open's result on the wire; an error travels in the reply.
type Order ¶
type Order int
Order is how a client's build compares with a server's (CompareBuilds).
const ( // SameBuild is one build on both sides: one executable, or two that // nothing tells apart. SameBuild Order = iota // ClientNewer is a client newer than its server: it replaces the server. ClientNewer // ServerNewer is a server newer than its client: the client must be // upgraded. ServerNewer )
func CompareBuilds ¶
CompareBuilds says which of a client's and a server's builds is newer, from their hellos: the same executable (Exe) is the same build; otherwise the higher release (Version, as semver), then the later commit (Time), then a modified tree over a clean one, then the higher protocol (a peer that sent no hello, protocol 0, is older than any that did), then, only when both name their commit (Time), the newer executable (ExeTime: both were built from a checkout at one commit, and a dev build edited or rebuilt there replaces its sandbox's server). A field either side lacks, or can't be read, decides nothing, and a full tie is otherwise the same build: two installs of one release keep whichever daemon runs rather than replace each other's on every launch, and a loom whose executable can't be read keeps the daemon rather than stop it on every launch. An executable dated at or before the epoch's first second tells nothing either (knownExeTime): a Nix store dates every file there, so a Nix build and a release binary of one commit keep whichever daemon runs rather than refuse each other as newer, and two Nix builds are told apart by the commit time the flake stamps (commitUnix). A build that names no commit (a plain go build from a tarball) at the same release keeps the running daemon: `loom serve stop` switches.
type PaneOutputParams ¶
type PaneOutputParams struct {
ID core.InstanceID `json:"id"`
}
PaneOutputParams are PaneOutput's parameters on the wire.
type PaneOutputResult ¶
type PaneOutputResult struct {
}
PaneOutputResult is PaneOutput's result on the wire; an error travels in the reply.
type PaneQuietParams ¶
type PaneQuietParams struct {
ID core.InstanceID `json:"id"`
}
PaneQuietParams are PaneQuiet's parameters on the wire.
type PaneQuietResult ¶
type PaneQuietResult struct {
}
PaneQuietResult is PaneQuiet's result on the wire; an error travels in the reply.
type PauseParams ¶
type PauseParams struct {
ID core.InstanceID `json:"id"`
Req core.ReqID `json:"req"`
}
PauseParams are Pause's parameters on the wire.
type PauseResult ¶
type PauseResult struct {
}
PauseResult is Pause's result on the wire; an error travels in the reply.
type PersistOpenListParams ¶
type PersistOpenListParams struct {
Names []string `json:"names"`
}
PersistOpenListParams are PersistOpenList's parameters on the wire.
type PersistOpenListResult ¶
type PersistOpenListResult struct {
}
PersistOpenListResult is PersistOpenList's result on the wire; an error travels in the reply.
type PushParams ¶
type PushParams struct {
ID core.InstanceID `json:"id"`
Req core.ReqID `json:"req"`
}
PushParams are Push's parameters on the wire.
type PushResult ¶
type PushResult struct {
}
PushResult is Push's result on the wire; an error travels in the reply.
type RCAuthForParams ¶
type RCAuthForParams struct {
Acct string `json:"acct"`
}
RCAuthForParams are RCAuthFor's parameters on the wire.
type RCAuthForResult ¶
type RCAuthForResult struct {
Value session.RemoteControlAuth `json:"value"`
}
RCAuthForResult is RCAuthFor's result on the wire; an error travels in the reply.
type RCAuthResult ¶
type RCAuthResult struct {
Value session.RemoteControlAuth `json:"value"`
}
RCAuthResult is RCAuth's result on the wire; an error travels in the reply.
type RecoverParams ¶
type RecoverParams struct {
ID core.InstanceID `json:"id"`
Req core.ReqID `json:"req"`
}
RecoverParams are Recover's parameters on the wire.
type RecoverResult ¶
type RecoverResult struct {
}
RecoverResult is Recover's result on the wire; an error travels in the reply.
type RegisterParams ¶
RegisterParams are Register's parameters on the wire.
type RegisterResult ¶
type RegisterResult struct {
Value core.WorkspaceView `json:"value"`
}
RegisterResult is Register's result on the wire; an error travels in the reply.
type RegistryParams ¶
type RegistryParams struct {
}
RegistryParams are Registry's parameters on the wire.
type RegistryResult ¶
type RegistryResult struct {
Value core.RegistryView `json:"value"`
}
RegistryResult is Registry's result on the wire; an error travels in the reply.
type ReloadAccountsParams ¶
type ReloadAccountsParams struct {
}
ReloadAccountsParams are ReloadAccounts's parameters on the wire.
type ReloadAccountsResult ¶
type ReloadAccountsResult struct {
}
ReloadAccountsResult is ReloadAccounts's result on the wire; an error travels in the reply.
type ReloadRegistryParams ¶
type ReloadRegistryParams struct {
}
ReloadRegistryParams are ReloadRegistry's parameters on the wire.
type ReloadRegistryResult ¶
type ReloadRegistryResult struct {
}
ReloadRegistryResult is ReloadRegistry's result on the wire; an error travels in the reply.
type RemoveAccountParams ¶
RemoveAccountParams are RemoveAccount's parameters on the wire.
type RemoveAccountResult ¶
type RemoveAccountResult struct {
}
RemoveAccountResult is RemoveAccount's result on the wire; an error travels in the reply.
type RenameWorkspaceParams ¶
RenameWorkspaceParams are RenameWorkspace's parameters on the wire.
type RenameWorkspaceResult ¶
type RenameWorkspaceResult struct {
}
RenameWorkspaceResult is RenameWorkspace's result on the wire; an error travels in the reply.
type RequestAccountsRefreshParams ¶
type RequestAccountsRefreshParams struct {
WithDefault bool `json:"withDefault"`
}
RequestAccountsRefreshParams are RequestAccountsRefresh's parameters on the wire.
type RequestAccountsRefreshResult ¶
type RequestAccountsRefreshResult struct {
}
RequestAccountsRefreshResult is RequestAccountsRefresh's result on the wire; an error travels in the reply.
type RequestUsageProbeParams ¶
type RequestUsageProbeParams struct {
}
RequestUsageProbeParams are RequestUsageProbe's parameters on the wire.
type RequestUsageProbeResult ¶
type RequestUsageProbeResult struct {
}
RequestUsageProbeResult is RequestUsageProbe's result on the wire; an error travels in the reply.
type ResetParams ¶
type ResetParams struct {
ID core.WorkspaceID `json:"id"`
Req core.ReqID `json:"req"`
}
ResetParams are Reset's parameters on the wire.
type ResetResult ¶
type ResetResult struct {
}
ResetResult is Reset's result on the wire; an error travels in the reply.
type ResumeParams ¶
type ResumeParams struct {
ID core.InstanceID `json:"id"`
Req core.ReqID `json:"req"`
}
ResumeParams are Resume's parameters on the wire.
type ResumeResult ¶
type ResumeResult struct {
}
ResumeResult is Resume's result on the wire; an error travels in the reply.
type ResumeWithParams ¶
type ResumeWithParams struct {
ID core.InstanceID `json:"id"`
Opts launch.Options `json:"opts"`
Base string `json:"base"`
Req core.ReqID `json:"req"`
}
ResumeWithParams are ResumeWith's parameters on the wire.
type ResumeWithResult ¶
type ResumeWithResult struct {
}
ResumeWithResult is ResumeWith's result on the wire; an error travels in the reply.
type RunningAsAccountParams ¶
type RunningAsAccountParams struct {
}
RunningAsAccountParams are RunningAsAccount's parameters on the wire.
type RunningAsAccountResult ¶
type RunningAsAccountResult struct {
Value string `json:"value"`
}
RunningAsAccountResult is RunningAsAccount's result on the wire; an error travels in the reply.
type SaveForQuitParams ¶
type SaveForQuitParams struct {
}
SaveForQuitParams are SaveForQuit's parameters on the wire.
type SaveForQuitResult ¶
type SaveForQuitResult struct {
}
SaveForQuitResult is SaveForQuit's result on the wire; an error travels in the reply.
type SaveSettingsParams ¶
type SaveSettingsParams struct {
ID core.WorkspaceID `json:"id"`
Settings config.Settings `json:"settings"`
}
SaveSettingsParams are SaveSettings's parameters on the wire.
type SaveSettingsResult ¶
type SaveSettingsResult struct {
}
SaveSettingsResult is SaveSettings's result on the wire; an error travels in the reply.
type SendPromptParams ¶
type SendPromptParams struct {
ID core.InstanceID `json:"id"`
Text string `json:"text"`
Req core.ReqID `json:"req"`
}
SendPromptParams are SendPrompt's parameters on the wire.
type SendPromptResult ¶
type SendPromptResult struct {
}
SendPromptResult is SendPrompt's result on the wire; an error travels in the reply.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server serves a Backend to any number of connections. After every call and every wake it publishes (Backend.Sync) to every connection, but an event naming a request as forConn routes it: a Reply, or a request's Notice, only to the connection that made the request, and Started or Recovered to every connection, naming the request to that one alone. A request's reply follows the events its call produced. A connection is sent the whole state (Backend.SyncAndSnapshot) when it connects.
func (*Server) Bye ¶
func (s *Server) Bye()
Bye starts a graceful stop: every connection is sent a bye, and from then on the server takes nothing new. A request is answered unavailable without reaching the backend, a cast is dropped, and a connection that joins is sent the bye after its snapshot. Replies to the requests in flight still follow, as their jobs land; Close ends the connections. It returns once the calls already let through have had their replies queued, so a Close after it flushes them, and whatever jobs they started are in flight when the caller waits for them (core.Loop.Quiesce).
func (*Server) Close ¶
func (s *Server) Close()
Close ends every connection and stops publishing. Unless the model has failed, it publishes once more first, so whatever the backend produced before Close (the Reply of a request in flight at the bye, say) reaches its client even if no wake has published it yet. Then every connection's writer flushes what is queued, a fatal frame included (in parallel, each for up to closeFlushTimeout), and every connection is closed, one that has not said hello included.
func (*Server) Fatal ¶
func (s *Server) Fatal() <-chan struct{}
Fatal is closed once the model is as good as gone (it panicked, or an event would not encode): whatever runs the server should stop. FatalError says why.
func (*Server) FatalError ¶
FatalError is the error that made the server fatal, nil while it is not.
func (*Server) Keep ¶
Keep holds notices for the next connection, as if raised while none was connected: a daemon's boot raises them before any client can be (core.Model.Boot).
func (*Server) Serve ¶
func (s *Server) Serve(nc io.ReadWriteCloser)
Serve serves nc on a goroutine of its own until it closes (serveConn). After Close it closes nc at once and serves nothing.
type SetDefaultAccountParams ¶
type SetDefaultAccountParams struct {
Name string `json:"name"`
}
SetDefaultAccountParams are SetDefaultAccount's parameters on the wire.
type SetDefaultAccountResult ¶
type SetDefaultAccountResult struct {
}
SetDefaultAccountResult is SetDefaultAccount's result on the wire; an error travels in the reply.
type SetHelpScreensSeenParams ¶
type SetHelpScreensSeenParams struct {
ID core.WorkspaceID `json:"id"`
Seen uint32 `json:"seen"`
}
SetHelpScreensSeenParams are SetHelpScreensSeen's parameters on the wire.
type SetHelpScreensSeenResult ¶
type SetHelpScreensSeenResult struct {
}
SetHelpScreensSeenResult is SetHelpScreensSeen's result on the wire; an error travels in the reply.
type SetLastUsedParams ¶
type SetLastUsedParams struct {
Name string `json:"name"`
}
SetLastUsedParams are SetLastUsed's parameters on the wire.
type SetLastUsedResult ¶
type SetLastUsedResult struct {
}
SetLastUsedResult is SetLastUsed's result on the wire; an error travels in the reply.
type SetSelectedParams ¶
type SetSelectedParams struct {
ID core.InstanceID `json:"id"`
}
SetSelectedParams are SetSelected's parameters on the wire.
type SetSelectedResult ¶
type SetSelectedResult struct {
}
SetSelectedResult is SetSelected's result on the wire; an error travels in the reply.
type SetUIPrefsParams ¶
type SetUIPrefsParams struct {
ID core.WorkspaceID `json:"id"`
Prefs config.UIPrefs `json:"prefs"`
}
SetUIPrefsParams are SetUIPrefs's parameters on the wire.
type SetUIPrefsResult ¶
type SetUIPrefsResult struct {
}
SetUIPrefsResult is SetUIPrefs's result on the wire; an error travels in the reply.
type UnregisterParams ¶
type UnregisterParams struct {
Name string `json:"name"`
}
UnregisterParams are Unregister's parameters on the wire.
type UnregisterResult ¶
type UnregisterResult struct {
}
UnregisterResult is Unregister's result on the wire; an error travels in the reply.
type VerifyDeadParams ¶
type VerifyDeadParams struct {
ID core.InstanceID `json:"id"`
}
VerifyDeadParams are VerifyDead's parameters on the wire.
type VerifyDeadResult ¶
type VerifyDeadResult struct {
}
VerifyDeadResult is VerifyDead's result on the wire; an error travels in the reply.
type ViewParams ¶
type ViewParams struct {
ID core.InstanceID `json:"id"`
}
ViewParams are View's parameters on the wire.
type ViewResult ¶
type ViewResult struct {
Value core.InstanceView `json:"value"`
OK bool `json:"ok"`
}
ViewResult is View's result on the wire; an error travels in the reply.
type ViewsParams ¶
type ViewsParams struct {
ID core.WorkspaceID `json:"id"`
}
ViewsParams are Views's parameters on the wire.
type ViewsResult ¶
type ViewsResult struct {
Value []core.InstanceView `json:"value"`
}
ViewsResult is Views's result on the wire; an error travels in the reply.
type WatchGitHubParams ¶
type WatchGitHubParams struct {
Repo string `json:"repo"`
}
WatchGitHubParams are WatchGitHub's parameters on the wire.
type WatchGitHubResult ¶
type WatchGitHubResult struct {
}
WatchGitHubResult is WatchGitHub's result on the wire; an error travels in the reply.
type WorkspaceParams ¶
type WorkspaceParams struct {
ID core.WorkspaceID `json:"id"`
}
WorkspaceParams are Workspace's parameters on the wire.
type WorkspaceResult ¶
type WorkspaceResult struct {
Value core.WorkspaceView `json:"value"`
OK bool `json:"ok"`
}
WorkspaceResult is Workspace's result on the wire; an error travels in the reply.
type WorkspacesParams ¶
type WorkspacesParams struct {
}
WorkspacesParams are Workspaces's parameters on the wire.
type WorkspacesResult ¶
type WorkspacesResult struct {
Value []core.WorkspaceView `json:"value"`
}
WorkspacesResult is Workspaces's result on the wire; an error travels in the reply.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
internal
|
|
|
gen
Package gen generates core/rpc's wire code from core.Core (core/iface.go): every method's parameter and result types, the method table, the server's dispatch, and the client's methods.
|
Package gen generates core/rpc's wire code from core.Core (core/iface.go): every method's parameter and result types, the method table, the server's dispatch, and the client's methods. |
|
gen/cmd
command
Command cmd writes core/rpc/methods_gen.go from core/iface.go.
|
Command cmd writes core/rpc/methods_gen.go from core/iface.go. |