Skip to content

Commit

Permalink
Merge pull request #55 from nspcc-dev/object-response-set-epoch
Browse files Browse the repository at this point in the history
Implement Epoch and Version setters on ResponseMetaHeader
  • Loading branch information
cthulhu-rider committed Feb 14, 2020
2 parents 9a98dff + a21e42e commit fb0c724
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
6 changes: 6 additions & 0 deletions service/meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ const (
ErrIncorrectTTL = internal.Error("incorrect ttl")
)

// 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 }

// SetVersion sets protocol version to RequestMetaHeader.
func (m *RequestMetaHeader) SetVersion(v uint32) { m.Version = v }

Expand Down
14 changes: 14 additions & 0 deletions service/meta_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,17 @@ func TestMetaRequest(t *testing.T) {
})
}
}

func TestRequestMetaHeader_SetEpoch(t *testing.T) {
m := new(ResponseMetaHeader)
epoch := uint64(3)
m.SetEpoch(epoch)
require.Equal(t, epoch, m.GetEpoch())
}

func TestRequestMetaHeader_SetVersion(t *testing.T) {
m := new(ResponseMetaHeader)
version := uint32(3)
m.SetVersion(version)
require.Equal(t, version, m.GetVersion())
}

0 comments on commit fb0c724

Please sign in to comment.