home

package
v0.2.65 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 27, 2026 License: MPL-2.0 Imports: 12 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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)
  credentials/<id>.lock   held by the txco attach serving a while-running one
  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

Constants

This section is empty.

Variables

This section is empty.

Functions

func Pretty

func Pretty(path string) string

Pretty shows a path with the home directory as "~", as it is shown to the owner and to the chassis.

func ValidID

func ValidID(id string) bool

ValidID reports whether id has a credential id's shape, so an id can never name a path outside the folder.

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"`
	// WhileRunning: the share ends when the `txco attach` that made it
	// stops, as the site asked. Only that process serves it, holding its
	// lock (Hold) all along, and it removes the credential as it stops. One
	// whose lock is free was left by a process that died: the next `txco
	// attach` removes it.
	WhileRunning bool `json:"while_running,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 (h Home) ChassisDir() string

func (Home) CredentialsDir

func (h Home) CredentialsDir() string

func (Home) End

func (h Home) End(id, reason string) error

End marks a credential as finished, with the chassis's reason.

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) Hold added in v0.2.65

func (h Home) Hold(id string) error

Hold takes id's lock for this process, until Release or Remove. It fails while any other holder has it, in this process or another.

func (Home) Holds added in v0.2.65

func (h Home) Holds(id string) bool

Holds reports whether this process holds id's lock.

func (Home) JobsDir

func (h Home) JobsDir() string

func (Home) Left added in v0.2.65

func (h Home) Left(id string) bool

Left reports whether id is a while-running credential's that nobody holds: its txco attach died.

func (Home) Load

func (h Home) Load() ([]Credential, error)

Load reads every credential in the folder, ended ones included, in id order.

func (Home) LogPath

func (h Home) LogPath() string

func (Home) OpsParent

func (h Home) OpsParent() string

OpsParent is the directory that holds the owner's OPS/ tree: what the chassis is given as --system-opstacks-dir.

func (Home) Release added in v0.2.65

func (h Home) Release(id string)

Release gives up id's lock, if this process holds it.

func (Home) Remove added in v0.2.65

func (h Home) Remove(id string) error

Remove deletes a credential and its lock, and releases it. Only its holder removes one.

func (Home) Save

func (h Home) Save(c Credential) error

Save writes a credential, readable by its owner alone.

func (Home) StateDir

func (h Home) StateDir(credential string) string

StateDir is one credential's own folder for a product's files.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL