forked from TrueCloudLab/frostfs-node
[#33] container: Define read-only storage interface
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
d52bdb27c5
commit
030375af63
1 changed files with 24 additions and 0 deletions
24
pkg/core/container/storage.go
Normal file
24
pkg/core/container/storage.go
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
package container
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
|
||||||
|
"github.com/nspcc-dev/neofs-api-go/pkg/container"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Source is an interface that wraps
|
||||||
|
// basic container receiving method.
|
||||||
|
type Source interface {
|
||||||
|
// Get reads the container from the storage by identifier.
|
||||||
|
// It returns the pointer to requested container and any error encountered.
|
||||||
|
//
|
||||||
|
// Get must return exactly one non-nil value.
|
||||||
|
// Get must return ErrNotFound if the container is not in storage.
|
||||||
|
//
|
||||||
|
// Implementations must not retain the container pointer and modify
|
||||||
|
// the container through it.
|
||||||
|
Get(*container.ID) (*container.Container, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ErrNotFound is the error returned when container was not found in storage.
|
||||||
|
var ErrNotFound = errors.New("container not found")
|
Loading…
Reference in a new issue