forked from TrueCloudLab/frostfs-api-go
Alex Vanin
f69d2ad83c
Due to source code relocation from GitHub. Signed-off-by: Alex Vanin <a.vanin@yadro.com>
41 lines
893 B
Go
41 lines
893 B
Go
package tombstone
|
|
|
|
import (
|
|
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs"
|
|
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/grpc"
|
|
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message"
|
|
tombstone "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/tombstone/grpc"
|
|
)
|
|
|
|
func (s *Tombstone) ToGRPCMessage() grpc.Message {
|
|
var m *tombstone.Tombstone
|
|
|
|
if s != nil {
|
|
m = new(tombstone.Tombstone)
|
|
|
|
m.SetMembers(refs.ObjectIDListToGRPCMessage(s.members))
|
|
m.SetExpirationEpoch(s.exp)
|
|
m.SetSplitId(s.splitID)
|
|
}
|
|
|
|
return m
|
|
}
|
|
|
|
func (s *Tombstone) FromGRPCMessage(m grpc.Message) error {
|
|
v, ok := m.(*tombstone.Tombstone)
|
|
if !ok {
|
|
return message.NewUnexpectedMessageType(m, v)
|
|
}
|
|
|
|
var err error
|
|
|
|
s.members, err = refs.ObjectIDListFromGRPCMessage(v.GetMembers())
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
s.exp = v.GetExpirationEpoch()
|
|
s.splitID = v.GetSplitId()
|
|
|
|
return nil
|
|
}
|