Documentation
¶
Overview ¶
Package payload carries the files a run on a remote runhost takes from the device: its inputs, the files that answer its intake questions, the knowledge packs it attaches, its Writing Voice and its report design. The device packs them into one tar, which follows the job's document (and its release, when the runhost asks for it) and is laid down in the job's private directory on the server.
A member's name is one of the kinds below, then a name of its own: inputs/<name>…, intake/<id>/<name>…, knowledge/<pack>/…, voice/VOICE.md and design/report-design.json. Only regular files and directories travel.
Index ¶
Constants ¶
const ( KindInputs = "inputs" KindIntake = "intake" KindKnowledge = "knowledge" KindVoice = "voice" KindDesign = "design" )
The kinds of member, each the first segment of a member's name.
const MaxPayload = 4 << 30
MaxPayload bounds the files one run takes: the same as the most output a run gives back.
Variables ¶
This section is empty.
Functions ¶
func CleanName ¶
CleanName is name when it is a clean relative member name under one of the kinds, else "".
func Unpack ¶
Unpack reads exactly size bytes of r, a tar Pack wrote whose digest is digest, into dir, which it creates owner-only: regular files and directories only, each under a clean member name, so no entry lands outside dir. The digest is checked once the stream ends; a payload that does not match leaves dir to its caller to remove.
Types ¶
type Entry ¶
type Entry struct {
// Name is the member's slash-separated name: a kind, then its own.
Name string
// Src is the file or directory on the device. A link to a regular file
// is read through, as a local run copies one; a link inside a directory
// to a directory is not followed.
Src string
}
Entry is one file or directory of the device's, packed under Name.
type Packed ¶
type Packed struct {
// Path is the packed tar, owner-only, which Remove deletes.
Path string
Size int64
Digest string
// contains filtered or unexported fields
}
Packed is a payload packed into a file of its own, ready to send.
func Pack ¶
Pack packs entries into a tar in a private temporary directory and answers its size and digest. Packing first, rather than while sending, means a file that changes meanwhile cannot make the stream disagree with the size the job names.