add getGhostSpan()

This commit is contained in:
Andre Staltz 2023-10-26 11:10:19 +03:00
parent a2304bc24f
commit edaffa7626
No known key found for this signature in database
GPG Key ID: 9EDE23EA7E8A4890
2 changed files with 11 additions and 0 deletions

View File

@ -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,

View File

@ -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) => {