@torrent-tv/proxy 2.69.2 → 2.71.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -248,6 +248,36 @@ export class PieceLru {
248
248
  };
249
249
  }
250
250
 
251
+ /**
252
+ * Whether a reader is holding this piece right now.
253
+ *
254
+ * Asked before a block is put back for re-use: a pinned piece has a view onto
255
+ * its memory somewhere, and handing that memory to another piece would let
256
+ * the holder read bytes that are not its own.
257
+ *
258
+ * @param {number} index
259
+ * @returns {boolean}
260
+ */
261
+ isPinned(index) {
262
+ return this.#pins.has(index);
263
+ }
264
+
265
+ /**
266
+ * Whether any live reader has declared it will want this piece.
267
+ *
268
+ * Asked on admission, not only on eviction: a piece nobody has declared is
269
+ * being downloaded ahead of every reader, and putting it in memory means
270
+ * pushing out one that IS declared — which is then read back from disk
271
+ * moments later. Measured 2026-09-02: 6565 spills and 7575 revivals in 44
272
+ * minutes with 53.6 % of reads served from memory (roadmap item 9).
273
+ *
274
+ * @param {number} index
275
+ * @returns {boolean}
276
+ */
277
+ wants(index) {
278
+ return this.#isProtected(index);
279
+ }
280
+
251
281
  /**
252
282
  * Pieces from `index` to the nearest declared window, zero inside one and -1
253
283
  * when nothing is declared.