channel

package
v1.22.4 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2025 License: Apache-2.0 Imports: 4 Imported by: 10

Documentation

Overview

Package channel provides various channel types used for event.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataChan

type DataChan struct {
	ID       string
	ClientID uuid.UUID
	Address  string
	Data     *cloudevents.Event
	Status   Status
	//Type defines type of data (Notification,Metric,Status)
	Type Type
	// OnReceiveFn  to do on OnReceive
	OnReceiveFn func(e cloudevents.Event)
	// OnReceiveOverrideFn Optional for event, but override for status pings.This is an override function on receiving msg by transport,
	// if not set then the data is sent to out channel and processed by side-car  default method
	OnReceiveOverrideFn func(e cloudevents.Event, dataChan *DataChan) error
	// ProcessEventFn  Optional, this allows to customize message handler thar was received at the out channel
	ProcessEventFn func(e interface{}) error
	// Only for status lost if marshalled to json
	StatusChan    chan<- *StatusChan
	ReturnAddress *string
}

DataChan ...

func (*DataChan) CreateCloudEvents added in v0.2.0

func (d *DataChan) CreateCloudEvents(dataType string) (*cloudevents.Event, error)

CreateCloudEvents ...

type ListenerChannel

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

ListenerChannel ...

func NewStatusListenerChannel

func NewStatusListenerChannel(wg *sync.WaitGroup) *ListenerChannel

NewStatusListenerChannel ...

func (*ListenerChannel) Done

func (s *ListenerChannel) Done()

Done ...

func (*ListenerChannel) GetChannel

func (s *ListenerChannel) GetChannel(sequenceID int) chan<- cloudevents.Event

GetChannel ...

func (*ListenerChannel) Listen

func (s *ListenerChannel) Listen(wg *sync.WaitGroup)

Listen ... put in the map; so the you receiver will read the map and sequence id is found then send to channel found in the map

func (*ListenerChannel) SendToCaller

func (s *ListenerChannel) SendToCaller(sequenceID int, dataCh cloudevents.Event)

SendToCaller ... TODO:Clean up store on errors SendToCaller ...

func (*ListenerChannel) SendToListener

func (s *ListenerChannel) SendToListener(fromRest RestAPIChannel)

SendToListener ...

func (*ListenerChannel) SetChannel

func (s *ListenerChannel) SetChannel(seq int, dataCh chan<- cloudevents.Event)

SetChannel ...

type RestAPIChannel

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

RestAPIChannel ...

func NewStatusRestAPIChannel

func NewStatusRestAPIChannel(seqID int, dataCh chan<- cloudevents.Event) RestAPIChannel

NewStatusRestAPIChannel ...

type Status

type Status int

Status specifies status of the event

const (
	//NEW if the event is new for the consumer
	NEW Status = iota
	// SUCCESS if the event is posted successfully
	SUCCESS
	//DELETE if the event is to delete
	DELETE
	//FAILED if the event  failed to post
	FAILED
)

func (Status) String

func (s Status) String() string

String represent of status enum

type StatusChan added in v0.2.0

type StatusChan struct {
	ID         string
	ClientID   uuid.UUID
	Data       *cloudevents.Event
	Message    []byte
	StatusCode int
}

StatusChan channel used for writing status data out here

type Type

type Type int

Type ... specifies type of the event

const (
	// SUBSCRIBER  the type to create listener
	SUBSCRIBER Type = iota
	//PUBLISHER  the  type is to create sender
	PUBLISHER
	//EVENT  the type is an event
	EVENT
	//STATUS  the type is an STATUS CHECK
	STATUS
)

func (Type) String

func (t Type) String() string

String represent of Type enum

Jump to

Keyboard shortcuts

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