[#194] pkg/container: Implement container constructor with format check

Implement NewVerifiedFromV2 function that verifies format of NeoFS API V2
Container message.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2020-12-24 12:28:33 +03:00 committed by Leonard Lyubich
parent 70c29ca3e5
commit 7988405753
3 changed files with 80 additions and 0 deletions

View file

@ -42,6 +42,10 @@ func (c *Container) ToV2() *container.Container {
return &c.v2
}
// NewVerifiedFromV2 constructs Container from NeoFS API V2 Container message.
//
// Does not perform if message meets NeoFS API V2 specification. To do this
// use NewVerifiedFromV2 constructor.
func NewContainerFromV2(c *container.Container) *Container {
cnr := new(Container)