queue

package
v0.0.0-...-2d88f35 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message[T any] interface {
	Data() T
	Done(context.Context)
	Failed()
	IsExpired() bool
	SentTimestamp() *time.Time
}

Message represents a message from a queue.

type Observation

type Observation struct {
	Addr      []byte `json:"addr"`
	Hash      []byte `json:"hash"`
	Signature []byte `json:"signature"`
	TxHash    []byte `json:"txHash"`
	MessageID string `json:"messageId"`
}

Observation represents a signed observation.

type ObservationInMemory

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

VAAInMemory represents VAA queue in memory.

func NewObservationInMemory

func NewObservationInMemory(opts ...ObservationInMemoryOption) *ObservationInMemory

NewVAAInMemory creates a VAA queue in memory instances.

func (*ObservationInMemory) Consume

Consume returns the channel with the received messages.

func (*ObservationInMemory) Publish

Publish sends the message to a channel.

type ObservationInMemoryOption

type ObservationInMemoryOption func(*ObservationInMemory)

VAAInMemoryOption represents a VAA queue in memory option function.

func ObservationWithSize

func ObservationWithSize(v int) ObservationInMemoryOption

WithSize allows to specify an channel size when setting a value.

type ObservationSqs

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

ObservationSqs represents a observation queue in SQS.

func NewObservationSqs

func NewObservationSqs(producer *sqs.Producer, consumer *sqs.Consumer, logger *zap.Logger, opts ...VAASqsOption) *ObservationSqs

NewObservationSqs creates a observation queue in SQS instances.

func (*ObservationSqs) Close

func (q *ObservationSqs) Close()

Close closes all consumer resources.

func (*ObservationSqs) Consume

Consume returns the channel with the received messages from SQS queue.

func (*ObservationSqs) Publish

Publish sends the message to a SQS queue.

type VAAInMemory

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

VAAInMemory represents VAA queue in memory.

func NewVAAInMemory

func NewVAAInMemory(opts ...VAAInMemoryOption) *VAAInMemory

NewVAAInMemory creates a VAA queue in memory instances.

func (*VAAInMemory) Consume

func (i *VAAInMemory) Consume(_ context.Context) <-chan Message[[]byte]

Consume returns the channel with the received messages.

func (*VAAInMemory) Publish

func (i *VAAInMemory) Publish(_ context.Context, v *vaa.VAA, data []byte) error

Publish sends the message to a channel.

type VAAInMemoryOption

type VAAInMemoryOption func(*VAAInMemory)

VAAInMemoryOption represents a VAA queue in memory option function.

func WithSize

func WithSize(v int) VAAInMemoryOption

WithSize allows to specify an channel size when setting a value.

type VAASqs

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

VAASqs represents a VAA queue in VAASqs.

func NewVaaSqs

func NewVaaSqs(producer *sqs.Producer, consumer *sqs.Consumer, logger *zap.Logger, opts ...VAASqsOption) *VAASqs

NewVaaSqs creates a VAA queue in SQS instances.

func (*VAASqs) Close

func (q *VAASqs) Close()

Close closes all consumer resources.

func (*VAASqs) Consume

func (q *VAASqs) Consume(ctx context.Context) <-chan Message[[]byte]

Consume returns the channel with the received messages from SQS queue.

func (*VAASqs) Publish

func (q *VAASqs) Publish(ctx context.Context, v *sdk.VAA, data []byte) error

Publish sends the message to a SQS queue.

type VAASqsOption

type VAASqsOption func(*VAASqs)

VAASqsOption represents a VAA queue in SQS option function.

func WithChannelSize

func WithChannelSize(size int) VAASqsOption

WithChannelSize allows to specify an channel size when setting a value.

Jump to

Keyboard shortcuts

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