fix comments

This commit is contained in:
Leonard Lyubich 2020-05-08 12:45:16 +03:00
parent 2c2150b101
commit 15a55d54a2
2 changed files with 7 additions and 1 deletions

View file

@ -130,7 +130,7 @@ type LifetimeSource interface {
ExpirationEpochSource ExpirationEpochSource
} }
// LifetimeSource is an interface of the container of creation-expiration epoch pair. // LifetimeContainer is an interface of the container of creation-expiration epoch pair.
type LifetimeContainer interface { type LifetimeContainer interface {
CreationEpochContainer CreationEpochContainer
ExpirationEpochContainer ExpirationEpochContainer

View file

@ -14,6 +14,7 @@ const signedRequestDataSize = 0 +
var requestEndianness = binary.BigEndian var requestEndianness = binary.BigEndian
// NewParams creates a new CreateRequest message and returns CreateParamsContainer interface.
func NewParams() CreateParamsContainer { func NewParams() CreateParamsContainer {
return new(CreateRequest) return new(CreateRequest)
} }
@ -28,6 +29,7 @@ func (m *CreateRequest) SetOwnerID(id OwnerID) {
m.OwnerID = id m.OwnerID = id
} }
// SignedData returns payload bytes of the request.
func (m CreateRequest) SignedData() ([]byte, error) { func (m CreateRequest) SignedData() ([]byte, error) {
data := make([]byte, m.SignedDataSize()) data := make([]byte, m.SignedDataSize())
@ -39,10 +41,14 @@ func (m CreateRequest) SignedData() ([]byte, error) {
return data, nil return data, nil
} }
// SignedDataSize returns payload size of the request.
func (m CreateRequest) SignedDataSize() int { func (m CreateRequest) SignedDataSize() int {
return signedRequestDataSize return signedRequestDataSize
} }
// ReadSignedData copies payload bytes to passed buffer.
//
// If the buffer size is insufficient, io.ErrUnexpectedEOF returns.
func (m CreateRequest) ReadSignedData(p []byte) (int, error) { func (m CreateRequest) ReadSignedData(p []byte) (int, error) {
sz := m.SignedDataSize() sz := m.SignedDataSize()
if len(p) < sz { if len(p) < sz {