summaryrefslogtreecommitdiffhomepage
path: root/storage/type.go
blob: b2d3136eafb89b5be38a08802c13696101c2993a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package storage

const (
	// Collision is a fatal collision error, only triggered when it fails
	Collision = Error("collision detected")
	// NotFound is a fatal error when the backend cannot find a key to read
	NotFound = Error("value not found")
	// Unhealthy is a fatal error when the backend ceases to be healthy
	Unhealthy = Error("backend unhealthy")
)

// Error is a sentinel error type for storage engines
type Error string

func (e Error) Error() string { return string(e) }

// CHR - Create, Health, Read
type CHR interface {
	Create(key, value string, checkcollision bool) error
	Healthy() bool
	Read(key string) (string, error)
}