Documentation
¶
Overview ¶
Package keelpersistence provides backend-agnostic persistence contracts shared by the keel storage integrations: the sentinel errors ErrNotFound and ErrDirtyWrite, and the DistributedRWLock interface.
Concrete implementations live in separate modules, such as github.com/foomo/keel/persistence/mongo and github.com/foomo/keel/persistence/postgres.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNotFound is returned when a requested entity does not exist. ErrNotFound = errors.New("not found error") // ErrDirtyWrite is returned when an optimistic, version-checked write // fails because the stored entity was modified concurrently. ErrDirtyWrite = errors.New("dirty write error") )
Functions ¶
This section is empty.
Types ¶
type DistributedRWLock ¶ added in v0.30.0
type DistributedRWLock interface {
AcquireExclusive(ctx context.Context, lockID string) (bool, error)
Release(ctx context.Context, lockID string) error
}
DistributedRWLock coordinates shared and exclusive holders of a single cluster-wide resource. Any number of shared holders may hold the lock concurrently, while an exclusive holder excludes all others.
AcquireShared and AcquireExclusive return (true, nil) on success and (false, nil) when blocked by the other side; a non-nil error indicates a backend failure. Release frees the lock held under lockID.
See github.com/foomo/keel/persistence/mongo for a MongoDB implementation.