Skip to content

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ module.exports = function (file, opts) {

var blockSize = opts.blockSize || 1024*16
var codec = opts.codec || {encode: id, decode: id, buffer: true}
var flags = opts.flags || 'a+'
Copy link
Member

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 master on purpose but I can't remember why. Hmm.

Copy link
Collaborator Author

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

Copy link
Member

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).

Copy link
Collaborator Author

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.

var cache = opts.cache || Cache(1024)
var offsetCodec = opts.offsetCodec || 32

Expand Down
6 changes: 3 additions & 3 deletions inject.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,13 @@ module.exports = function (blocks, frame, codec, file, cache) {
)).catch((err) => cb(err))
.then(() => cb(null))
},
close: function (cb) {
cb()

Choose a reason for hiding this comment

The 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'
}
}
}





2 changes: 1 addition & 1 deletion bench.js → test/bench.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var FlumeLog = require('./')
var FlumeLog = require('../')
var codec = require('flumecodec')

require('bench-flumelog')(function () {
Expand Down
4 changes: 2 additions & 2 deletions test/flumelog.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ var create = require('../')
var testLog = require('test-flumelog')

function test(name, opts, cb) {
testLog(function () {
return create('/tmp/test_flumelog-offset_'+Date.now(), Object.assign({
testLog(function (filename) {
return create(filename, Object.assign({
blockSize: 1024,
codec: {
encode: function (v) {
Expand Down