store

package
v1.15.22 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2024 License: MIT Imports: 12 Imported by: 9

Documentation

Index

Constants

View Source
const (
	// LockExtension - Extension added to the file name for lock.
	LockExtension = ".lock"

	// DefaultLockTimeout - lock timeout in milliseconds
	DefaultLockTimeout        = 10000 * time.Millisecond
	DefaultLockTimeoutLinux   = 30000 * time.Millisecond
	DefaultLockTimeoutWindows = 60000 * time.Millisecond
)

Variables

View Source
var (
	// Errors returned by KeyValueStore methods.
	ErrKeyNotFound                    = fmt.Errorf("key not found")
	ErrStoreLocked                    = fmt.Errorf("store is already locked")
	ErrStoreNotLocked                 = fmt.Errorf("store is not locked")
	ErrStoreEmpty                     = fmt.Errorf("store is empty")
	ErrTimeoutLockingStore            = fmt.Errorf("timed out locking store")
	ErrNonBlockingLockIsAlreadyLocked = fmt.Errorf("attempted to perform non-blocking lock on an already locked store")
)

Functions

This section is empty.

Types

type KeyValueStore

type KeyValueStore interface {
	Exists() bool
	Read(key string, value interface{}) error
	Write(key string, value interface{}) error
	Flush() error
	Lock(timeout time.Duration) error
	Unlock() error
	GetModificationTime() (time.Time, error)
	Remove()
}

KeyValueStore represents a persistent store of (key,value) pairs.

func NewJsonFileStore

func NewJsonFileStore(fileName string, lockclient processlock.Interface, logger *zap.Logger) (KeyValueStore, error)

NewJsonFileStore creates a new jsonFileStore object, accessed as a KeyValueStore.

func NewMockStore

func NewMockStore(lockFilePath string) KeyValueStore

NewMockStore creates a new jsonFileStore object, accessed as a KeyValueStore.

Jump to

Keyboard shortcuts

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