blockedsource.d.ts 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. export class BlockedSource extends BaseSource {
  2. /**
  3. *
  4. * @param {BaseSource} source The underlying source that shall be blocked and cached
  5. * @param {object} options
  6. * @param {number} [options.blockSize]
  7. * @param {number} [options.cacheSize]
  8. */
  9. constructor(source: BaseSource, { blockSize, cacheSize }?: {
  10. blockSize?: number | undefined;
  11. cacheSize?: number | undefined;
  12. });
  13. source: BaseSource;
  14. blockSize: number;
  15. blockCache: QuickLRU<any, any>;
  16. /** @type {Map<number, Block>} */
  17. evictedBlocks: Map<number, Block>;
  18. blockRequests: Map<any, any>;
  19. blockIdsToFetch: Set<any>;
  20. abortedBlockIds: Set<any>;
  21. /**
  22. *
  23. * @param {AbortSignal} signal
  24. */
  25. fetchBlocks(signal: AbortSignal): void;
  26. /**
  27. *
  28. * @param {Set} blockIds
  29. * @returns {BlockGroup[]}
  30. */
  31. groupBlocks(blockIds: Set<any>): BlockGroup[];
  32. /**
  33. *
  34. * @param {import("./basesource").Slice[]} slices
  35. * @param {Map} blocks
  36. */
  37. readSliceData(slices: import("./basesource").Slice[], blocks: Map<any, any>): ArrayBuffer[];
  38. }
  39. import { BaseSource } from "./basesource.js";
  40. import QuickLRU from "quick-lru";
  41. declare class Block {
  42. /**
  43. *
  44. * @param {number} offset
  45. * @param {number} length
  46. * @param {ArrayBuffer} [data]
  47. */
  48. constructor(offset: number, length: number, data?: ArrayBuffer | undefined);
  49. offset: number;
  50. length: number;
  51. data: ArrayBuffer;
  52. /**
  53. * @returns {number} the top byte border
  54. */
  55. get top(): number;
  56. }
  57. declare class BlockGroup {
  58. /**
  59. *
  60. * @param {number} offset
  61. * @param {number} length
  62. * @param {number[]} blockIds
  63. */
  64. constructor(offset: number, length: number, blockIds: number[]);
  65. offset: number;
  66. length: number;
  67. blockIds: number[];
  68. }
  69. export {};
  70. //# sourceMappingURL=blockedsource.d.ts.map