-
Notifications
You must be signed in to change notification settings - Fork 134
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
Add .unlink() and .history() #99
Conversation
…y archive.list to give only current entries
Question: should unlink() automatically delete from the disk if the archive's |
this would be amazing! |
From a dat-desktop point of view, it would make sense to also remove files from disk. In case you're the archive's owner, you only update the archive by working with the file system anyway. And in case you're not the owner, you want your local disk copy to resemble exactly what the current state of the archive is. I could however of course also do this manually, but it seems to me that it would make sense to at least have an option to automatically clean up local files. |
also +1 to renaming |
👍 for removing files. Think it could be confusing otherwise.
If we do end up pushing this breaking change, I'd love to change the |
Yeah, it would be then consistent with dropbox and git. (git rm also On Wed, Sep 14, 2016 at 4:01 PM, Joe Hand notifications@github.com wrote:
Karissa McKelvey Dat Data |
@pfrazee unlink should call unlink on the file object returned from the file constructor (if available) |
Ok, unlink() will be updated to remove the file, if storage is set. @juliangruber I appreciate the non-breaking change idea |
It is delaying the inevitable, my think was that if we ship this together with more breaking changes any breakage will be easier to debug, because chances are your call to But yeah, after more thought shipping a major now would work I guess. |
…vided to the archive
@juliangruber Yeah, this is really two PRs bundled into one. I would generally prefer to split the list/history bit into a prior PR, but I needed it, so hey. @mafintosh I'll need you to refer the most recent commit I made, to add the storage unlink calls. In particular:
|
|
That'd be ok with me, because that's what I've been doing in my code; all archives are opened in sparse mode and the metadata feed is then prioritized infinitely. |
I just noticed the |
what do we have left to get this merged? |
Update: @pfrazee and I talked about it on IRC but I'll mirror the gist of it here. There are a few edge cases with this we need to fix. I'm not sure this always works with sparse mode enabled right now and there are some edge cases if an unlink message if downloaded before the file it unlinks is. The fix is to always process metadata messages linearly (first process the 1st one, then the 2nd one, etc) until we are at the end of the metadata feed. In addition to that we need to make sparse mode always replicate metadata. |
@juliangruber would you be interested in pairing on o/ btw? |
@mafintosh absolutely! how u wanna do dis |
@juliangruber lets do a plan of a attack next week when we're both in cracow :D |
how's this going? looks like its diverged from master now :( |
Api similar to this landed in 8 |
This PR closes #76. The changes are described in the readme:
var rs = archive.history(opts={}, cb)
Returns a readable stream of the history of the entries in the archive.
opts.offset
- start streaming from this offset (default: 0)opts.live
- keep the stream open as new updates arrive (default: false)You can collect the results of the stream with
cb(err, entries)
.var rs = archive.list(opts={}, cb)
Returns a readable stream of all current entries in the archive.
opts.offset
- start streaming from this offset (default: 0)You can collect the results of the stream with
cb(err, entries)
.archive.unlink(entry, callback)
Remove an entry from the archive. Only possible if this is an live archive you originally created
or an unfinalized archive.
This will not affect the files on the disk, even if you set the file option in the archive constructor.