repository

package
v0.0.0-...-e163d20 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	NotifyPrefix = "configleam:notify"
)

Variables

View Source
var PubSubChannel = "channel"

Functions

This section is empty.

Types

type EtcdRepository

type EtcdRepository struct {
	*etcd.Etcd
	// contains filtered or unexported fields
}

func NewEtcdRepository

func NewEtcdRepository(etcd *etcd.Etcd) *EtcdRepository

func (*EtcdRepository) Publish

func (r *EtcdRepository) Publish(ctx context.Context, payload string) error

Publish updates the value of a key, triggering notifications to watchers.

func (*EtcdRepository) Subscribe

func (r *EtcdRepository) Subscribe(ctx context.Context, callback func(payload string))

Subscribe watches changes on a specific key or prefix.

func (*EtcdRepository) Unsubscribe

func (r *EtcdRepository) Unsubscribe()

Unsubscribe might be more complex in an etcd context; it may involve canceling the context passed to the watch.

type Keys

type Keys struct{}

func (Keys) GetNotifyChannel

func (k Keys) GetNotifyChannel() string

type PublishUpdateError

type PublishUpdateError struct{}

func (PublishUpdateError) Error

func (e PublishUpdateError) Error() string

type RedisRepository

type RedisRepository struct {
	*rds.Redis
	// contains filtered or unexported fields
}

func NewRedisRepository

func NewRedisRepository(redis *rds.Redis) *RedisRepository

func (*RedisRepository) Publish

func (r *RedisRepository) Publish(ctx context.Context, payload string) error

func (*RedisRepository) Subscribe

func (r *RedisRepository) Subscribe(ctx context.Context, callback func(payload string))

func (*RedisRepository) Unsubscribe

func (r *RedisRepository) Unsubscribe()

type Repository

type Repository interface {
	Publish(ctx context.Context, payload string) error
	Subscribe(ctx context.Context, callback func(string))
	Unsubscribe()
}

func New

type RepositoryConfig

type RepositoryConfig struct {
	RedisAddrs    string
	RedisUsername string
	RedisPassword string
	RedisTLS      bool

	EtcdAddrs    []string
	EtcdUsername string
	EtcdPassword string
	EtcdTLS      bool
}

Jump to

Keyboard shortcuts

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