25 lines
572 B
Go
25 lines
572 B
Go
|
package storage
|
||
|
|
||
|
import "errors"
|
||
|
|
||
|
var (
|
||
|
ErrNotExists = errors.New("not exists")
|
||
|
)
|
||
|
|
||
|
type Store interface {
|
||
|
// Checks if the storage has an element with the id.
|
||
|
// Returns [ErrNotExists] if the element doesn't exist.
|
||
|
Has(id string) error
|
||
|
|
||
|
// Retreive an element from the storage.
|
||
|
// Returns [ErrNotExists] if the element doesn't exist.
|
||
|
Get(id string) ([]byte, error)
|
||
|
|
||
|
// Store an element in the storage.
|
||
|
Put(id string, element []byte) error
|
||
|
|
||
|
// Delete an element from the storage.
|
||
|
// Returns [ErrNotExists] if the elment doesn't exist.
|
||
|
Delete(id string) error
|
||
|
}
|