Documentation ¶
Overview ¶
Package archiver implements the pipeline to efficiently archive file sets to an isolated server as fast as possible.
Index ¶
- type Archiver
- func (a *Archiver) Cancel(reason error)
- func (a *Archiver) CancelationReason() error
- func (a *Archiver) Channel() <-chan error
- func (a *Archiver) Close() error
- func (a *Archiver) Push(displayName string, source isolatedclient.Source, priority int64) *Item
- func (a *Archiver) PushFile(displayName, path string, priority int64) *Item
- func (a *Archiver) Stats() *Stats
- type Item
- type Stats
- type UploadStat
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Archiver ¶
type Archiver struct {
// contains filtered or unexported fields
}
Archiver is an high level interface to an isolatedclient.Client.
Uses a 4 stages pipeline, each doing work concurrently:
- Deduplicating similar requests or known server hot cache hits.
- Hashing files.
- Batched cache hit lookups on the server.
- Uploading cache misses.
func New ¶
New returns a thread-safe Archiver instance.
If not nil, out will contain tty-oriented progress information.
ctx will be used for logging.
func (*Archiver) CancelationReason ¶
CancelationReason implements common.Canceler
func (*Archiver) Channel ¶
Channel implements common.Canceler
func (*Archiver) Close ¶
Close waits for all pending files to be done. If an error occured during processing, it is returned.
func (*Archiver) Push ¶
Push schedules item upload to the isolate server. Smaller priority value means earlier processing.
func (*Archiver) PushFile ¶
PushFile schedules file upload to the isolate server. Smaller priority value means earlier processing.
type Item ¶
type Item struct { // Immutable. DisplayName string // Name to use to qualify this item // contains filtered or unexported fields }
Item is an item to process.
It is caried over from pipeline stage to stage to do processing on it.
func PushDirectory ¶
PushDirectory walks a directory at root and creates a .isolated file.
It walks the directories synchronously, then returns a *Item to signal when the background work is completed. The Item is signaled once all files are hashed. In particular, the *Item is signaled before server side cache lookups and upload is completed. Use archiver.Close() to wait for completion.
relDir is a relative directory to offset relative paths against in the generated .isolated file.
blacklist is a list of globs of files to ignore.
func (*Item) Digest ¶
Digest returns the calculated digest once calculated, empty otherwise.
func (*Item) Error ¶
Error returns any error that occurred for this item if any.
func (*Item) SetErr ¶
SetErr forcibly set an item as failed. Normally not used by callers.
type Stats ¶
type Stats struct { Hits []units.Size // Bytes; each item is immutable. Pushed []*UploadStat // Misses; each item is immutable. }
Stats is statistics from the Archiver.
func (*Stats) TotalBytesHits ¶
TotalBytesHits is the number of bytes not uploaded due to cache hits on the server.
func (*Stats) TotalBytesPushed ¶
TotalBytesPushed returns the sum of bytes uploaded.
func (*Stats) TotalHits ¶
TotalHits is the number of cache hits on the server.