hyperscalr

package module
v0.0.0-...-446cd28 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

README

hyperscalr.go

This client a work in progress. Watch the repository for what's coming soon.

License: Apache License 2.0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	// PushQueueMessage pushes the message to the queue and returns the updated
	// message or an error.
	//
	// The returned message may be different than the one provided, such that
	// the PushQueueMessage implementation may wish to override properties such
	// as UniqueId to satisfy the implementation.
	PushQueueMessage(ctx context.Context, msg protocol.QueueMessage, options ...PushQueueMessageOption) (protocol.QueueMessage, error)

	Drain() error
	Close() error
}

type NatsClient

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

func NewNatsClient

func NewNatsClient(url string, options ...NatsClientOption) (*NatsClient, error)

func (*NatsClient) Close

func (c *NatsClient) Close() error

func (*NatsClient) Drain

func (c *NatsClient) Drain() error

func (*NatsClient) JetStreamContext

func (c *NatsClient) JetStreamContext() nats.JetStreamContext

JetStreamContext returns the underlying jetstream context.

func (*NatsClient) NatsConn

func (c *NatsClient) NatsConn() *nats.Conn

NatsConn returns the underlying nats connection.

func (*NatsClient) PushQueueMessage

func (c *NatsClient) PushQueueMessage(
	ctx context.Context,
	msg protocol.QueueMessage,
	options ...PushQueueMessageOption,
) (protocol.QueueMessage, error)

Push will publish the message on the stream.

If UniqueId on the message is not set then a random new one will be created.

If there are multiple pipelines set, then the message will be pushed to all the pipelines. Pushing to pipelines is atomic on from the client, but not guaranteed by the hyperscalr plane. Hyperscalr will attempt to push to the configured pipelines optimistically. This is the same as if multiple calls by the client were made to multiple pipelines.

type NatsClientOption

type NatsClientOption func(*NatsClientOptions) error

NatsClientOption is a function on the options for a client.

func NatsClientOptionsWithJetstreamEnabled

func NatsClientOptionsWithJetstreamEnabled(enabled bool) NatsClientOption

func NatsClientOptionsWithNatsOptions

func NatsClientOptionsWithNatsOptions(options ...nats.Option) NatsClientOption

type NatsClientOptions

type NatsClientOptions struct {
	NatsOptions          []nats.Option
	NatsJetstreamEnabled bool
}

Options can be used to create a customized client.

func GetDefaultNatsClientOptions

func GetDefaultNatsClientOptions() NatsClientOptions

type PushQueueMessageOption

type PushQueueMessageOption func(*PushQueueMessageOptions) error

PushQueueMessageOption is a function on the options for a PushQueueMessage function.

func PushQueueMessageNatsSubject

func PushQueueMessageNatsSubject(subject string) PushQueueMessageOption

type PushQueueMessageOptions

type PushQueueMessageOptions struct {
	// NatsSubject that a client might use to publish a message.
	NatsSubject string
}

func GetDefaultPushQueueMessageOptions

func GetDefaultPushQueueMessageOptions() PushQueueMessageOptions

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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