/
listener.go
37 lines (30 loc) · 1.3 KB
/
listener.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// SPDX-License-Identifier: Apache-2.0
// Copyright 2018 Authors of Cilium
package ipcache
import (
"net"
)
// CacheModification represents the type of operation performed upon IPCache.
type CacheModification string
const (
// Upsert represents Upsertion into IPCache.
Upsert CacheModification = "Upsert"
// Delete represents deletion of an entry in IPCache.
Delete CacheModification = "Delete"
)
// IPIdentityMappingListener represents a component that is interested in
// learning about IP to Identity mapping events.
type IPIdentityMappingListener interface {
// OnIPIdentityCacheChange will be called whenever there the state of the
// IPCache has changed. If an existing CIDR->ID mapping is updated, then
// oldID is not nil; otherwise it is nil.
// hostIP is the IP address of the location of the cidr.
// hostIP is optional and may only be non-nil for an Upsert modification.
// k8sMeta contains the Kubernetes pod namespace and name behind the IP
// and may be nil.
OnIPIdentityCacheChange(modType CacheModification, cidr net.IPNet, oldHostIP, newHostIP net.IP,
oldID *Identity, newID Identity, encryptKey uint8, k8sMeta *K8sMetadata)
// OnIPIdentityCacheGC will be called to sync other components which are
// reliant upon the IPIdentityCache with the IPIdentityCache.
OnIPIdentityCacheGC()
}