Documentation ¶
Index ¶
- Constants
- func CleanupFakeWorkloadMap(maps bpf2go.KmeshCgroupSockWorkloadMaps)
- func LookupAll[K any, V any](bpfMap *ebpf.Map) []V
- func NewFakeWorkloadMap(t *testing.T) bpf2go.KmeshCgroupSockWorkloadMaps
- type BackendKey
- type BackendValue
- type Cache
- func (c *Cache) BackendCount() int
- func (c *Cache) BackendDelete(key *BackendKey) error
- func (c *Cache) BackendLookup(key *BackendKey, value *BackendValue) error
- func (c *Cache) BackendLookupAll() []BackendValue
- func (c *Cache) BackendUpdate(key *BackendKey, value *BackendValue) error
- func (c *Cache) EndpointCount() int
- func (c *Cache) EndpointDelete(key *EndpointKey) error
- func (c *Cache) EndpointLookup(key *EndpointKey, value *EndpointValue) error
- func (c *Cache) EndpointLookupAll() []EndpointValue
- func (c *Cache) EndpointSwap(currentIndex, lastIndex uint32, serviceId uint32) error
- func (c *Cache) EndpointUpdate(key *EndpointKey, value *EndpointValue) error
- func (c *Cache) FrontendCount() int
- func (c *Cache) FrontendDelete(key *FrontendKey) error
- func (c *Cache) FrontendIterFindKey(upstreamId uint32) []FrontendKey
- func (c *Cache) FrontendLookup(key *FrontendKey, value *FrontendValue) error
- func (c *Cache) FrontendLookupAll() []FrontendValue
- func (c *Cache) FrontendUpdate(key *FrontendKey, value *FrontendValue) error
- func (c *Cache) GetAllEndpointsForService(serviceId uint32) []EndpointValue
- func (c *Cache) GetEndpointKeys(workloadID uint32) sets.Set[EndpointKey]
- func (c *Cache) RestoreEndpointKeys()
- func (c *Cache) ServiceCount() int
- func (c *Cache) ServiceDelete(key *ServiceKey) error
- func (c *Cache) ServiceLookup(key *ServiceKey, value *ServiceValue) error
- func (c *Cache) ServiceLookupAll() []ServiceValue
- func (c *Cache) ServiceUpdate(key *ServiceKey, value *ServiceValue) error
- func (c *Cache) WorkloadPolicyDelete(key *WorkloadPolicyKey) error
- func (c *Cache) WorkloadPolicyLookup(key *WorkloadPolicyKey, value *WorkloadPolicyValue) error
- func (c *Cache) WorkloadPolicyLookupAll() []WorkloadPolicyValue
- func (c *Cache) WorkloadPolicyUpdate(key *WorkloadPolicyKey, value *WorkloadPolicyValue) error
- type EndpointKey
- type EndpointValue
- type FrontendKey
- type FrontendValue
- type ServiceKey
- type ServiceList
- type ServicePorts
- type ServiceValue
- type TargetPorts
- type WorkloadPolicyKey
- type WorkloadPolicyValue
Constants ¶
View Source
const (
MaxPortNum = 10
)
View Source
const (
MaxServiceNum = 10
)
Variables ¶
This section is empty.
Functions ¶
func CleanupFakeWorkloadMap ¶
func CleanupFakeWorkloadMap(maps bpf2go.KmeshCgroupSockWorkloadMaps)
func NewFakeWorkloadMap ¶
func NewFakeWorkloadMap(t *testing.T) bpf2go.KmeshCgroupSockWorkloadMaps
Types ¶
type BackendKey ¶
type BackendKey struct {
BackendUid uint32 // workloadUid to uint32
}
type BackendValue ¶
type BackendValue struct { Ip [16]byte ServiceCount uint32 Services ServiceList WaypointAddr [16]byte WaypointPort uint32 }
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
func NewCache ¶
func NewCache(workloadMap bpf2go.KmeshCgroupSockWorkloadMaps) *Cache
func (*Cache) BackendCount ¶
BackendCount returns the length of backend map Note only used for testing
func (*Cache) BackendDelete ¶
func (c *Cache) BackendDelete(key *BackendKey) error
func (*Cache) BackendLookup ¶
func (c *Cache) BackendLookup(key *BackendKey, value *BackendValue) error
func (*Cache) BackendLookupAll ¶
func (c *Cache) BackendLookupAll() []BackendValue
func (*Cache) BackendUpdate ¶
func (c *Cache) BackendUpdate(key *BackendKey, value *BackendValue) error
func (*Cache) EndpointCount ¶
EndpointCount returns the length of endpoint map Note only used for testing
func (*Cache) EndpointDelete ¶
func (c *Cache) EndpointDelete(key *EndpointKey) error
func (*Cache) EndpointLookup ¶
func (c *Cache) EndpointLookup(key *EndpointKey, value *EndpointValue) error
func (*Cache) EndpointLookupAll ¶
func (c *Cache) EndpointLookupAll() []EndpointValue
func (*Cache) EndpointSwap ¶
EndpointSwap update the last endpoint index and remove the current endpoint
func (*Cache) EndpointUpdate ¶
func (c *Cache) EndpointUpdate(key *EndpointKey, value *EndpointValue) error
func (*Cache) FrontendCount ¶
FrontendCount returns the length of frontend map Note only used for testing
func (*Cache) FrontendDelete ¶
func (c *Cache) FrontendDelete(key *FrontendKey) error
func (*Cache) FrontendIterFindKey ¶
func (c *Cache) FrontendIterFindKey(upstreamId uint32) []FrontendKey
func (*Cache) FrontendLookup ¶
func (c *Cache) FrontendLookup(key *FrontendKey, value *FrontendValue) error
func (*Cache) FrontendLookupAll ¶
func (c *Cache) FrontendLookupAll() []FrontendValue
func (*Cache) FrontendUpdate ¶
func (c *Cache) FrontendUpdate(key *FrontendKey, value *FrontendValue) error
func (*Cache) GetAllEndpointsForService ¶
func (c *Cache) GetAllEndpointsForService(serviceId uint32) []EndpointValue
GetAllEndpointsForService returns all the endpoints for a service Note only used for testing
func (*Cache) GetEndpointKeys ¶
func (c *Cache) GetEndpointKeys(workloadID uint32) sets.Set[EndpointKey]
func (*Cache) RestoreEndpointKeys ¶
func (c *Cache) RestoreEndpointKeys()
RestoreEndpointKeys called on restart to construct endpoint indexes from bpf map
func (*Cache) ServiceCount ¶
ServiceCount returns the length of service map Note only used for testing
func (*Cache) ServiceDelete ¶
func (c *Cache) ServiceDelete(key *ServiceKey) error
func (*Cache) ServiceLookup ¶
func (c *Cache) ServiceLookup(key *ServiceKey, value *ServiceValue) error
func (*Cache) ServiceLookupAll ¶
func (c *Cache) ServiceLookupAll() []ServiceValue
func (*Cache) ServiceUpdate ¶
func (c *Cache) ServiceUpdate(key *ServiceKey, value *ServiceValue) error
func (*Cache) WorkloadPolicyDelete ¶
func (c *Cache) WorkloadPolicyDelete(key *WorkloadPolicyKey) error
func (*Cache) WorkloadPolicyLookup ¶
func (c *Cache) WorkloadPolicyLookup(key *WorkloadPolicyKey, value *WorkloadPolicyValue) error
func (*Cache) WorkloadPolicyLookupAll ¶
func (c *Cache) WorkloadPolicyLookupAll() []WorkloadPolicyValue
func (*Cache) WorkloadPolicyUpdate ¶
func (c *Cache) WorkloadPolicyUpdate(key *WorkloadPolicyKey, value *WorkloadPolicyValue) error
type EndpointKey ¶
type EndpointValue ¶
type EndpointValue struct {
BackendUid uint32 // workloadUid to uint32
}
type FrontendKey ¶
type FrontendKey struct {
Ip [16]byte // Service ip or Pod ip
}
type FrontendValue ¶
type FrontendValue struct {
UpstreamId uint32 // service id for Service access or backend uid for Pod access
}
type ServiceKey ¶
type ServiceKey struct {
ServiceId uint32 // service id
}
type ServiceList ¶
type ServiceList [MaxServiceNum]uint32
type ServicePorts ¶
type ServicePorts [MaxPortNum]uint32
type ServiceValue ¶
type ServiceValue struct { EndpointCount uint32 // endpoint count of current service LbPolicy uint32 // load balancing algorithm, currently only supports random algorithm ServicePort ServicePorts // ServicePort[i] and TargetPort[i] are a pair, i starts from 0 and max value is MaxPortNum-1 TargetPort TargetPorts WaypointAddr [16]byte WaypointPort uint32 }
type TargetPorts ¶
type TargetPorts [MaxPortNum]uint32
type WorkloadPolicyKey ¶
type WorkloadPolicyKey struct {
WorklodId uint32 // workloadIp to uint32
}
type WorkloadPolicyValue ¶
type WorkloadPolicyValue struct {
PolicyIds [4]uint32 // name length is [MAX_MEMBER_NUM_PER_POLICY]
}
Click to show internal directories.
Click to hide internal directories.