github.com/cilium/cilium@v1.16.2/pkg/k8s/resource/event.go (about)

     1  // SPDX-License-Identifier: Apache-2.0
     2  // Copyright Authors of Cilium
     3  
     4  package resource
     5  
     6  import (
     7  	k8sRuntime "k8s.io/apimachinery/pkg/runtime"
     8  )
     9  
    10  type EventKind string
    11  
    12  const (
    13  	Sync   EventKind = "sync"
    14  	Upsert EventKind = "upsert"
    15  	Delete EventKind = "delete"
    16  )
    17  
    18  // Event emitted from resource.
    19  type Event[T k8sRuntime.Object] struct {
    20  	Kind   EventKind
    21  	Key    Key
    22  	Object T
    23  
    24  	// Done marks the event as processed.  If err is non-nil, the
    25  	// key of the object is requeued and the processing retried at
    26  	// a later time with a potentially new version of the object.
    27  	//
    28  	// If this method is not called after the references to the event
    29  	// are gone, the finalizer will panic.
    30  	Done func(err error)
    31  }