-
Notifications
You must be signed in to change notification settings - Fork 8
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
File descriptor flag support #4
File descriptor flag support #4
Conversation
index.js
Outdated
var blockSize = opts.blockSize || 1024*16 | ||
var codec = opts.codec || {encode: id, decode: id} | ||
var flags = opts.flags || 'a+' | ||
var cache = opts.cache || Cache(1024) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could also remove the cache fallback as there is one in the aligned-block-file
module
I'm currently experimenting with the flags. |
I wonder why we have to use truncate instead of just resetting the in the blocks file. https://github.com/flumedb/flumelog-offset/blame/master/frame/recoverable.js#L51-L65 That way it would read-only compatible and also restorable from there. |
The flag itself is really usable. But additionally I was trying to refresh an already opened file. That didn't work because of the truncate and the other process which was writing to the file. |
09f05dc
to
442a393
Compare
I slightly changed the args again to use the filename as first arg and the options as second. |
) | ||
module.exports = function (file, opts) { | ||
if (!opts) opts = {} | ||
if (typeof opts !== 'object') legacy(opts, arguments[2]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Damn, this is still wrong. Opts could be a codec.
no truncate: #4 (comment) That is quite a good idea... hmm, it may mean that |
thanks, merged into 3.1.0 |
Hmm. we still need to update the arg check in to make it completely backwards-compatible. #4 (comment)
Yes. I'm currently writing my own read-only version. I don't need all the caching in the block-file and reads are already optimized. We might need to modularize the module a bit. e.g.
|
I'll write views in a separate process to ensure uptime and reliabilty of the first process. |
Next time I should add a WIP annotation somewhere. 😄 |
The pull stream version also doesn't work of course because it can't restore if the last block gets written. So I'll use pub/sub on the master process. Skipping the truncate function would be nice if |
Not sure whether it would be simpler passing just a fourth arg 😄
The backwards compatibility is probably also not needed.
This pr
flags
paramcache
param