remove goal "oldest"

This commit is contained in:
Andre Staltz 2023-10-12 15:31:41 +03:00
parent 4637a24960
commit 20be886872
No known key found for this signature in database
GPG Key ID: 9EDE23EA7E8A4890
2 changed files with 1 additions and 21 deletions

View File

@ -79,17 +79,6 @@ class Algorithm {
return [minWant, maxWant]
}
/**
* @param {Range} localHaveRange
* @param {Range} remoteHaveRange
* @param {number} count
* @returns {Range}
*/
#wantOldestRange(localHaveRange, remoteHaveRange, count) {
// TODO: implement
throw new Error('not implemented')
}
/**
* @param {Range} localHave
* @param {Range} remoteHave
@ -103,8 +92,6 @@ class Algorithm {
return this.#wantAllRange(localHave, remoteHave)
} else if (goal.type === 'newest') {
return this.#wantNewestRange(localHave, remoteHave, goal.count)
} else if (goal.type === 'oldest') {
return this.#wantOldestRange(localHave, remoteHave, goal.count)
}
return EMPTY_RANGE
}
@ -249,9 +236,6 @@ class Algorithm {
if (goal.type === 'newest') {
return await this.pruneNewest(rootID, goal.count)
}
if (goal.type === 'oldest') {
throw new Error('not implemented') // TODO
}
}
/**

View File

@ -7,11 +7,7 @@ const { isEmptyRange } = require('./range')
* @typedef {import('ppppp-db/msg-v3').Msg} Msg
* @typedef {import('./range').Range} Range
* @typedef {import('./algorithm')} Algorithm
* @typedef {{
* type: 'all' | 'newest' | 'oldest',
* count: number,
* id: string
* }} Goal
* @typedef {import('ppppp-goals').Goal} Goal
* @typedef {string} MsgID
* @typedef {{id: string}} WithId
* @typedef {WithId & {phase: 0, payload?: undefined}} Data0