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