You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 26, 2023. It is now read-only.
With the logic of the flush/sync option of the MFS API discussed and clarified in #37 it seems that we either want to (when the user changes a file in the MFS) update all of the directories up to the root or do nothing (letting the final Close of the root to do the full update at the end to make sure nothing is lost) depending on whether the user of the API specifies the flush/sync option or not when opening a file.
At the moment, our alternative to an up-to-the-root update is not nothing but rather a kind of half-update that does just part of the job but doesn't guarantee to leave the MFS in sync at the end (we are still relying on the final Close). What the closeChild (now renamed updateChildEntry in #36) method does when called with the sync/flush options unset is to just call updateChild,
that is, it doesn't regenerate the final node representing the new state with the updated entry (and hence it also doesn't add it to the DAG service nor update its parent with the new version).
That by itself it would seem to serve no purpose and it's already taken care of in sync (called by the root's Close method),
So the proposed solution would be to remove the sync option in the closeChild interface effectively converting it into an up-to-the-root-sync/flush mechanism that it's either called in its entirety (one childCloser calls its parent and its parent calls its parent's parent and so on all the way up to the root) or not at all (depending if the file was open with the sync/flush option or not).
The text was updated successfully, but these errors were encountered:
/cc @Stebalien (the main question is: is it worth doing a flushUp without sync? If not, we can remove that flag which would greatly simplify the update mechanism)
That sounds fine but I didn't write the code so I really don't know any more than you in this case. However, make sure to update the file's inode when closing the file descriptor, even if we're not flushing.
With the logic of the flush/sync option of the MFS API discussed and clarified in #37 it seems that we either want to (when the user changes a file in the MFS) update all of the directories up to the root or do nothing (letting the final
Close
of the root to do the full update at the end to make sure nothing is lost) depending on whether the user of the API specifies the flush/sync option or not when opening a file.At the moment, our alternative to an up-to-the-root update is not nothing but rather a kind of half-update that does just part of the job but doesn't guarantee to leave the MFS in sync at the end (we are still relying on the final
Close
). What thecloseChild
(now renamedupdateChildEntry
in #36) method does when called with thesync
/flush
options unset is to just callupdateChild
,go-mfs/dir.go
Lines 124 to 127 in 2c1b835
which only updates the entry at the UnixFS layer in its internal (mutable) state,
go-mfs/dir.go
Lines 421 to 424 in 2c1b835
that is, it doesn't regenerate the final node representing the new state with the updated entry (and hence it also doesn't add it to the DAG service nor update its parent with the new version).
That by itself it would seem to serve no purpose and it's already taken care of in
sync
(called by the root'sClose
method),go-mfs/dir.go
Lines 432 to 443 in 2c1b835
So the proposed solution would be to remove the
sync
option in thecloseChild
interface effectively converting it into an up-to-the-root-sync/flush mechanism that it's either called in its entirety (onechildCloser
calls its parent and its parent calls its parent's parent and so on all the way up to the root) or not at all (depending if the file was open with thesync
/flush
option or not).The text was updated successfully, but these errors were encountered: