storage

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PrefixKey = "__host"
)

Variables

This section is empty.

Functions

func WithConsumeOptionsBindingExchangeName

func WithConsumeOptionsBindingExchangeName(name string) func(*ConsumeOptions)

WithConsumeOptionsBindingExchangeName returns a function that sets the exchange name the queue will be bound to

func WithConsumeOptionsBindingExchangeType

func WithConsumeOptionsBindingExchangeType(kind string) func(*ConsumeOptions)

WithConsumeOptionsBindingExchangeType returns a function that sets the binding exchange kind/type

func WithConsumeOptionsBindingRoutingKeys

func WithConsumeOptionsBindingRoutingKeys(keys []string) func(*ConsumeOptions)

WithConsumeOptionsBindingRoutingKeys returns a function that sets the exchange name the RoutingKeys will be bound to

func WithConsumeOptionsConcurrency

func WithConsumeOptionsConcurrency(concurrency int) func(*ConsumeOptions)

WithConsumeOptionsConcurrency returns a function that sets the concurrency, which means that many goroutines will be spawned to run the provided handler on messages

func WithConsumeOptionsConsumerAutoAck

func WithConsumeOptionsConsumerAutoAck(autoAck bool) func(*ConsumeOptions)

WithConsumeOptionsConsumerAutoAck returns a function that sets the auto acknowledge property on the server of this consumer if unset the default will be used (false)

func WithConsumeOptionsConsumerName

func WithConsumeOptionsConsumerName(consumerName string) func(*ConsumeOptions)

WithConsumeOptionsConsumerName returns a function that sets the name on the server of this consumer if unset a random name will be given

func WithConsumeOptionsQOSPrefetch

func WithConsumeOptionsQOSPrefetch(prefetchCount int) func(*ConsumeOptions)

WithConsumeOptionsQOSPrefetch returns a function that sets the prefetch count, which means that many messages will be fetched from the server in advance to help with throughput. This doesn't affect the handler, messages are still processed one at a time.

func WithPublishOptionsAppID

func WithPublishOptionsAppID(appID string) func(*PublishOptions)

WithPublishOptionsAppID returns a function that sets the application id

func WithPublishOptionsContentType

func WithPublishOptionsContentType(contentType string) func(*PublishOptions)

WithPublishOptionsContentType returns a function that sets the content type, i.e. "application/json"

func WithPublishOptionsExchange

func WithPublishOptionsExchange(exchange string) func(*PublishOptions)

WithPublishOptionsExchange returns a function that sets the exchange to publish to

func WithPublishOptionsMessageID

func WithPublishOptionsMessageID(messageID string) func(*PublishOptions)

WithPublishOptionsMessageID returns a function that sets the message identifier

func WithPublishOptionsReplyTo

func WithPublishOptionsReplyTo(replyTo string) func(*PublishOptions)

WithPublishOptionsReplyTo returns a function that sets the reply to field

func WithPublishOptionsUserID

func WithPublishOptionsUserID(userID string) func(*PublishOptions)

WithPublishOptionsUserID returns a function that sets the user id i.e. "user"

Types

type AdapterCache

type AdapterCache interface {
	String() string
	Get(ctx context.Context, key string) (*gvar.Var, error)
	Set(ctx context.Context, key string, val interface{}, expire int) error
	Del(ctx context.Context, key string) error
	HashGet(ctx context.Context, hk, key string) (*gvar.Var, error)
	HashDel(ctx context.Context, hk, key string) error
	Increase(ctx context.Context, key string) error
	Decrease(ctx context.Context, key string) error
	Expire(ctx context.Context, key string, dur time.Duration) error
}

type AdapterLocker

type AdapterLocker interface {
	String() string
	Lock(key string, ttl int64, options ...redislock.Option) (*redislock.Mutex, error)
}

type AdapterQueue

type AdapterQueue interface {
	String() string
	Publish(ctx context.Context, message Messager, optionFuncs ...func(*PublishOptions)) error
	Consumer(ctx context.Context, name string, f ConsumerFunc, optionFuncs ...func(*ConsumeOptions))
	Run(ctx context.Context)
	Shutdown(ctx context.Context)
}

type BindingExchangeOptions

type BindingExchangeOptions struct {
	Name string
	Kind string
}

BindingExchangeOptions are used when binding to an exchange. it will verify the exchange is created before binding to it.

type ConsumeOptions

type ConsumeOptions struct {
	BindingRoutingKeys []string
	BindingExchange    *BindingExchangeOptions
	Concurrency        int
	QOSPrefetch        int
	ConsumerName       string
	ConsumerAutoAck    bool
}

ConsumeOptions are used to describe how a new consumer will be created.

func GetDefaultConsumeOptions

func GetDefaultConsumeOptions() ConsumeOptions

GetDefaultConsumeOptions descibes the options that will be used when a value isn't provided

type ConsumerFunc

type ConsumerFunc func(ctx context.Context, msg Messager) error

type Messager

type Messager interface {
	SetId(string)
	GetId() string
	SetRoutingKey(string)
	GetRoutingKey() string
	SetValues(map[string]interface{})
	GetValues() map[string]interface{}
	GetPrefix() string
	SetPrefix(string)
	SetErrorIncr()
	SetErrorCount(uint64)
	GetErrorCount() uint64
}

type PublishOptions

type PublishOptions struct {
	Exchange string
	// MIME content type
	ContentType string
	// address to to reply to (ex: RPC)
	ReplyTo string
	// message identifier
	MessageID string
	// creating user id - ex: "guest"
	UserID string
	// creating application id
	AppID string
}

PublishOptions are used to control how data is published

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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