Files
mesh-delivery/modules/mesh-delivery-checker/internal/check/store.go
T

20 lines
787 B
Go

package check
import (
"context"
"errors"
)
// ErrConflict is what a KV answers when a Create finds the key or an Update finds another revision than the one given.
var ErrConflict = errors.New("the key exists or changed")
// KV is one of the checker's buckets: read, create and compare-and-set, each write answering the key's new revision. Only
// the checker's credential writes them (ADR 0444 clause 5, ADR 0484 clause 2).
type KV interface {
Get(ctx context.Context, key string) (value []byte, revision uint64, found bool, err error)
Create(ctx context.Context, key string, value []byte) (uint64, error)
Update(ctx context.Context, key string, value []byte, revision uint64) (uint64, error)
// Keys are every key of the bucket.
Keys(ctx context.Context) ([]string, error)
}