storage

package
v0.3.9 Latest Latest
Warning

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

Go to latest
Published: May 29, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PrefixKey = "__host"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AdapterCache

type AdapterCache interface {
	Name() string
	String() string
	Initialize(*gorm.DB) error
	RemoveFromTag(ctx context.Context, tag string) error
	Get(ctx context.Context, key string) (string, error)
	Set(ctx context.Context, key string, val interface{}, expire time.Duration) error
	Del(ctx context.Context, key string) error
	HashGet(ctx context.Context, hk, key string) (string, 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(ctx context.Context, key string, ttl time.Duration, options *redislock.Options) (*redislock.Lock, error)
}

type AdapterQueue

type AdapterQueue interface {
	String() string
	Append(opts ...Option) error
	Register(opts ...Option)
	Run(context.Context)
	Shutdown()
}

type ConsumerFunc

type ConsumerFunc func(Messager) error

type Messager

type Messager interface {
	SetID(string)
	SetStream(string)
	SetValues(map[string]interface{})
	GetID() string
	GetStream() string
	GetValues() map[string]interface{}
	GetPrefix() string
	SetPrefix(string)
	SetErrorCount(count int)
	GetErrorCount() int
	SetContext(ctx context.Context)
	GetContext() context.Context
}

type Option added in v0.3.2

type Option func(*Options)

func WithConsumerFunc added in v0.3.2

func WithConsumerFunc(f ConsumerFunc) Option

func WithGroupID added in v0.3.2

func WithGroupID(groupID string) Option

func WithKafkaConfig added in v0.3.2

func WithKafkaConfig(c *sarama.Config) Option

func WithMessage added in v0.3.2

func WithMessage(message Messager) Option

func WithPartition added in v0.3.2

func WithPartition(partition int) Option

func WithStrategy added in v0.3.2

func WithStrategy(f sarama.BalanceStrategy) Option

func WithTopic added in v0.3.2

func WithTopic(topic string) Option

type Options added in v0.3.2

type Options struct {
	Topic                       string
	GroupID                     string
	F                           ConsumerFunc
	Message                     Messager
	Partition                   int
	PartitionAssignmentStrategy sarama.BalanceStrategy
	KafkaConfig                 *sarama.Config
}

func DefaultOptions added in v0.3.2

func DefaultOptions() *Options

func SetOptions added in v0.3.2

func SetOptions(opts ...Option) *Options

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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