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 ¶
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 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) 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) 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).
type Server ¶
type Server struct { CAS pb.ContentAddressableStorageClient AC pb.ActionCacheClient BS bs.ByteStreamClient Rec rpb.RecorderClient Exe pb.ExecutionClient Fetch apb.FetchClient 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.