go-ipld-format icon indicating copy to clipboard operation
go-ipld-format copied to clipboard

Feature Request: 'dag.Copy' function

Open whyrusleeping opened this issue 7 years ago • 5 comments

Similar to io.Copy, I want a dag.Copy (or ipld.Copy) function that transfers a given graph from a source dagservice to a target dagservice.

whyrusleeping avatar Aug 27 '18 23:08 whyrusleeping

hello @whyrusleeping , i am interested in this issue.Can u explain more clear about how ipld.Copy use?Thx

kjzz avatar Sep 04 '18 02:09 kjzz

Hey @kjzz, I'm imagining the function signature would look like:

func Copy(from, to DAGService, root *cid.Cid) error

And the function would just recursively load each object from the from dagservice, and write it to the to dagservice.

whyrusleeping avatar Sep 04 '18 18:09 whyrusleeping

Something a bit more idempotent might be nice.

func EnsureReplicated(root Cid, at DAGService, from ...DAGService)

?

warpfork avatar Sep 04 '18 18:09 warpfork

@warpfork I think the implementation could be smart, but Copy has better textual semantics (people more easily understand 'copy'). Though maybe theres a middle ground here?

whyrusleeping avatar Sep 05 '18 02:09 whyrusleeping

hey @whyrusleeping , i have open a pr about the featiure.Can you help me check it if my pr #41 meet the requirements?any question ,please ping me. Thx a lot.

kjzz avatar Sep 05 '18 04:09 kjzz