cache

package
v0.0.0-...-e560ebb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 13, 2021 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

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
}

Environment is the runtime dependencies, e.g. networking, etc. of the implementation. The main goal of it is for unit test.

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.

func (*Frontend) AssignBackend

func (f *Frontend) AssignBackend(dutAddr, filename string) (string, error)

AssignBackend assigns a healthy backend to the request from `dutAddr` on `filename`. This function is concurrency safe.

type Subnet

type Subnet struct {
	IPNet    *net.IPNet
	Backends []string
}

Subnet is a network in labs (i.e. test VLAN). DUTs can only access caching backends in the same Subnet.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL