frostfs-api-go/signature/marshaller.go
Evgenii Stratonikov 5bae7bf6a9 protogen: Initial implementation
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2024-08-01 16:10:02 +03:00

30 lines
490 B
Go

package signature
type stableMarshaler interface {
StableMarshal([]byte) []byte
StableSize() int
}
type messageData interface {
MessageData() []byte
}
type StableMarshalerWrapper struct {
SM stableMarshaler
}
func (s StableMarshalerWrapper) ReadSignedData(buf []byte) ([]byte, error) {
if s.SM != nil {
return s.SM.StableMarshal(buf), nil
}
return nil, nil
}
func (s StableMarshalerWrapper) SignedDataSize() int {
if s.SM != nil {
return s.SM.StableSize()
}
return 0
}