diff --git a/object/transformer/fmt.go b/object/transformer/fmt.go index b0ca5c9b..31357d74 100644 --- a/object/transformer/fmt.go +++ b/object/transformer/fmt.go @@ -109,8 +109,9 @@ func (f *formatter) Close() (*AccessIdentifiers, error) { id, _ := f.obj.ID() - return new(AccessIdentifiers). - WithSelfID(id). - WithParentID(parID). - WithParent(parHdr), nil + return &AccessIdentifiers{ + ParentID: parID, + SelfID: id, + ParentHeader: parHdr, + }, nil } diff --git a/object/transformer/transformer.go b/object/transformer/transformer.go index cfd70980..d3b5b8df 100644 --- a/object/transformer/transformer.go +++ b/object/transformer/transformer.go @@ -200,11 +200,11 @@ func (s *payloadSizeLimiter) release(finalize bool) (*AccessIdentifiers, error) } // save identifier of the released object - s.previous = append(s.previous, ids.SelfID()) + s.previous = append(s.previous, ids.SelfID) if withParent { // generate and release linking object - s.initializeLinking(ids.Parent()) + s.initializeLinking(ids.ParentHeader) s.initializeCurrent() if _, err := s.release(false); err != nil { diff --git a/object/transformer/transformer_test.go b/object/transformer/transformer_test.go index fe35fe3c..8fcd6804 100644 --- a/object/transformer/transformer_test.go +++ b/object/transformer/transformer_test.go @@ -56,7 +56,7 @@ func TestTransformer(t *testing.T) { case 3: parID, ok := tt.objects[i].ParentID() require.True(t, ok) - require.Equal(t, ids.ParentID(), &parID) + require.Equal(t, ids.ParentID, &parID) } } require.Equal(t, expectedPayload, actualPayload) diff --git a/object/transformer/types.go b/object/transformer/types.go index 72e6a742..0525eb06 100644 --- a/object/transformer/types.go +++ b/object/transformer/types.go @@ -11,11 +11,9 @@ import ( // that are returned after writing the object. // Consists of the ID of the stored object and the ID of the parent object. type AccessIdentifiers struct { - par *oid.ID - - self oid.ID - - parHdr *object.Object + ParentID *oid.ID + SelfID oid.ID + ParentHeader *object.Object } // ObjectTarget is an interface of the object writer. @@ -50,62 +48,3 @@ type ObjectTarget interface { // TargetInitializer represents ObjectTarget constructor. type TargetInitializer func() ObjectTarget - -// SelfID returns identifier of the written object. -func (a AccessIdentifiers) SelfID() oid.ID { - return a.self -} - -// WithSelfID returns AccessIdentifiers with passed self identifier. -func (a *AccessIdentifiers) WithSelfID(v oid.ID) *AccessIdentifiers { - res := a - if res == nil { - res = new(AccessIdentifiers) - } - - res.self = v - - return res -} - -// ParentID return identifier of the parent of the written object. -func (a *AccessIdentifiers) ParentID() *oid.ID { - if a != nil { - return a.par - } - - return nil -} - -// WithParentID returns AccessIdentifiers with passed parent identifier. -func (a *AccessIdentifiers) WithParentID(v *oid.ID) *AccessIdentifiers { - res := a - if res == nil { - res = new(AccessIdentifiers) - } - - res.par = v - - return res -} - -// Parent return identifier of the parent of the written object. -func (a *AccessIdentifiers) Parent() *object.Object { - if a != nil { - return a.parHdr - } - - return nil -} - -// WithParent returns AccessIdentifiers with passed parent identifier. -func (a *AccessIdentifiers) WithParent(v *object.Object) *AccessIdentifiers { - res := a - if res == nil { - res = new(AccessIdentifiers) - } - - res.parHdr = v - - return res -}