Skip to content
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

Batch write: Doing a delete when the value missing seems prone to mistakes #8

Open
Raynos opened this issue Feb 15, 2020 · 2 comments
Assignees
Labels
good first issue Good for newcomers

Comments

@Raynos
Copy link
Contributor

Raynos commented Feb 15, 2020

Having a batch API that is something like

table.batchWrite([
  { hash: 'foo', range: 'bar', value: { ... } },
  { hash: 'foo': range: 'other', delete: true }
])

Is less likely to delete due to a bug, since the delete is opt in.

we can also add something like

const batch = table.startBatchWrite()
batch.put('foo', 'bar', { ... })
batch.delete('foo', 'other')
const { err } = await batch.commit()

In the future, to support an API with fewer allocations. ( Would be nice to have benchmarks first before doing this ).

@heapwolf
Copy link
Member

maybe, im on the fence with this. is having the radix parameter the second positional argument to parseInt a footgun? maybe. maybe not. haha. Let me think about this one more.

@Raynos
Copy link
Contributor Author

Raynos commented Feb 15, 2020

well at least tuple.length instead of if (value) because the current implementation would do a delete instead of writing null for batchWrite(foo, bar, null)

Also that's another issue I should open about objects vs primitive.

@heapwolf heapwolf self-assigned this Feb 15, 2020
@heapwolf heapwolf added the good first issue Good for newcomers label Feb 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants