-
Notifications
You must be signed in to change notification settings - Fork 8
add close method #20
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
base: master
Are you sure you want to change the base?
add close method #20
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,7 +13,8 @@ module.exports = function (file, opts) { | |
|
|
||
| var blockSize = opts.blockSize || 1024*16 | ||
| var codec = opts.codec || {encode: id, decode: id, buffer: true} | ||
| var cache = opts.cache || Cache(1024) | ||
| var flags = opts.flags || 'a+' | ||
| var cache = opts.cache || Cache(8*1024) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems to make append a bit slower but make random a lot faster. Are you seeing the same @dominictarr? Before: append, 60189.786, 8.994, 602259, 89.996, 10.006 After: append, 57312.068, 8.561, 573178, 85.624, 10.001 Also tested 16 that seems to be almost the same as 8.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oops, I didn't mean to change the cache size. I'm gonna update PR to just not change that. |
||
| var offsetCodec = opts.offsetCodec || 32 | ||
|
|
||
| var blocks = Blocks(file, blockSize, opts.flags, cache) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -128,13 +128,13 @@ module.exports = function (blocks, frame, codec, file, cache) { | |
| )).catch((err) => cb(err)) | ||
| .then(() => cb(null)) | ||
| }, | ||
| close: function (cb) { | ||
| cb() | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this meant to do anything or just provide a consistent api? if it's to make this module consistent with some interface, maybe add a comment saying "nothing to do when closing". anyway, seems innocent, but then there's other changes in this pull request that seem unrelated. |
||
| }, | ||
| methods: { | ||
| del: 'async' | ||
| } | ||
| } | ||
| } | ||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
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.
I think we removed this in
masteron purpose but I can't remember why. Hmm.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.
I remember! it breaks your delete stuff. unfortunately there is no option that means "open a file for writing and reading and create the file if it does not exist" there is only error if it does not exist
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.
Does that mean that we should remove it from here? I don't remember, I can look into it (unless someone else beats me to it).
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.
yes, this patch should not change the file open flag, it's not about that.