From 030375af63b0d742afc1587127e21c35a41ff4f4 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 21 Sep 2020 13:07:12 +0300 Subject: [PATCH] [#33] container: Define read-only storage interface Signed-off-by: Leonard Lyubich --- pkg/core/container/storage.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 pkg/core/container/storage.go diff --git a/pkg/core/container/storage.go b/pkg/core/container/storage.go new file mode 100644 index 000000000..e1c07ca2a --- /dev/null +++ b/pkg/core/container/storage.go @@ -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")