Documentation
¶
Overview ¶
Package home is the one folder `txco attach` keeps on a machine:
<txco home>/attach/
credentials/<id>.json one per attached workspace: the address, the
credential's id, its folder and its key (0600)
OPS/_attach/… the owner's own rules for the _attach stack
state/<id>/ TXCO_ATTACH_STATE: a product's own files
jobs/<job>/ detached jobs (chassis/workspace/detach)
chassis/ the small chassis's own stores
attach.log
It is a package of its own, with no chassis in it, because three things read it: the command, the link, and the workspace provider that runs the owner's commands.
Index ¶
- func Pretty(path string) string
- func ValidID(id string) bool
- type Credential
- type Home
- func (h Home) ChassisDir() string
- func (h Home) CredentialsDir() string
- func (h Home) End(id, reason string) error
- func (h Home) Get(id string) (Credential, bool)
- func (h Home) JobsDir() string
- func (h Home) Load() ([]Credential, error)
- func (h Home) LogPath() string
- func (h Home) OpsParent() string
- func (h Home) Save(c Credential) error
- func (h Home) StateDir(credential string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Credential ¶
type Credential struct {
ID string `json:"credential"`
// Address is the chassis to dial, scheme and host.
Address string `json:"address"`
// Name and Label are what the chassis said the credential is for.
Name string `json:"name,omitempty"`
Label string `json:"label,omitempty"`
// Root is the folder commands run in: the absolute path of the
// directory `txco attach <code>` was run in. It is written once, at
// enrollment, and nothing later changes it — not a reconnect, not a
// restart, not running the command from somewhere else. Moving a
// workspace to another folder is a new code, enrolled there.
Root string `json:"root"`
// Seed is the Ed25519 private key's seed. It never leaves this file.
Seed []byte `json:"key"`
Machine string `json:"machine,omitempty"`
CreatedAt time.Time `json:"created_at"`
// Ended is set when the chassis said this credential is finished
// (replaced or revoked). It is kept, not deleted, so the owner can see
// what happened; it is never dialed again.
Ended string `json:"ended,omitempty"`
}
Credential is one attached workspace, as this machine holds it.
func (Credential) Key ¶
func (c Credential) Key() ed25519.PrivateKey
Key is the credential's private key.
type Home ¶
type Home struct{ Dir string }
Home is the attach folder.
func (Home) ChassisDir ¶
func (Home) CredentialsDir ¶
func (Home) Get ¶
func (h Home) Get(id string) (Credential, bool)
Get reads one credential. ok is false when there is none, or its file does not hold a usable one.
func (Home) Load ¶
func (h Home) Load() ([]Credential, error)
Load reads every credential in the folder, ended ones included, in id order.
func (Home) OpsParent ¶
OpsParent is the directory that holds the owner's OPS/ tree: what the chassis is given as --system-opstacks-dir.
func (Home) Save ¶
func (h Home) Save(c Credential) error
Save writes a credential, readable by its owner alone.