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

View File

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