storage

package
v0.0.0-...-86e4b03 Latest Latest
Warning

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

Go to latest
Published: May 15, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultEtcdLoggerName = "etcd-storage"

	DefaultEtcdMutexName = "pg"

	DefaultEtcdDictionaryName = "pg"

	DefaultEtcdDialTimeout      = 5000 * time.Millisecond
	DefaultEtcdOpTimeout        = 2000 * time.Millisecond
	DefaultEtcdKeepAliveTime    = 2000 * time.Millisecond
	DefaultEtcdKeepAliveTimeout = 1000 * time.Millisecond
)
View Source
const (
	DefaultStoaLoggerName = "stoa-storage"

	// DefaultStoaMutexName is the default name for the mutex locked by a master.
	DefaultStoaMutexName = "pg"

	// DefaultStoaDictionaryName is the default name for the dictionary used to
	// register clusters.
	DefaultStoaDictionaryName = "pg"
)
View Source
const (
	Stoa = "stoa"
	Etcd = "etcd"
)
View Source
const (
	DefaultType = Stoa
	DefaultTTL  = 5000 * time.Millisecond
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*options)

func WithBootstrap

func WithBootstrap(v string) Option

func WithTTL

func WithTTL(v time.Duration) Option

func WithType

func WithType(v string) Option

type Storage

type Storage interface {
	MutexTryLock(context.Context) (bool, error)

	MutexUnlock(context.Context) error

	DictionaryPut(ctx context.Context, k, v []byte) error

	DictionaryGet(ctx context.Context, k []byte) ([]byte, error)

	DictionaryRemove(ctx context.Context, k []byte) error
}

func New

func New(ctx context.Context, opts ...Option) (Storage, error)

Jump to

Keyboard shortcuts

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