frostfs-api-go/signature/marshaller.go
Evgenii Stratonikov 4932274d34
Some checks failed
Tests and linters / Lint (pull_request) Failing after 24s
DCO action / DCO (pull_request) Successful in 39s
Tests and linters / Tests (1.19) (pull_request) Successful in 49s
Tests and linters / Tests (1.20) (pull_request) Successful in 50s
Tests and linters / Tests with -race (pull_request) Successful in 1m9s
[#77] protogen: Initial implementation
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2024-08-12 17:06:08 +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
}