Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide way to update the CID prefix of DAG Objects #4171

Open
kevina opened this issue Aug 26, 2017 · 4 comments
Open

Provide way to update the CID prefix of DAG Objects #4171

kevina opened this issue Aug 26, 2017 · 4 comments

Comments

@kevina
Copy link
Contributor

kevina commented Aug 26, 2017

There should be a way rehash or update the CID prefix of a DAG Object, both within the files API and outside. Right now #4026 provides adds an update command to the files command which will update the prefix of the root object of directory objects. This will cause new objects to use the new prefix but existing objects will be left alone.

It would also be useful to recursively update the prefix.

Both operations (updating just the root and the entire DAG) will be useful within the files API and standalone. The most logical place for the standalone version will likely be within the dag sub-command.

The question is what to call it. Two possibilities come to mind update as in update the prefix or rehash as in recompute the hash. Since a recursive update can be very expensive (it might even retrieve objects from the network) I propose that recursion is disabled by default or separate commands be used to update just the root, vs a recursive update of the entire dag.

Thoughts?

@whyrusleeping
Copy link
Member

Thinking about this, its a pretty complicated thing. Doing this for files is almost entirely a separate operation than doing it on other DAGs.

ipfs files chcid, ipfs files rehash, ipfs files recid, ipfs files refmt?
I'm not sure i like rehash as you might not necessarily be changing the hash. And for files, maybe we want to give the user the ability to change its tree layout? (like switch from balanced dag to a trickledag).

It also probably makes sense to have a recursive option, update an entire graph in this way.

@kevina
Copy link
Contributor Author

kevina commented Aug 28, 2017

Of those I think i like ipfs files chcid the best, but I like the generality of ifs files update since we might also update something other than the cid like you suggested from a balanced dag to a trickledag.

@whyrusleeping
Copy link
Member

Yeah, i'm not entirely sold on update though, its unclear what you might be updating.

@kevina
Copy link
Contributor Author

kevina commented Aug 29, 2017

I am okay with chcid but that could be a bit misleading if the command is also used to update the tree layout.

I don't like recid or refmt. To me, be both commands imply some sort of change to the data-structure itself which may not be accurate in the non-recursive case.

However, I am okay with chcid being non-recursive and recid being the recursive version and refmt be used the change the internal structure, such as from a balanced dag to a trickledag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants