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

MFS Republisher #5092

Closed
schomatis opened this issue Jun 7, 2018 · 6 comments
Closed

MFS Republisher #5092

schomatis opened this issue Jun 7, 2018 · 6 comments
Assignees
Labels
topic/docs-ipfs Topic docs-ipfs topic/files Topic files

Comments

@schomatis
Copy link
Contributor

schomatis commented Jun 7, 2018

I'm opening this issue to learn more about the republishing system on the MFS (which I currently understand nothing about).

I'm preemptively tagging @Stebalien to see if he can help me with some basic pointers about its main design goals, I'm assuming this system allows to recreate a different set of nodes that would represent any modifications to a file in the MFS.

@schomatis schomatis added topic/docs-ipfs Topic docs-ipfs topic/files Topic files labels Jun 7, 2018
@schomatis schomatis added this to the Files API Documentation milestone Jun 7, 2018
@schomatis schomatis self-assigned this Jun 7, 2018
@schomatis
Copy link
Contributor Author

I'm especially interested in understanding what is going on in this function,

https://github.com/ipfs/go-ipfs/blob/7853e53860805e08a212d78c4baa5d59bff99ba8/mfs/system.go#L257-L291

@schomatis
Copy link
Contributor Author

The core publish function is over here,

https://github.com/ipfs/go-ipfs/blob/7853e53860805e08a212d78c4baa5d59bff99ba8/core/core.go#L735-L738

It's not trivial to find and it seems very important in order to understand what is the publisher doing because there are many mentions of the publish verb but I'm not seeing any definition of exactly what does publish mean in this context.

@schomatis
Copy link
Contributor Author

/cc @Stebalien

1 similar comment
@schomatis
Copy link
Contributor Author

/cc @Stebalien

@Stebalien
Copy link
Member

I'm especially interested in understanding what is going on in this function,

That function is calling "pubfunc" whenever the hash at the MFS root changes. Currently, I believe we only use this to persist to disk. However, IIRC, we plan on using this to publish to IPNS (eventually).

The complexity comes from the fact that publishing an IPNS record is slow so we need to batch updates. Algorithm:

  1. When we receive the first update after publishing, we set a "long" timeout.
  2. When we receive any update, we reset the short timeout.
  3. If either the short timeout or the long timeout elapses, we call publish(latestHash).

These long timeout ensures that we delay publishing by at most TimeoutLong. The short timeout allows us to publish sooner if it looks like there are no more updates coming down the pipe.


The core publish function is over here,

Publish is fully pluggable. That republisher records the MFS root to disk. We also have some cases where we don't publish anything (e.g., when using a temporary MFS for adding/modifying directory trees).

schomatis added a commit to ipfs/go-mfs that referenced this issue Dec 17, 2018
Document the `Republisher` code in `repub.go` according to the explanation in
ipfs/kubo#5092 (comment). Erring on
the side of verbosity since this has been a part of the code with very little
review up until now.
@schomatis
Copy link
Contributor Author

Documented in ipfs/go-mfs#36.

schomatis added a commit to ipfs/go-mfs that referenced this issue Dec 17, 2018
Document the `Republisher` code in `repub.go` according to the explanation in
ipfs/kubo#5092 (comment). Erring on
the side of verbosity since this has been a part of the code with very little
review up until now.
schomatis added a commit to ipfs/go-mfs that referenced this issue Dec 19, 2018
Document the `Republisher` code in `repub.go` according to the explanation in
ipfs/kubo#5092 (comment). Erring on
the side of verbosity since this has been a part of the code with very little
review up until now.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic/docs-ipfs Topic docs-ipfs topic/files Topic files
Projects
None yet
Development

No branches or pull requests

2 participants