Documentation ¶
Overview ¶
Package isolated defines the isolated common code shared by the client and server.
Index ¶
- Constants
- func GetCompressor(namespace string, out io.Writer) (io.WriteCloser, error)
- func GetDecompressor(namespace string, in io.Reader) (io.ReadCloser, error)
- func GetHash(namespace string) crypto.Hash
- func HashFile(h crypto.Hash, path string) (isolateservice.HandlersEndpointsV1Digest, error)
- func Pack(values []int64) ([]byte, error)
- func Unpack(data []byte) ([]int64, error)
- type File
- type FileType
- type HexDigest
- type HexDigests
- type Isolated
Constants ¶
const IsolatedFormatVersion = "2.0"
IsolatedFormatVersion is version of *.isolated file format. Put into JSON.
Variables ¶
This section is empty.
Functions ¶
func GetCompressor ¶
GetCompressor returns a fresh instance of the compression algorithm.
It must be closed after use.
It is currently hardcoded to RFC 1950 (zlib).
func GetDecompressor ¶
GetDecompressor returns a fresh instance of the decompression algorithm.
It must be closed after use.
It is currently hardcoded to RFC 1950 (zlib).
func GetHash ¶
GetHash returns a fresh instance of the hashing algorithm to be used to calculate the HexDigest.
A prefix of "sha256-" and "sha512-" respectively returns a sha-256 and sha-512 instance. Otherwise a sha-1 instance is returned.
Types ¶
type File ¶
type File struct { Digest HexDigest `json:"h,omitempty"` Link *string `json:"l,omitempty"` Mode *int `json:"m,omitempty"` Size *int64 `json:"s,omitempty"` Type FileType `json:"t,omitempty"` }
File describes a single file referenced by content in a .isolated file.
For regular files, the Digest, Mode, and Size fields should be set, and the Type field should be set for non-basic files. For symbolic links, only the Link field should be set.
type FileType ¶
type FileType string
FileType describes the type of file being isolated.
const ( // Basic represents normal files. It is the default type. Basic FileType = "basic" // ArArchive represents an ar archive containing a large number of small files. ArArchive FileType = "ar" // TarArchive represents a tar archive containing a large number of small files. TarArchive FileType = "tar" )
type HexDigest ¶
type HexDigest string
HexDigest is the hash of a file that is hex-encoded. Only lower case letters are accepted.
type HexDigests ¶
type HexDigests []HexDigest
HexDigests is a slice of HexDigest that implements sort.Interface.
func (HexDigests) Len ¶
func (h HexDigests) Len() int
func (HexDigests) Less ¶
func (h HexDigests) Less(i, j int) bool
func (HexDigests) Swap ¶
func (h HexDigests) Swap(i, j int)
type Isolated ¶
type Isolated struct { Algo string `json:"algo"` // Must be "sha-1" Command []string `json:"command,omitempty"` Files map[string]File `json:"files,omitempty"` Includes HexDigests `json:"includes,omitempty"` RelativeCwd string `json:"relative_cwd,omitempty"` Version string `json:"version"` }
Isolated is the data from a JSON serialized .isolated file.