From 67bcf6eb4d2c1bae77d4534227465134467cd825 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 16 Nov 2020 11:42:19 +0300 Subject: [PATCH] [#197] sdk/object: Rename getters of Address type Signed-off-by: Leonard Lyubich --- pkg/client/object.go | 2 +- pkg/object/address.go | 12 ++++++------ pkg/object/address_test.go | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/pkg/client/object.go b/pkg/client/object.go index 4ce865f..11296e1 100644 --- a/pkg/client/object.go +++ b/pkg/client/object.go @@ -578,7 +578,7 @@ func (c *Client) getObjectHeaderV2(ctx context.Context, p *ObjectHeaderParams, o obj.SetHeader(hdr) raw := object.NewRawFromV2(obj) - raw.SetID(p.addr.GetObjectID()) + raw.SetID(p.addr.ObjectID()) // convert the object return raw.Object(), nil diff --git a/pkg/object/address.go b/pkg/object/address.go index 9f61c9f..7f2bfe7 100644 --- a/pkg/object/address.go +++ b/pkg/object/address.go @@ -37,8 +37,8 @@ func (a *Address) ToV2() *refs.Address { return (*refs.Address)(a) } -// GetContainerID returns container identifier. -func (a *Address) GetContainerID() *container.ID { +// ContainerID returns container identifier. +func (a *Address) ContainerID() *container.ID { return container.NewIDFromV2( (*refs.Address)(a).GetContainerID(), ) @@ -49,8 +49,8 @@ func (a *Address) SetContainerID(id *container.ID) { (*refs.Address)(a).SetContainerID(id.ToV2()) } -// GetObjectID returns object identifier. -func (a *Address) GetObjectID() *ID { +// ObjectID returns object identifier. +func (a *Address) ObjectID() *ID { return NewIDFromV2( (*refs.Address)(a).GetObjectID(), ) @@ -87,8 +87,8 @@ func (a *Address) Parse(s string) error { // String returns string representation of Object.Address. func (a *Address) String() string { return strings.Join([]string{ - a.GetContainerID().String(), - a.GetObjectID().String(), + a.ContainerID().String(), + a.ObjectID().String(), }, addressSeparator) } diff --git a/pkg/object/address_test.go b/pkg/object/address_test.go index aa67e58..d031670 100644 --- a/pkg/object/address_test.go +++ b/pkg/object/address_test.go @@ -16,7 +16,7 @@ func TestAddress_SetContainerID(t *testing.T) { a.SetContainerID(cid) - require.Equal(t, cid, a.GetContainerID()) + require.Equal(t, cid, a.ContainerID()) } func TestAddress_SetObjectID(t *testing.T) { @@ -26,7 +26,7 @@ func TestAddress_SetObjectID(t *testing.T) { a.SetObjectID(oid) - require.Equal(t, oid, a.GetObjectID()) + require.Equal(t, oid, a.ObjectID()) } func TestAddress_Parse(t *testing.T) { @@ -41,8 +41,8 @@ func TestAddress_Parse(t *testing.T) { a := NewAddress() require.NoError(t, a.Parse(s)) - require.Equal(t, oid, a.GetObjectID()) - require.Equal(t, cid, a.GetContainerID()) + require.Equal(t, oid, a.ObjectID()) + require.Equal(t, cid, a.ContainerID()) }) t.Run("should fail for bad address", func(t *testing.T) {