wwiv
wwiv copied to clipboard
add support for qscan renumbering into wwivutil fix
WWIV 4.x FIX had a function void find_max_qscan(void)
which would renumber the qscan of all messages. Seems like a good thing to add. Mark can use it then.
Here's a doc with the proposal: https://docs.google.com/document/d/1pA-DRuhdweN4x4KvAqlwmAojo9jjmegebYLSYbJ7ImY/edit?usp=gmail
Memory Requirements:
For each cell in the map, need 8 bytes (4 bytes * 2) Say 1k users and 1k subs, that's 1m * 8 == 8m ram needed.
Each sub can be read in ram at one time.
Say 100k messages, 100 bytes/header = 10m.
Total needed high water mark = 18m
# Algorithm:
Qo = Original QScan Pointer
Qn = New QScan Pointer
Create Map ( Qo -> Qn )
### Create the list of interesting qscan values
For each user U:
For each area A:
Put map ( user.qsc_p[A] -> 0 )
### Renumber message area
Let Qn = 0
For each area:
For each message m:
If map contains (m.qscan):
// Update mapping of old to new qscan pointer
map put(m.qscan, Qn)
Let m.qscan = Qn;
Qn ++
### Now map(Qo -> Qn) is complete.
### Renumber the qscan pointers
For each user U:
For each area A:
let oq = user.qsc_[A]
let nq = map.lower_bound(oq);
if nq is found:
set user.qsc[A] = nq.value
else:
# Set to highest possible value.
set user.qsc[A] = Qn