Documentation
¶
Overview ¶
Package ctl serves the control protocol of a workspace: one JSON object for each line over a unix socket. The fixtures in testdata/ctl at the repository root pin each operation and its errors.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Listen ¶
Listen binds the control socket before a caller mounts. The socket must lie in a directory that only the workspace of this mount can reach: the directory may not be open to others, and the socket is created 0660 and owned by uid and gid, so no other workspace or node process can connect.
Types ¶
type ChangeEntry ¶
type ChangeEntry struct {
Path string `json:"path"`
Status string `json:"status"`
OldSHA string `json:"old_sha,omitempty"`
OldMode uint32 `json:"old_mode,omitempty"`
OldSize int64 `json:"old_size,omitempty"`
NewSHA string `json:"new_sha,omitempty"`
NewMode uint32 `json:"new_mode,omitempty"`
Size int64 `json:"size,omitempty"`
}
ChangeEntry is one file whose content in the view differs from the base tree. The SHAs are git blob names; an absent side has no SHA and mode 0.
type Code ¶
type Code string
Code is the machine-readable cause of an error answer. The store codes of package api pass through, so the complete list is these and the codes of api.
type DirtyEntry ¶
type DirtyEntry struct {
Path string `json:"path"`
Kind string `json:"kind"` // file, symlink, dir, deleted
Exec bool `json:"exec,omitempty"`
Opaque bool `json:"opaque,omitempty"`
}
DirtyEntry is one path that the upper directory changes against the base tree.
type Server ¶
type Server struct {
Store store.Store
Cache *store.Cache
Workspace Workspace
// MaxLine is the longest request line in bytes. Zero is 64 MiB. A longer line gets a line_too_long answer, and
// the connection stays open.
MaxLine int
// contains filtered or unexported fields
}
Server serves the control protocol of one workspace.
type Stats ¶
type Stats struct {
BlobHits int64 `json:"blob_hits"`
BlobMisses int64 `json:"blob_misses"`
TreeCalls int64 `json:"tree_calls"`
}
Stats are the counters of the node cache.
type Workspace ¶
type Workspace interface {
BaseTree() string
Token() (upperdir.Token, error)
Dirty(ctx context.Context) ([]DirtyEntry, upperdir.Token, error)
Changes(ctx context.Context) ([]ChangeEntry, upperdir.Token, error)
Stats() Stats
}
Workspace is the part of the protocol that the lower layer answers: the change token, the dirty set and the changes of the upper directory against the base tree.