2019-11-18 16:22:08 +00:00
|
|
|
package service
|
|
|
|
|
|
|
|
type (
|
|
|
|
// MetaHeader contains meta information of request.
|
2019-11-19 16:03:42 +00:00
|
|
|
// It provides methods to get or set meta information meta header.
|
|
|
|
// Also contains methods to reset and restore meta header.
|
2019-11-21 12:13:07 +00:00
|
|
|
// Also contains methods to get or set request protocol version
|
2019-11-18 16:22:08 +00:00
|
|
|
MetaHeader interface {
|
2019-11-19 16:03:42 +00:00
|
|
|
ResetMeta() RequestMetaHeader
|
|
|
|
RestoreMeta(RequestMetaHeader)
|
2019-11-18 16:22:08 +00:00
|
|
|
|
2020-05-04 11:03:11 +00:00
|
|
|
TTLContainer
|
|
|
|
EpochContainer
|
|
|
|
VersionContainer
|
|
|
|
RawContainer
|
2020-04-28 12:39:09 +00:00
|
|
|
}
|
2019-11-18 16:22:08 +00:00
|
|
|
)
|
|
|
|
|
2020-02-14 09:14:19 +00:00
|
|
|
// SetVersion sets protocol version to ResponseMetaHeader.
|
|
|
|
func (m *ResponseMetaHeader) SetVersion(v uint32) { m.Version = v }
|
|
|
|
|
|
|
|
// SetEpoch sets Epoch to ResponseMetaHeader.
|
|
|
|
func (m *ResponseMetaHeader) SetEpoch(v uint64) { m.Epoch = v }
|
|
|
|
|
2019-11-21 12:20:49 +00:00
|
|
|
// SetVersion sets protocol version to RequestMetaHeader.
|
|
|
|
func (m *RequestMetaHeader) SetVersion(v uint32) { m.Version = v }
|
|
|
|
|
2019-11-19 16:03:42 +00:00
|
|
|
// SetEpoch sets Epoch to RequestMetaHeader.
|
2019-11-18 16:22:08 +00:00
|
|
|
func (m *RequestMetaHeader) SetEpoch(v uint64) { m.Epoch = v }
|
|
|
|
|
2020-04-28 12:39:09 +00:00
|
|
|
// SetRaw is a Raw field setter.
|
|
|
|
func (m *RequestMetaHeader) SetRaw(raw bool) {
|
|
|
|
m.Raw = raw
|
|
|
|
}
|
|
|
|
|
2019-11-19 16:03:42 +00:00
|
|
|
// ResetMeta returns current value and sets RequestMetaHeader to empty value.
|
|
|
|
func (m *RequestMetaHeader) ResetMeta() RequestMetaHeader {
|
|
|
|
cp := *m
|
|
|
|
m.Reset()
|
|
|
|
return cp
|
|
|
|
}
|
|
|
|
|
|
|
|
// RestoreMeta sets current RequestMetaHeader to passed value.
|
|
|
|
func (m *RequestMetaHeader) RestoreMeta(v RequestMetaHeader) { *m = v }
|