forked from TrueCloudLab/frostfs-api-go
Implementing proto.Clone
This commit is contained in:
parent
2456521240
commit
d45548c43b
11 changed files with 129 additions and 10 deletions
|
@ -3,6 +3,7 @@ package container
|
|||
import (
|
||||
"bytes"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"github.com/google/uuid"
|
||||
"github.com/nspcc-dev/neofs-api-go/internal"
|
||||
"github.com/nspcc-dev/neofs-api-go/refs"
|
||||
|
@ -63,6 +64,13 @@ func (m *Container) ID() (CID, error) {
|
|||
return refs.CIDForBytes(data), nil
|
||||
}
|
||||
|
||||
// Merge used by proto.Clone
|
||||
func (m *Container) Merge(src proto.Message) {
|
||||
if tmp, ok := src.(*Container); ok {
|
||||
*m = *tmp
|
||||
}
|
||||
}
|
||||
|
||||
// Empty checks that container is empty.
|
||||
func (m *Container) Empty() bool {
|
||||
return m.Capacity == 0 || bytes.Equal(m.Salt.Bytes(), emptySalt) || bytes.Equal(m.OwnerID.Bytes(), emptyOwner)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue