mirror of https://codeberg.org/pzp/pzp-dict.git
add getGhostSpan()
This commit is contained in:
parent
a2304bc24f
commit
edaffa7626
|
@ -76,6 +76,7 @@ function initRecord(peer, config) {
|
||||||
assertDBPlugin(peer)
|
assertDBPlugin(peer)
|
||||||
|
|
||||||
const ghostSpan = config.record?.ghostSpan ?? 32
|
const ghostSpan = config.record?.ghostSpan ?? 32
|
||||||
|
if (ghostSpan < 1) throw new Error('config.record.ghostSpan must be >= 0')
|
||||||
|
|
||||||
//#region state
|
//#region state
|
||||||
let accountID = /** @type {string | null} */ (null)
|
let accountID = /** @type {string | null} */ (null)
|
||||||
|
@ -475,6 +476,13 @@ function initRecord(peer, config) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @returns {number}
|
||||||
|
*/
|
||||||
|
function getGhostSpan() {
|
||||||
|
return ghostSpan
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @public
|
* @public
|
||||||
* @param {string} subdomain
|
* @param {string} subdomain
|
||||||
|
@ -532,6 +540,7 @@ function initRecord(peer, config) {
|
||||||
read,
|
read,
|
||||||
getFeedID,
|
getFeedID,
|
||||||
isGhostable,
|
isGhostable,
|
||||||
|
getGhostSpan,
|
||||||
minGhostDepth,
|
minGhostDepth,
|
||||||
minRequiredDepth,
|
minRequiredDepth,
|
||||||
squeeze,
|
squeeze,
|
||||||
|
|
|
@ -29,6 +29,8 @@ test('setup', async (t) => {
|
||||||
_nonce: 'alice',
|
_nonce: 'alice',
|
||||||
})
|
})
|
||||||
await p(peer.record.load)(aliceID)
|
await p(peer.record.load)(aliceID)
|
||||||
|
|
||||||
|
assert.equal(peer.record.getGhostSpan(), 4, 'getGhostSpan')
|
||||||
})
|
})
|
||||||
|
|
||||||
test('Record update() and get()', async (t) => {
|
test('Record update() and get()', async (t) => {
|
||||||
|
|
Loading…
Reference in New Issue