Skip to content

Commit

Permalink
rename atomizer to atom
Browse files Browse the repository at this point in the history
  • Loading branch information
chm-diederichs committed Dec 17, 2024
1 parent 0529b87 commit 9bdee3f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
14 changes: 7 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ class Lock {
}
}

class Atomizer {
class Atom {
constructor (db) {
this.db = db
this.batch = null
Expand Down Expand Up @@ -481,8 +481,8 @@ module.exports = class CoreStorage {
return this.db.close()
}

atomizer () {
return new Atomizer(this.db)
atom () {
return new Atom(this.db)
}

async clear () {
Expand Down Expand Up @@ -573,8 +573,8 @@ class HypercoreStorage {
return this.dbSnapshot !== null
}

atomizer () {
return this.root.atomizer()
atom () {
return this.root.atom()
}

dependencyLength () {
Expand Down Expand Up @@ -681,10 +681,10 @@ class HypercoreStorage {
return new ReadBatch(this, this.db.read({ snapshot }))
}

createWriteBatch (atomizer) {
createWriteBatch (atom) {
assert(this.destroyed === false)

if (atomizer) return new WriteBatch(this, atomizer.createBatch(), atomizer)
if (atom) return new WriteBatch(this, atom.createBatch(), atom)

return new WriteBatch(this, this.db.write(), null)
}
Expand Down
6 changes: 3 additions & 3 deletions test/atomic.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ const DK_1 = Buffer.alloc(32).fill('dk1')
test('basic cross atomic batches', async function (t) {
const s = new CoreStorage(await tmp(t))

const atomizer = s.atomizer()
const atom = s.atom()
const a = await s.create({ key: DK_0, discoveryKey: DK_0 })
const b = await s.create({ key: DK_1, discoveryKey: DK_1 })

let waited = false

const w1 = a.createWriteBatch(atomizer)
const w2 = b.createWriteBatch(atomizer)
const w1 = a.createWriteBatch(atom)
const w2 = b.createWriteBatch(atom)

w1.putBlock(0, Buffer.from('block #0'))
const promise = w1.flush()
Expand Down

0 comments on commit 9bdee3f

Please sign in to comment.