Documentation ¶
Index ¶
- Constants
- func HashFromMetadata(cl *xdspb2.Cluster) string
- func LoadFromMetadata(cl *xdspb2.Cluster, locality string) uint64
- func SetHashInMetadata(cl *xdspb2.Cluster, hash string)
- func SetLoadInMetadata(cl *xdspb2.Cluster, locality string, load uint64)
- func SetWeightInMetadata(us *edspb2.UpstreamEndpointStats, weight uint32)
- func TotalLoadFromMetadata(cl *xdspb2.Cluster) uint64
- func WeightFromMetadata(us *edspb2.UpstreamEndpointStats) uint32
- type Cluster
- func (c *Cluster) All() []string
- func (c *Cluster) Fetch(req *xdspb2.DiscoveryRequest) (*xdspb2.DiscoveryResponse, error)
- func (c *Cluster) Insert(ep *xdspb2.Cluster)
- func (c *Cluster) InsertWithoutVersionUpdate(ep *xdspb2.Cluster)
- func (c *Cluster) Retrieve(name string) (*xdspb2.Cluster, uint64)
- func (c *Cluster) SetHealth(req *healthpb2.EndpointHealthResponse) (*healthpb2.HealthCheckSpecifier, error)
- func (c *Cluster) SetLoad(req *loadpb2.LoadStatsRequest) (*loadpb2.LoadStatsResponse, error)
- func (c *Cluster) SetWeight(req *loadpb2.LoadStatsRequest) (*loadpb2.LoadStatsResponse, error)
- func (c *Cluster) Version() uint64
- type MarshaledResource
- type Response
Constants ¶
const ( WeightKind = "weight" // Key name in metadata where the weight is stored. LoadKind = "load" // Key name in the metadata where the load is stored. HashKind = "hash" // hash of the textpb cluster definition. )
Variables ¶
This section is empty.
Functions ¶
func HashFromMetadata ¶
HashFromMetada returns the hash from the metadata.
func LoadFromMetadata ¶
LoadFromMetada returns the load as reported in the metadata of the endpoint.
func SetHashInMetadata ¶
SetHashInMetadata set the hash in the metadata.
func SetLoadInMetadata ¶
SetLoadInMetadata adds load to the metadata of the LbEndpoint.
func SetWeightInMetadata ¶
func SetWeightInMetadata(us *edspb2.UpstreamEndpointStats, weight uint32)
func TotalLoadFromMetadata ¶
func WeightFromMetadata ¶
func WeightFromMetadata(us *edspb2.UpstreamEndpointStats) uint32
WeightFromMetadata returns the weight from the metadata in the load report. If there is none, 0 is returned.
Types ¶
type Cluster ¶
type Cluster struct {
// contains filtered or unexported fields
}
Clusters holds the current clusters. For each cluster we only keep the ClusterLoadAssignments, for ClusterType queries we will create a reply on-the-fly. We don't care about node-id's, but we do check the version of the incoming reply to see if we have a newer one.
func (*Cluster) Fetch ¶
func (c *Cluster) Fetch(req *xdspb2.DiscoveryRequest) (*xdspb2.DiscoveryResponse, error)
Fetch fetches cluster data from the cluster. Here we probably deviate from the spec, as empty versions are allowed and we will return the full list again. For versioning we use the highest version we see in the cache and use that as the version in the reply.
func (*Cluster) InsertWithoutVersionUpdate ¶
func (*Cluster) SetHealth ¶
func (c *Cluster) SetHealth(req *healthpb2.EndpointHealthResponse) (*healthpb2.HealthCheckSpecifier, error)
SetHealth sets the health for clusters and or endpoints.
func (*Cluster) SetLoad ¶
func (c *Cluster) SetLoad(req *loadpb2.LoadStatsRequest) (*loadpb2.LoadStatsResponse, error)
SetLoad sets the load for clusters and or endpoints.
func (*Cluster) SetWeight ¶
func (c *Cluster) SetWeight(req *loadpb2.LoadStatsRequest) (*loadpb2.LoadStatsResponse, error)
SetWeight sets the weight within cluster for endpoints.
type MarshaledResource ¶
type MarshaledResource = []byte
func MarshalResource ¶
func MarshalResource(resource proto.Message) (MarshaledResource, error)
MarshalResource converts the Resource to a MarshaledResource.
type Response ¶
type Response struct { *xdspb2.DiscoveryResponse // contains filtered or unexported fields }