Skip to content
This repository has been archived by the owner on Dec 27, 2024. It is now read-only.

Add CopyTo method #432

Open
smallhive opened this issue Sep 7, 2023 · 0 comments
Open

Add CopyTo method #432

smallhive opened this issue Sep 7, 2023 · 0 comments
Labels
enhancement Improving existing functionality I2 Regular impact S3 Minimally significant U4 Nothing urgent

Comments

@smallhive
Copy link

smallhive commented Sep 7, 2023

Is your feature request related to a problem? Please describe.

In SDK we have task to add CopyTo method for some structures. The method makes a deep copy of the structure.

SDK wraps many api-go structures inside it and modifies them directly. Sometimes we have such situation

// "github.com/nspcc-dev/neofs-api-go/v2/container"
type Container struct {
	v2 container.Container
}

or even such one

// "github.com/nspcc-dev/neofs-api-go/v2/object"
type Object object.Object

Object type is just a synonym for api-go type, but has a lot of methods. Making a deep copy of this type is possible. Although having such CopyTo method in the original api-go type would be very helpful.

Fortunately for this type all internal fields are available via getters/setters and making CopyTo in SDK is just a question of time.

Describe the solution you'd like

Implement CopyTo method directly in api-go repo. Right now in SDK implemented deep copy for the next strcutures:

github.com/nspcc-dev/neofs-api-go/v2/refs

  • refs.ObjectID
  • refs.Signature
  • refs.ContainerID
  • refs.Checksum

github.com/nspcc-dev/neofs-api-go/v2/session

  • session.Token

github.com/nspcc-dev/neofs-api-go/v2/object

  • object.SplitHeader
  • object.Header

github.com/nspcc-dev/neofs-api-go/v2/netmap

  • netmap.Filter
  • netmap.Selector
  • netmap.Replica

Additional context

SDK doesn't mind to share/give/move existing code from it to neo-go repo

@smallhive smallhive added the enhancement Improving existing functionality label Sep 7, 2023
@roman-khimov roman-khimov added U4 Nothing urgent S3 Minimally significant I2 Regular impact labels Dec 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Improving existing functionality I2 Regular impact S3 Minimally significant U4 Nothing urgent
Projects
None yet
Development

No branches or pull requests

2 participants