Documentation
¶
Index ¶
- Constants
- Variables
- func CreateDeepTree(tree entities.Hash, store entities.CASStore) (*gitobjects.DeepTreeObject, error)
- func DeepTreeForTree(ctx context.Context, tree entities.Hash, store entities.CASStore) (*gitobjects.DeepTreeObject, error)
- func DiffRunInfo(out io.Writer, r1, r2 *EvalResponse)
- func FetchMultiObject[T any](ctx context.Context, store entities.CASStore, hashes []entities.Hash) ([]*T, error)
- func FetchObject[T any](ctx context.Context, store entities.CASStore, hash Hash) (*T, error)
- func FetchObjectWarnOnRetry[T any](ctx context.Context, store entities.CASStore, h entities.Hash, ...) (*T, error)
- func FetchObjectWithRetry[T any](ctx context.Context, store entities.CASStore, h entities.Hash, ...) (obj *T, err error)
- func FindRootForSocket(root, socketName string) (string, error)
- func GetDigestMapResult(ctx context.Context, store entities.CASStore, tree entities.Hash) (entities.Hash, error)
- func IsMatchError(err error) bool
- func NewDeepTreeRequest(tree entities.Hash, store entities.CASStore) *maps.MapRequest
- func PrefetchDirs(dirPatterns []string, cacheman *client.Client, priority float64) error
- func PrefetchInputPatch(p entities.Patch, cacheman *client.Client) error
- func PrefetchSymlinks(ctx context.Context, deepTree *gitobjects.DeepTreeObject, ...) error
- func ProcessResp(e EvalPostProcess)
- func PutDeepTree(ctx context.Context, entries []*entities.DeepEntry, store entities.CASStore) (entities.Hash, error)
- func TransformReadPatchEntry(p *entities.PatchEntry, revalidate bool) *entities.PatchEntry
- func UnpackDeepTree(ctx context.Context, deeptree *gitobjects.DeepTreeObject, ...) (int64, int64, error)
- type BuildHash
- type BuildInfo
- type BuildRequest
- type BuildRequestCtx
- type BuildResult
- type BuildStart
- type BuildStartData
- type ChrootRequest
- type Client
- func (c *Client) AddDigestMapEntries(ctx context.Context, entries []DigestEntry) error
- func (c *Client) AddGitRepo(workDir, gitDir, objectsDir string, treeHash entities.Hash) error
- func (c *Client) ApplyPatch(match, patch entities.Patch, deletes entities.DeletePatch, chroot string) error
- func (c *Client) Chroot(chroot string, overlays, views []string) error
- func (c *Client) Clone(commit, path string) error
- func (c *Client) Close() error
- func (c *Client) Execute(evalReq entities.Hash, patches []entities.Hash, ...) (resp entities.Hash, err error)
- func (c *Client) ExecuteSupport() (bool, error)
- func (c *Client) FetchHashStats(chroot string, paths []string) ([]entities.HashStat, error)
- func (c *Client) FetchHashes(chroot string, paths []string) ([]entities.Hash, error)
- func (c *Client) GetWS() (*WorkspaceStatus, error)
- func (c *Client) LoadTreeDigestMap(ctx context.Context, tree entities.Hash) error
- func (c *Client) MountDetails() (*MountDetails, error)
- func (c *Client) ProviderPing() error
- func (c *Client) PutWS(ws string, isNew bool, strategy PutStrategy) error
- func (c *Client) RemoveWS() error
- func (c *Client) RestoreSnapshot(ctx context.Context, snap Snapshot) error
- func (c *Client) Root() string
- func (c *Client) Snapshot(ctx context.Context) (Snapshot, error)
- func (c *Client) Store() entities.CASStore
- func (c *Client) StoreEnvVars(envVars map[string]string) (Hash, error)
- func (c *Client) UseMany(hashes []entities.Hash) error
- func (c *Client) WaitFor(timeout time.Duration, priority float64, objects []entities.Hash) error
- type DeepTreeRequest
- type DigestEntry
- type DigestMap
- type DigestMapRequest
- type EnvVars
- type Eval
- type EvalPostProcess
- type EvalRequest
- type EvalResponse
- func DecodeEvalResponse(hash Hash, content []byte) (*EvalResponse, error)
- func EvalRespFromTapResult(tap entities.TapCmdResult) *EvalResponse
- func ResponseFromRun(r run.RunResult) *EvalResponse
- func Revalidate(ctx context.Context, abfs *Client, chroot string, outHash entities.Hash, ...) (*EvalResponse, error)
- type FileEntry
- type GitRepo
- type GitRepoSnapshot
- type Hash
- type HashStat
- type IndexSnapEntry
- type IndexSnapObject
- type JSONBaseObject
- type LFSRequest
- type LFSResult
- type MatchError
- type MountDaemon
- type MountDetails
- type NSJailBuild
- type NinjaFailure
- type NinjaRunInfo
- type NinjaStats
- type Object
- type ObjectType
- type OldBuildResult01
- type PackContentType
- type PackEntry
- type PackFiles
- type PackingStrategy
- type PatchObject
- type ProjectStatus
- type PutStrategy
- type PutWSRequest
- type ReadPatchFilter
- type SHA256
- type Snapshot
- type UnmountDetails
- type ValidateInfo
- type WSSnapshot
- type WorkspaceStatus
Constants ¶
const ( CtrlDir = ".ctrl" TapCtrlDir = "tap" )
const ( CurrentDeepTreeRequestVersion = objects.CurrentDeepTreeRequestVersion ObjectTypeDeepTreeRequest entities.ObjectType = objects.ObjectTypeDeepTreeRequest DeepTreeThreshold = 1000 )
const ( CurrentDigestMapRequestVersion = "0.1" ObjectTypeDigestMapRequest entities.ObjectType = "digestmap-request" )
const ( CurrentDigestMapVersion = "0.1" ObjectTypeDigestMap entities.ObjectType = "digestmap" DigestMapThreshold = 1000 )
const ( CurrentPackFilesVersion = "0.2" ObjectTypePackFiles = "pack-files" )
const ( ContentPrefetchPriority = 0.3 PrefetchSymlinksPriority = 0.3 )
const ( CurrentProjectStatusVersion = "0.2" ObjectTypeProjectStatus = "project-status" )
const ( CurrentWSSnapshotVersion = "0.1" ObjectTypeWSSnapshot entities.ObjectType = "ws-snapshot" )
const ( CurrentIndexSnapObjectVersion = "0.1" ObjectTypeIndexSnapObject entities.ObjectType = "index-snap-object" )
const OldBuildResult01Version = "0.1"
const PacksRefs = "abfs/pushed-packs"
const ProjectStatusRef = "abfs/project-status"
Variables ¶
var ( ObjectJSONEncode = objects.ObjectJSONEncode ObjectJSONDecode = objects.ObjectJSONDecode )
var EmptyIndexSnapObject = &IndexSnapObject{ Version: CurrentIndexSnapObjectVersion, }
Functions ¶
func CreateDeepTree ¶
func CreateDeepTree(tree entities.Hash, store entities.CASStore) (*gitobjects.DeepTreeObject, error)
func DeepTreeForTree ¶
func DeepTreeForTree(ctx context.Context, tree entities.Hash, store entities.CASStore) (*gitobjects.DeepTreeObject, error)
func DiffRunInfo ¶
func DiffRunInfo(out io.Writer, r1, r2 *EvalResponse)
func FetchMultiObject ¶
func FetchObject ¶
func FetchObjectWarnOnRetry ¶
func FetchObjectWithRetry ¶
func FindRootForSocket ¶
func GetDigestMapResult ¶
func IsMatchError ¶
func NewDeepTreeRequest ¶
func PrefetchDirs ¶
func PrefetchSymlinks ¶
func PrefetchSymlinks(ctx context.Context, deepTree *gitobjects.DeepTreeObject, store entities.CASStore, cacheman *client.Client) error
func ProcessResp ¶
func ProcessResp(e EvalPostProcess)
ProcessResp strips any chroot prefix off of the eval response paths and labels the inputs and outputs with the appropriate expected vs. unexpected labels.
func PutDeepTree ¶
func TransformReadPatchEntry ¶
func TransformReadPatchEntry(p *entities.PatchEntry, revalidate bool) *entities.PatchEntry
func UnpackDeepTree ¶
func UnpackDeepTree(ctx context.Context, deeptree *gitobjects.DeepTreeObject, store entities.CASStore) (int64, int64, error)
Types ¶
type BuildInfo ¶
type BuildInfo struct {
JSONBaseObject
Version string
BuildStartData
BuildStart string
RootEnd string
End time.Time
Error string
NinjaLog string
WrapLog string
CmdMapLog string
MismatchesLog string
NinjaRunInfo []NinjaRunInfo
}
type BuildRequest ¶
type BuildRequest struct {
JSONBaseObject
Version string
RequestCtx BuildRequestCtx
RefPrefix string
PinnedManifestHash Hash
BuildCommand string
NSJailBuild NSJailBuild
}
func (*BuildRequest) Encode ¶
func (e *BuildRequest) Encode() error
func (*BuildRequest) Links ¶
func (e *BuildRequest) Links() []Hash
type BuildRequestCtx ¶
type BuildResult ¶
type BuildResult struct {
JSONBaseObject
Version string
BuildRequest Hash
MountDetails Hash
BuildHashes []BuildHash
UnmountDetails Hash
// UploadSecs is how long it took the cache to upload everything after the build completed, or the timeout value if waiting timed out
UploadSecs float64
Err string
}
func (*BuildResult) Encode ¶
func (e *BuildResult) Encode() error
func (*BuildResult) Links ¶
func (e *BuildResult) Links() []Hash
type BuildStart ¶
type BuildStart struct {
JSONBaseObject
Version string
BuildStartData
}
func ReadBuildStart ¶
func ReadBuildStart(chroot, outDir string) (bs *BuildStart, retErr error)
func (*BuildStart) Encode ¶
func (e *BuildStart) Encode() error
func (*BuildStart) Links ¶
func (e *BuildStart) Links() []Hash
type BuildStartData ¶
type BuildStartData struct {
BuildID string
MountDetails string
RootBegin string
Start time.Time
PreviousBuild string
OutDir string
BuildCommand []string
}
BuildStartData is embedded in the BuildStart and BuildInfo objects. The reason that BuildStartData needed to be extracted out was that both BuildStart and BuildInfo implement JSONBaseObject and it is better to not to hide methods like Encode() or Links().
type ChrootRequest ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) AddDigestMapEntries ¶
func (c *Client) AddDigestMapEntries(ctx context.Context, entries []DigestEntry) error
func (*Client) AddGitRepo ¶
func (*Client) ApplyPatch ¶
func (*Client) ExecuteSupport ¶
func (*Client) FetchHashStats ¶
func (*Client) FetchHashes ¶
func (*Client) GetWS ¶
func (c *Client) GetWS() (*WorkspaceStatus, error)
func (*Client) LoadTreeDigestMap ¶
func (*Client) MountDetails ¶
func (c *Client) MountDetails() (*MountDetails, error)
func (*Client) ProviderPing ¶
func (*Client) RestoreSnapshot ¶
func (*Client) StoreEnvVars ¶
type DeepTreeRequest ¶
type DeepTreeRequest = objects.DeepTreeRequest
type DigestEntry ¶
type DigestMap ¶
type DigestMap struct {
JSONBaseObject
Version string
// Digests' order is arbitrary and can't be relied on.
Digests []DigestEntry
DigestMaps []Hash
}
type DigestMapRequest ¶
type DigestMapRequest struct {
JSONBaseObject
Version string
Tree Hash
}
func (*DigestMapRequest) Decode ¶
func (d *DigestMapRequest) Decode(hash Hash, content []byte) error
func (*DigestMapRequest) Encode ¶
func (d *DigestMapRequest) Encode() error
func (*DigestMapRequest) Links ¶
func (d *DigestMapRequest) Links() []Hash
type EnvVars ¶
type EnvVars struct {
JSONBaseObject
Vars map[string]string
}
type Eval ¶
type Eval struct {
Log io.Writer
Filter ReadPatchFilter
VI ValidateInfo
StrictTappingOff bool
// contains filtered or unexported fields
}
func NewEval ¶
func NewEval(abfs *Client, chroot string, strictTapping bool, req *EvalRequest, buildStart *BuildStart) *Eval
func (*Eval) MapRequest ¶
func (e *Eval) MapRequest(proc *exec.Cmd) *maps.MapRequest
type EvalPostProcess ¶
type EvalPostProcess struct {
Resp *EvalResponse
// ChrootToStrip is the chroot prefix to strip off of the eval response paths.
// It is not joined with the CWD for path resolution. Append the chroot to CWD value if this is necessary.
ChrootToStrip string
Req *EvalRequest
// CWD is optional if we are already os.Chdir'd to the correct directory.
// If specified, it is joined with any relative paths that
// need to be opened like DepFile and symlinks. It is not joined with
// ChrootToStrip.
CWD string
}
type EvalRequest ¶
type EvalRequest struct {
JSONBaseObject
Version string
Salt string `json:",omitempty"`
Targets []string
DepFile string `json:",omitempty"`
Command string
// Inputs is deprecated - use InputPatch
Inputs map[string]Hash `json:",omitempty"`
// The State field isn't used in the PatchEntry structs
InputPatch entities.Patch
RSP string `json:",omitempty"`
EnvVars Hash
// CWD - current working directory
CWD string `json:",omitempty"`
}
func (*EvalRequest) Encode ¶
func (e *EvalRequest) Encode() error
func (*EvalRequest) Links ¶
func (e *EvalRequest) Links() []Hash
type EvalResponse ¶
type EvalResponse struct {
JSONBaseObject
Version string
EvalRequest Hash
Stdout string
Stderr string
ExitCode int
RunInfo struct {
Pid int
Timestamp time.Time
BuildStartHash Hash
RunDuration float64
SnapshotDuration float64
PostProcessDuration float64
UserTime float64
SysTime float64
Memory int64
TapCounts map[string]uint64 `json:",omitempty"`
IO struct {
In int64
Out int64
}
Misc struct {
SoftFault int64
HardFault int64
VolContextSwitch int64
ForcedContextSwitch int64
}
}
ReadPatch entities.Patch
MissingReads map[string]entities.PatchEntryState `json:",omitempty"`
WritePatch entities.Patch
MissingWrites map[string]entities.PatchEntryState `json:",omitempty"`
Deletes entities.DeletePatch
}
func DecodeEvalResponse ¶
func DecodeEvalResponse(hash Hash, content []byte) (*EvalResponse, error)
func EvalRespFromTapResult ¶
func EvalRespFromTapResult(tap entities.TapCmdResult) *EvalResponse
EvalRespFromTapResult does a conversion of the raw tap data into an EvalResponse. ProcessResult will likely need to be called afterwards before use/storage.
func ResponseFromRun ¶
func ResponseFromRun(r run.RunResult) *EvalResponse
func Revalidate ¶
func Revalidate(ctx context.Context, abfs *Client, chroot string, outHash entities.Hash, filter ReadPatchFilter) (*EvalResponse, error)
Revalidate if a output hash is still valid based on the current work directory
func (*EvalResponse) CPUTime ¶
func (e *EvalResponse) CPUTime() float64
func (*EvalResponse) Encode ¶
func (e *EvalResponse) Encode() error
func (*EvalResponse) Links ¶
func (e *EvalResponse) Links() []Hash
type GitRepoSnapshot ¶
type IndexSnapEntry ¶
type IndexSnapObject ¶
type IndexSnapObject struct {
JSONBaseObject
Version string
Entries []IndexSnapEntry
}
func (*IndexSnapObject) Encode ¶
func (s *IndexSnapObject) Encode() error
func (*IndexSnapObject) Links ¶
func (s *IndexSnapObject) Links() []Hash
type JSONBaseObject ¶
type JSONBaseObject = objects.JSONBaseObject
type LFSRequest ¶
type LFSRequest struct {
JSONBaseObject
LFSOID string // git-lfs representation (does not include a header)
}
func (*LFSRequest) Encode ¶
func (l *LFSRequest) Encode() error
func (*LFSRequest) Links ¶
func (l *LFSRequest) Links() []Hash
type LFSResult ¶
type LFSResult struct {
JSONBaseObject
LFSRequest Hash
ABFSOID Hash // ABFS hash representation (does include blob header)
}
type MatchError ¶
type MatchError struct {
// contains filtered or unexported fields
}
func NewMatchError ¶
func NewMatchError(format string, args ...any) *MatchError
func (*MatchError) Error ¶
func (e *MatchError) Error() string
type MountDaemon ¶
type MountDetails ¶
type MountDetails struct {
JSONBaseObject
Version string
PID int
StartTime time.Time
StartTimestamp int64
CmdArgs []string
MetaRefPrefix string
UserName string
HostName string
ABFSVersion string
ManifestHash Hash
PinnedManifestHash Hash
Config *instance.Config
MountDuration float64
Error string
}
func (*MountDetails) Encode ¶
func (e *MountDetails) Encode() error
func (*MountDetails) Links ¶
func (e *MountDetails) Links() []Hash
type NSJailBuild ¶
type NinjaFailure ¶
type NinjaRunInfo ¶
type NinjaRunInfo struct {
*NinjaStats
BuildsFiles map[string]string
}
type NinjaStats ¶
type NinjaStats struct {
GoalTargets []string
StartTime time.Time
RunSecs float64
ParseSecs float64
LoadNinjaFilesSecs float64
LoadFilesSecs float64
BuildGraphSecs float64
InitStatesSecs float64
EvalFilesSecs float64
EvalNodesSecs float64
GraphNodesCount int
GraphFilesCount int
Failures []NinjaFailure
NodesCount uint32
DoneCount uint32
FailCount uint32
SkipCount uint32
CacheHitCount uint32
CacheMissCount uint32
CacheForceCount uint32
CacheHitPercent float64
NinjaEntryFile string
BuildFiles []string `json:",omitempty"`
Error string
}
type ObjectType ¶
type ObjectType = entities.ObjectType
const ( CurrentBuildInfoVersion = "0.1" ObjectTypeBuildStart ObjectType = "build-start" ObjectTypeBuildInfo ObjectType = "build-info" )
const ( CurrentBuildRequestVersion = "0.1" ObjectTypeBuildRequest ObjectType = "build-request" )
const ( CurrentBuildResultVersion = "0.2" ObjectTypeBuildResult ObjectType = "build-result" )
const ( ObjectTypeEnvVars ObjectType = "env-vars" // Bump the eval-request judiciously. It will result in 100% cache misses // until the cache is warmed again. CurrentEvalRequestVersion = "0.9.2" ObjectTypeEvalRequest ObjectType = "eval-request" CurrentEvalResponseVersion = "0.7.5" ObjectTypeEvalResponse ObjectType = "eval-response" )
const ( CurrentMountDetailsVersion = "0.2" ObjectTypeMountDetails ObjectType = "mount-details" )
const ( CurrentUnmountDetailsVersion = "0.1" ObjectTypeUnmountDetails ObjectType = "unmount-details" )
const ( CurrentPatchVersion = "0.1" ObjectTypePatch ObjectType = "patch" )
const (
ObjectTypeLFSRequest ObjectType = "lfs-request"
)
const (
ObjectTypeLFSResult ObjectType = "lfs-result"
)
type OldBuildResult01 ¶
type OldBuildResult01 struct {
JSONBaseObject
Version string
BuildRequest Hash
MountDetails Hash
BuildInfos []Hash
UnmountDetails Hash
Err string
}
OldBuildResult01 was the format of the struct at version 0.1
func (*OldBuildResult01) ToBuildResult ¶
func (br *OldBuildResult01) ToBuildResult(e *BuildResult)
type PackContentType ¶
type PackContentType string
const ( CommitsPack PackContentType = "commits" TreesPack PackContentType = "trees" BlobsListPack PackContentType = "blobs-list" BlobsPack PackContentType = "blobs" )
type PackFiles ¶
type PackFiles struct {
JSONBaseObject
Version string
Strategy PackingStrategy
LastUpdateTime time.Time
Packs []PackEntry
}
func FetchPacksFromStore ¶
type PackingStrategy ¶
type PackingStrategy string
const ( PackingStrategyNone PackingStrategy = "none" PackingStrategyCommits PackingStrategy = "commits" PackingStrategyTrees PackingStrategy = "trees" PackingStrategyBlobsList PackingStrategy = "blobs-list" PackingStrategyBlobs PackingStrategy = "blobs" )
func (PackingStrategy) Validate ¶
func (s PackingStrategy) Validate() error
type PatchObject ¶
type PatchObject struct {
JSONBaseObject
// we can't embed entities.Patch into this object because then the JSON Marshaler
// just calls entities.Patch.MarshalJSON() and ignores the Version field
Patch entities.Patch
Version string
}
func (*PatchObject) Encode ¶
func (e *PatchObject) Encode() error
func (*PatchObject) Links ¶
func (e *PatchObject) Links() []Hash
type ProjectStatus ¶
type ProjectStatus struct {
JSONBaseObject
Version string
Pusher string
LFS bool
LastSuccess time.Time
LastUpdate time.Time
LastError string
}
func (*ProjectStatus) Encode ¶
func (p *ProjectStatus) Encode() error
func (*ProjectStatus) Links ¶
func (p *ProjectStatus) Links() []Hash
type PutStrategy ¶
type PutStrategy string
const ( PutStrategyExactMatch PutStrategy = "exact-match" PutStrategyLocalWin PutStrategy = "local-wins" PutStrategyRemoteWin PutStrategy = "remote-wins" )
func (PutStrategy) IsValid ¶
func (s PutStrategy) IsValid() bool
type PutWSRequest ¶
type PutWSRequest struct {
WS string
IsNew bool
Strategy PutStrategy
}
type ReadPatchFilter ¶
type ReadPatchFilter interface {
Filter(patch entities.Patch, revalidate bool) (entities.Patch, error)
}
Filter a read patch, returning version of read patch and if it should be tried as part of apply
func NewReadPatchFilter ¶
func NewReadPatchFilter() ReadPatchFilter
type Snapshot ¶
type Snapshot struct {
Root entities.Hash
GitRepos []GitRepoSnapshot
Conflicts []string
}
type UnmountDetails ¶
type UnmountDetails struct {
JSONBaseObject
Version string
MountDetails Hash
MountedDuration float64
UnmountTime time.Time
ABFSKillDuration float64
UnmountDuration float64
UnmountBusy float64
}
func (*UnmountDetails) Encode ¶
func (e *UnmountDetails) Encode() error
func (*UnmountDetails) Links ¶
func (e *UnmountDetails) Links() []Hash
type ValidateInfo ¶
type ValidateInfo interface {
ValidateError(resp *EvalResponse, err error)
}
type WSSnapshot ¶
type WSSnapshot struct {
JSONBaseObject
Version string
MountDetails entities.Hash
Time time.Time
Snapshot Snapshot
}
func (*WSSnapshot) Encode ¶
func (s *WSSnapshot) Encode() error
func (*WSSnapshot) Links ¶
func (s *WSSnapshot) Links() []Hash