cloudevents

package
v0.0.0-...-832932f Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: Apache-2.0 Imports: 18 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)

Types

type BundleCodec

type BundleCodec struct {
	// contains filtered or unexported fields
}

func (*BundleCodec) Decode

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

func (*BundleCodec) Encode

func (codec *BundleCodec) Encode(source string, eventType cetypes.CloudEventsType, res *api.Resource) (*cloudevents.Event, error)

func (*BundleCodec) EventDataType

func (codec *BundleCodec) EventDataType() cetypes.CloudEventsDataType

type Codec

type Codec struct {
	// contains filtered or unexported fields
}

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
	ReconnectedChan() <-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]
	BundleCodec            cegeneric.Codec[*api.Resource]
	CloudEventSourceClient *cegeneric.CloudEventSourceClient[*api.Resource]
	ResourceService        services.ResourceService
}

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) ReconnectedChan

func (s *SourceClientImpl) ReconnectedChan() <-chan struct{}

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])

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) ReconnectedChan

func (s *SourceClientMock) ReconnectedChan() <-chan struct{}

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])

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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