cloudevents

package
v0.0.0-...-3717fc6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 21, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResourceStatusHashGetter

func ResourceStatusHashGetter(res *api.Resource) (string, error)

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 NewCodec

func NewCodec(sourceID string) *Codec

func (*Codec) Decode

func (codec *Codec) Decode(evt *cloudevents.Event) (*api.Resource, error)

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{}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL