Documentation
¶
Overview ¶
Copyright 2023 The Chromium Authors Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Environment ¶
type Environment interface { // Subnets returns the caching subnets. // The slice returned may be shared, so do not modify it. // This function is concurrency safe. Subnets() []Subnet // CacheZones returns the caching zones. // A caching zone is a series of caching services serving a UFS zone. // The map returned may be shared, so do not modify it. // This function is concurrency safe. CacheZones() map[ufsmodels.Zone][]CachingService // GetZoneForServer returns UFS zone for the given server name. GetZoneForServer(name string) (ufsmodels.Zone, error) // GetZoneForDUT returns UFS zone for the given DUT name. GetZoneForDUT(name string) (ufsmodels.Zone, error) }
Environment is the runtime dependencies, e.g. networking, etc. of the implementation. The main goal of it is for unit test.
func NewEnv ¶
func NewEnv(preferredCachingServices string, ufsClient ufsapi.FleetClient) (Environment, error)
NewEnv creates new instance of Environment according to inputs.
func NewPreferredEnv ¶
func NewPreferredEnv(services string) (Environment, error)
NewPreferredEnv creates a new preferred caching service environment. In this environment, we skip further server selection based on either UFS zone or subnets.
func NewUFSEnv ¶
func NewUFSEnv(c ufsapi.FleetClient) (Environment, error)
NewUFSEnv creates an instance of Environment for caching services registered in UFS. It caches the result to prevent frequent access to UFS. It updates the cache regularly.
type Frontend ¶
type Frontend struct {
// contains filtered or unexported fields
}
Frontend manages caching backends and assigns backends for client requests.
func NewFrontend ¶
func NewFrontend(env Environment) *Frontend
NewFrontend creates a new cache frontend.