github.com/decred/dcrlnd@v0.7.6/watchtower/wtwire/delete_session_reply.go (about) 1 package wtwire 2 3 import "io" 4 5 // DeleteSessionCode is an error code returned by a watchtower in response to a 6 // DeleteSession message. 7 type DeleteSessionCode = ErrorCode 8 9 const ( 10 // DeleteSessionCodeNotFound is returned when the watchtower does not 11 // know of the requested session. This may indicate an error on the 12 // client side, or that the tower had already deleted the session in a 13 // prior request that the client may not have received. 14 DeleteSessionCodeNotFound DeleteSessionCode = 80 15 ) 16 17 // DeleteSessionReply is a message sent in response to a client's DeleteSession 18 // request. The message indicates whether or not the deletion was a success or 19 // failure. 20 type DeleteSessionReply struct { 21 // Code will be non-zero if the watchtower was not able to delete the 22 // requested session. 23 Code DeleteSessionCode 24 } 25 26 // A compile time check to ensure DeleteSessionReply implements the 27 // wtwire.Message interface. 28 var _ Message = (*DeleteSessionReply)(nil) 29 30 // Decode deserializes a serialized DeleteSessionReply message stored in the 31 // passed io.Reader observing the specified protocol version. 32 // 33 // This is part of the wtwire.Message interface. 34 func (m *DeleteSessionReply) Decode(r io.Reader, pver uint32) error { 35 return ReadElements(r, 36 &m.Code, 37 ) 38 } 39 40 // Encode serializes the target DeleteSessionReply into the passed io.Writer 41 // observing the protocol version specified. 42 // 43 // This is part of the wtwire.Message interface. 44 func (m *DeleteSessionReply) Encode(w io.Writer, pver uint32) error { 45 return WriteElements(w, 46 m.Code, 47 ) 48 } 49 50 // MsgType returns the integer uniquely identifying this message type on the 51 // wire. 52 // 53 // This is part of the wtwire.Message interface. 54 func (m *DeleteSessionReply) MsgType() MessageType { 55 return MsgDeleteSessionReply 56 } 57 58 // MaxPayloadLength returns the maximum allowed payload size for a 59 // DeleteSessionReply complete message observing the specified protocol version. 60 // 61 // This is part of the wtwire.Message interface. 62 func (m *DeleteSessionReply) MaxPayloadLength(uint32) uint32 { 63 return 2 64 }