Documentation ¶
Overview ¶
Package trie provides a trie implementation specialised to Flair's requirements.
Not every possible setup is supported. Maybe eventually it will get cleverer.
Index ¶
- type DialCallback
- type ReplicatedAckFunc
- type ReplicatedFunc
- type Replicator
- func (r *Replicator) All(key string, f ReplicatedFunc) error
- func (r *Replicator) Parallel(key string, f ReplicatedFunc) error
- func (r *Replicator) ParallelDigest(digest *pb.Digest, f ReplicatedFunc) error
- func (r *Replicator) Sequential(key string, f ReplicatedFunc) error
- func (r *Replicator) SequentialAck(key string, f ReplicatedAckFunc) error
- func (r *Replicator) SequentialDigest(digest *pb.Digest, f ReplicatedFunc) error
- type Server
- type Trie
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DialCallback ¶
type DialCallback func(address string) (*grpc.ClientConn, error)
A DialCallback is called when we need to dial a new gRPC server.
type ReplicatedAckFunc ¶
A ReplicatedAckFunc is like a ReplicatedFunc but allows the caller to specify whether the call should retry on the next replica by returning true, or not by returning false.
type ReplicatedFunc ¶
A ReplicatedFunc is a function that is passed to the replicator that gets called potentially more than once against different servers. If the returned appear appears to be retryable we will try on a new replica (e.g. we would retry Unavailable errors where the server is down, we wouldn't retry InvalidArgument where it seems it would be pointless).
type Replicator ¶
A Replicator implements replication for our RPCs.
func NewReplicator ¶
func NewReplicator(t *Trie, replicas int) *Replicator
NewReplicator returns a new Replicator instance.
func (*Replicator) All ¶
func (r *Replicator) All(key string, f ReplicatedFunc) error
All sends a request to all replicas for a particular key simultaneously; it is like Parallel but waits for all replicas to complete.
func (*Replicator) Parallel ¶
func (r *Replicator) Parallel(key string, f ReplicatedFunc) error
Parallel replicates the given function to all replicas at once. It returns an error if all replicas fail, hence it is possible for some replicas not to receive data.
func (*Replicator) ParallelDigest ¶
func (r *Replicator) ParallelDigest(digest *pb.Digest, f ReplicatedFunc) error
ParallelDigest is like Parallel but takes a digest instead of the raw hash.
func (*Replicator) Sequential ¶
func (r *Replicator) Sequential(key string, f ReplicatedFunc) error
Sequential runs the function sequentially from the primary, attempting each replica in sequence until either one is successful or they all fail. It returns an error if all replicas fail, which is the error of the primary replica (with appropriate status code etc).
func (*Replicator) SequentialAck ¶
func (r *Replicator) SequentialAck(key string, f ReplicatedAckFunc) error
SequentialAck is like Sequential but allows the caller to specify whether the call should continue to the next replica even on a non-error response. This facilitates the BatchReadBlobs endpoint that basically never returns an 'actual' error because they're all inline.
func (*Replicator) SequentialDigest ¶
func (r *Replicator) SequentialDigest(digest *pb.Digest, f ReplicatedFunc) error
SequentialDigest is like Sequential but takes a digest instead of the raw hash.
type Server ¶
type Server struct { CAS pb.ContentAddressableStorageClient AC pb.ActionCacheClient BS bs.ByteStreamClient Exe pb.ExecutionClient Fetch apb.FetchClient GC ppb.GCClient Start string End string }
A Server holds several gRPC connections to the same server.
type Trie ¶
type Trie struct {
// contains filtered or unexported fields
}
A Trie provides fast lookups on hash keys.
func (*Trie) Add ¶
Add adds a node to this trie. It returns an error on any failure, including overlapping ranges.
func (*Trie) AddAll ¶
AddAll adds everything from the given map to this trie. It produces a mildly better memory layout than repeatedly calling Add.
func (*Trie) Check ¶
Check performs a check on this trie, validating that all ranges are accounted for.