Documentation
¶
Index ¶
- func ResourceStatusHashGetter(res *api.Resource) (string, error)
- type Codec
- type SourceClient
- type SourceClientImpl
- func (s *SourceClientImpl) OnCreate(ctx context.Context, id string) error
- func (s *SourceClientImpl) OnDelete(ctx context.Context, id string) error
- func (s *SourceClientImpl) OnUpdate(ctx context.Context, id string) error
- func (s *SourceClientImpl) Resync(ctx context.Context, consumers []string) error
- func (s *SourceClientImpl) Subscribe(ctx context.Context, handlers ...cegeneric.ResourceHandler[*api.Resource])
- func (s *SourceClientImpl) SubscribedChan() <-chan struct{}
- type SourceClientMock
- func (s *SourceClientMock) OnCreate(ctx context.Context, id string) error
- func (s *SourceClientMock) OnDelete(ctx context.Context, id string) error
- func (s *SourceClientMock) OnUpdate(ctx context.Context, id string) error
- func (s *SourceClientMock) Resync(ctx context.Context, consumers []string) error
- func (s *SourceClientMock) Subscribe(ctx context.Context, handlers ...cegeneric.ResourceHandler[*api.Resource])
- func (s *SourceClientMock) SubscribedChan() <-chan struct{}
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ResourceStatusHashGetter ¶
ResourceStatusHashGetter returns a hash of the resource status. It calculates the hash based on the manifestwork status to ensure consistency with the agent's status calculation. The resource status is converted to manifestwork status based on resource type before calculating the hash.
Types ¶
type Codec ¶
type Codec struct {
// contains filtered or unexported fields
}
func (*Codec) Encode ¶
func (codec *Codec) Encode(source string, eventType cetypes.CloudEventsType, res *api.Resource) (*cloudevents.Event, error)
func (*Codec) EventDataType ¶
func (codec *Codec) EventDataType() cetypes.CloudEventsDataType
type SourceClient ¶
type SourceClient interface {
OnCreate(ctx context.Context, id string) error
OnUpdate(ctx context.Context, id string) error
OnDelete(ctx context.Context, id string) error
Subscribe(ctx context.Context, handlers ...cegeneric.ResourceHandler[*api.Resource])
Resync(ctx context.Context, consumers []string) error
SubscribedChan() <-chan struct{}
}
SourceClient is an interface for publishing resource events to consumers subscribing to and resyncing resource status from consumers.
func NewSourceClient ¶
func NewSourceClient(sourceOptions *ceoptions.CloudEventsSourceOptions, resourceService services.ResourceService) (SourceClient, error)
func NewSourceClientMock ¶
func NewSourceClientMock(resourceService services.ResourceService) SourceClient
type SourceClientImpl ¶
type SourceClientImpl struct {
Codec cegeneric.Codec[*api.Resource]
CloudEventSourceClient *ceclients.CloudEventSourceClient[*api.Resource]
ResourceService services.ResourceService
// contains filtered or unexported fields
}
func (*SourceClientImpl) OnCreate ¶
func (s *SourceClientImpl) OnCreate(ctx context.Context, id string) error
func (*SourceClientImpl) OnDelete ¶
func (s *SourceClientImpl) OnDelete(ctx context.Context, id string) error
func (*SourceClientImpl) OnUpdate ¶
func (s *SourceClientImpl) OnUpdate(ctx context.Context, id string) error
func (*SourceClientImpl) Resync ¶
func (s *SourceClientImpl) Resync(ctx context.Context, consumers []string) error
func (*SourceClientImpl) Subscribe ¶
func (s *SourceClientImpl) Subscribe(ctx context.Context, handlers ...cegeneric.ResourceHandler[*api.Resource])
func (*SourceClientImpl) SubscribedChan ¶
func (s *SourceClientImpl) SubscribedChan() <-chan struct{}
type SourceClientMock ¶
type SourceClientMock struct {
ResourceService services.ResourceService
// contains filtered or unexported fields
}
SourceClientMock is a mock implementation of the SourceClient interface
func (*SourceClientMock) OnCreate ¶
func (s *SourceClientMock) OnCreate(ctx context.Context, id string) error
func (*SourceClientMock) OnDelete ¶
func (s *SourceClientMock) OnDelete(ctx context.Context, id string) error
func (*SourceClientMock) OnUpdate ¶
func (s *SourceClientMock) OnUpdate(ctx context.Context, id string) error
func (*SourceClientMock) Resync ¶
func (s *SourceClientMock) Resync(ctx context.Context, consumers []string) error
func (*SourceClientMock) Subscribe ¶
func (s *SourceClientMock) Subscribe(ctx context.Context, handlers ...cegeneric.ResourceHandler[*api.Resource])
func (*SourceClientMock) SubscribedChan ¶
func (s *SourceClientMock) SubscribedChan() <-chan struct{}
Click to show internal directories.
Click to hide internal directories.