@btc-vision/bitcoin 7.0.0-alpha.2 → 7.0.0-alpha.4

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.
Files changed (134) hide show
  1. package/README.md +455 -155
  2. package/browser/chunks/WorkerSigningPool.sequential-DHha7j0b.js +113 -0
  3. package/browser/ecc/context.d.ts +22 -21
  4. package/browser/ecc/context.d.ts.map +1 -1
  5. package/browser/ecc/index.d.ts +1 -1
  6. package/browser/ecc/index.d.ts.map +1 -1
  7. package/browser/ecc/types.d.ts +10 -123
  8. package/browser/ecc/types.d.ts.map +1 -1
  9. package/browser/env.d.ts +13 -0
  10. package/browser/env.d.ts.map +1 -0
  11. package/browser/index.d.ts +3 -3
  12. package/browser/index.d.ts.map +1 -1
  13. package/browser/index.js +5790 -4295
  14. package/browser/io/index.d.ts +0 -1
  15. package/browser/io/index.d.ts.map +1 -1
  16. package/browser/payments/p2tr.d.ts.map +1 -1
  17. package/browser/psbt/types.d.ts +2 -68
  18. package/browser/psbt/types.d.ts.map +1 -1
  19. package/browser/psbt.d.ts +9 -11
  20. package/browser/psbt.d.ts.map +1 -1
  21. package/browser/types.d.ts +1 -1
  22. package/browser/types.d.ts.map +1 -1
  23. package/browser/workers/WorkerSigningPool.d.ts +6 -0
  24. package/browser/workers/WorkerSigningPool.d.ts.map +1 -1
  25. package/browser/workers/WorkerSigningPool.node.d.ts +6 -0
  26. package/browser/workers/WorkerSigningPool.node.d.ts.map +1 -1
  27. package/browser/workers/WorkerSigningPool.sequential.d.ts +69 -0
  28. package/browser/workers/WorkerSigningPool.sequential.d.ts.map +1 -0
  29. package/browser/workers/WorkerSigningPool.worklet.d.ts +64 -0
  30. package/browser/workers/WorkerSigningPool.worklet.d.ts.map +1 -0
  31. package/browser/workers/index.d.ts +2 -2
  32. package/browser/workers/index.d.ts.map +1 -1
  33. package/browser/workers/index.react-native.d.ts +28 -0
  34. package/browser/workers/index.react-native.d.ts.map +1 -0
  35. package/browser/workers/psbt-parallel.d.ts +2 -3
  36. package/browser/workers/psbt-parallel.d.ts.map +1 -1
  37. package/browser/workers/types.d.ts +12 -0
  38. package/browser/workers/types.d.ts.map +1 -1
  39. package/build/ecc/context.d.ts +22 -21
  40. package/build/ecc/context.d.ts.map +1 -1
  41. package/build/ecc/context.js +19 -114
  42. package/build/ecc/context.js.map +1 -1
  43. package/build/ecc/index.d.ts +1 -1
  44. package/build/ecc/index.d.ts.map +1 -1
  45. package/build/ecc/types.d.ts +7 -126
  46. package/build/ecc/types.d.ts.map +1 -1
  47. package/build/ecc/types.js +4 -1
  48. package/build/ecc/types.js.map +1 -1
  49. package/build/env.d.ts +13 -0
  50. package/build/env.d.ts.map +1 -0
  51. package/build/env.js +198 -0
  52. package/build/env.js.map +1 -0
  53. package/build/index.d.ts +4 -3
  54. package/build/index.d.ts.map +1 -1
  55. package/build/index.js +2 -1
  56. package/build/index.js.map +1 -1
  57. package/build/io/index.d.ts +0 -1
  58. package/build/io/index.d.ts.map +1 -1
  59. package/build/io/index.js +0 -2
  60. package/build/io/index.js.map +1 -1
  61. package/build/payments/p2tr.d.ts.map +1 -1
  62. package/build/payments/p2tr.js +2 -3
  63. package/build/payments/p2tr.js.map +1 -1
  64. package/build/psbt/types.d.ts +2 -68
  65. package/build/psbt/types.d.ts.map +1 -1
  66. package/build/psbt.d.ts +9 -11
  67. package/build/psbt.d.ts.map +1 -1
  68. package/build/psbt.js +38 -53
  69. package/build/psbt.js.map +1 -1
  70. package/build/tsconfig.build.tsbuildinfo +1 -1
  71. package/build/types.d.ts +1 -1
  72. package/build/types.d.ts.map +1 -1
  73. package/build/types.js +2 -16
  74. package/build/types.js.map +1 -1
  75. package/build/workers/WorkerSigningPool.d.ts +6 -0
  76. package/build/workers/WorkerSigningPool.d.ts.map +1 -1
  77. package/build/workers/WorkerSigningPool.js +8 -0
  78. package/build/workers/WorkerSigningPool.js.map +1 -1
  79. package/build/workers/WorkerSigningPool.node.d.ts +6 -0
  80. package/build/workers/WorkerSigningPool.node.d.ts.map +1 -1
  81. package/build/workers/WorkerSigningPool.node.js +9 -2
  82. package/build/workers/WorkerSigningPool.node.js.map +1 -1
  83. package/build/workers/WorkerSigningPool.sequential.d.ts +78 -0
  84. package/build/workers/WorkerSigningPool.sequential.d.ts.map +1 -0
  85. package/build/workers/WorkerSigningPool.sequential.js +160 -0
  86. package/build/workers/WorkerSigningPool.sequential.js.map +1 -0
  87. package/build/workers/WorkerSigningPool.worklet.d.ts +79 -0
  88. package/build/workers/WorkerSigningPool.worklet.d.ts.map +1 -0
  89. package/build/workers/WorkerSigningPool.worklet.js +388 -0
  90. package/build/workers/WorkerSigningPool.worklet.js.map +1 -0
  91. package/build/workers/index.d.ts +2 -2
  92. package/build/workers/index.d.ts.map +1 -1
  93. package/build/workers/index.js +9 -0
  94. package/build/workers/index.js.map +1 -1
  95. package/build/workers/index.react-native.d.ts +28 -0
  96. package/build/workers/index.react-native.d.ts.map +1 -0
  97. package/build/workers/index.react-native.js +67 -0
  98. package/build/workers/index.react-native.js.map +1 -0
  99. package/build/workers/psbt-parallel.d.ts +2 -3
  100. package/build/workers/psbt-parallel.d.ts.map +1 -1
  101. package/build/workers/psbt-parallel.js +4 -4
  102. package/build/workers/psbt-parallel.js.map +1 -1
  103. package/build/workers/types.d.ts +12 -0
  104. package/build/workers/types.d.ts.map +1 -1
  105. package/package.json +14 -4
  106. package/src/ecc/context.ts +26 -147
  107. package/src/ecc/index.ts +2 -2
  108. package/src/ecc/types.ts +7 -138
  109. package/src/env.ts +237 -0
  110. package/src/index.ts +2 -4
  111. package/src/io/index.ts +0 -3
  112. package/src/payments/p2tr.ts +2 -2
  113. package/src/psbt/types.ts +2 -84
  114. package/src/psbt.ts +63 -121
  115. package/src/types.ts +5 -28
  116. package/src/workers/WorkerSigningPool.node.ts +10 -2
  117. package/src/workers/WorkerSigningPool.sequential.ts +190 -0
  118. package/src/workers/WorkerSigningPool.ts +9 -0
  119. package/src/workers/WorkerSigningPool.worklet.ts +519 -0
  120. package/src/workers/index.react-native.ts +110 -0
  121. package/src/workers/index.ts +10 -1
  122. package/src/workers/psbt-parallel.ts +8 -8
  123. package/src/workers/types.ts +16 -0
  124. package/test/env.spec.ts +418 -0
  125. package/test/workers-pool.spec.ts +43 -0
  126. package/test/workers-sequential.spec.ts +669 -0
  127. package/test/workers-worklet.spec.ts +500 -0
  128. package/browser/io/MemoryPool.d.ts +0 -220
  129. package/browser/io/MemoryPool.d.ts.map +0 -1
  130. package/build/io/MemoryPool.d.ts +0 -220
  131. package/build/io/MemoryPool.d.ts.map +0 -1
  132. package/build/io/MemoryPool.js +0 -309
  133. package/build/io/MemoryPool.js.map +0 -1
  134. package/src/io/MemoryPool.ts +0 -343
@@ -1,220 +0,0 @@
1
- /**
2
- * Memory pool using SharedArrayBuffer for zero-allocation operations.
3
- *
4
- * Provides thread-safe memory allocation using Atomics for concurrent access.
5
- * Ideal for parsing operations where temporary buffers are needed.
6
- *
7
- * @packageDocumentation
8
- */
9
- /**
10
- * Thread-safe memory pool using SharedArrayBuffer.
11
- *
12
- * Allocates memory from a pre-allocated SharedArrayBuffer pool,
13
- * eliminating garbage collection pressure from repeated allocations.
14
- *
15
- * Uses Atomics for thread-safe allocation when used with Workers.
16
- *
17
- * @example
18
- * ```typescript
19
- * import { MemoryPool } from '@btc-vision/bitcoin';
20
- *
21
- * // Create a 1MB pool
22
- * const pool = new MemoryPool(1024 * 1024);
23
- *
24
- * // Allocate memory for transaction parsing
25
- * const txBuffer = pool.alloc(500);
26
- * // ... use txBuffer ...
27
- *
28
- * // Reset pool when done (all allocations become invalid)
29
- * pool.reset();
30
- * ```
31
- */
32
- export declare class MemoryPool {
33
- #private;
34
- /**
35
- * Creates a new MemoryPool.
36
- *
37
- * @param size - Size of the pool in bytes (default 4MB)
38
- *
39
- * @example
40
- * ```typescript
41
- * import { MemoryPool } from '@btc-vision/bitcoin';
42
- *
43
- * // 4MB pool (default)
44
- * const pool = new MemoryPool();
45
- *
46
- * // 16MB pool
47
- * const largePool = new MemoryPool(16 * 1024 * 1024);
48
- * ```
49
- */
50
- constructor(size?: number);
51
- /**
52
- * Total capacity of the pool in bytes.
53
- */
54
- get capacity(): number;
55
- /**
56
- * Current allocation offset (bytes used).
57
- *
58
- * Uses Atomics for thread-safe reading.
59
- */
60
- get used(): number;
61
- /**
62
- * Remaining available bytes.
63
- */
64
- get available(): number;
65
- /**
66
- * The underlying SharedArrayBuffer.
67
- *
68
- * Can be transferred to Workers for shared memory access.
69
- */
70
- get sharedBuffer(): SharedArrayBuffer;
71
- /**
72
- * Creates a MemoryPool from an existing SharedArrayBuffer.
73
- *
74
- * Useful for sharing a pool between Workers.
75
- *
76
- * @param buffer - Existing SharedArrayBuffer
77
- * @returns A new MemoryPool instance wrapping the buffer
78
- *
79
- * @example
80
- * ```typescript
81
- * // Main thread
82
- * const pool = new MemoryPool(1024 * 1024);
83
- * worker.postMessage({ buffer: pool.sharedBuffer });
84
- *
85
- * // Worker thread
86
- * self.onmessage = (e) => {
87
- * const pool = MemoryPool.fromSharedBuffer(e.data.buffer);
88
- * const mem = pool.alloc(100);
89
- * };
90
- * ```
91
- */
92
- static fromSharedBuffer(buffer: SharedArrayBuffer): MemoryPool;
93
- /**
94
- * Allocates memory from the pool.
95
- *
96
- * Thread-safe using Atomics.add for concurrent access.
97
- *
98
- * @param size - Number of bytes to allocate
99
- * @returns Uint8Array view into the pool
100
- * @throws RangeError if pool is exhausted
101
- *
102
- * @example
103
- * ```typescript
104
- * const pool = new MemoryPool(1024);
105
- * const buf1 = pool.alloc(100); // First 100 bytes
106
- * const buf2 = pool.alloc(200); // Next 200 bytes
107
- * ```
108
- */
109
- alloc(size: number): Uint8Array;
110
- /**
111
- * Allocates memory and fills it with zeros.
112
- *
113
- * @param size - Number of bytes to allocate
114
- * @returns Uint8Array view into the pool, filled with zeros
115
- * @throws RangeError if pool is exhausted
116
- */
117
- allocZeroed(size: number): Uint8Array;
118
- /**
119
- * Allocates memory for a specific typed array.
120
- *
121
- * @param length - Number of elements
122
- * @param bytesPerElement - Size of each element in bytes
123
- * @returns Uint8Array view (use constructor of target type on underlying buffer)
124
- * @throws RangeError if pool is exhausted
125
- *
126
- * @example
127
- * ```typescript
128
- * const pool = new MemoryPool(1024);
129
- * const bytes = pool.allocTyped(10, 4); // 40 bytes for 10 Uint32
130
- * const u32View = new Uint32Array(bytes.buffer, bytes.byteOffset, 10);
131
- * ```
132
- */
133
- allocTyped(length: number, bytesPerElement: number): Uint8Array;
134
- /**
135
- * Resets the pool, making all memory available again.
136
- *
137
- * WARNING: All previously allocated views become invalid.
138
- * Only call when you're sure no references are held.
139
- *
140
- * Thread-safe using Atomics.store.
141
- *
142
- * @example
143
- * ```typescript
144
- * const pool = new MemoryPool(1024);
145
- * const buf = pool.alloc(100);
146
- * // ... use buf ...
147
- * pool.reset(); // buf is now invalid!
148
- * ```
149
- */
150
- reset(): void;
151
- /**
152
- * Checks if the pool can accommodate an allocation.
153
- *
154
- * @param size - Number of bytes needed
155
- * @returns True if allocation would succeed
156
- */
157
- canAlloc(size: number): boolean;
158
- }
159
- /**
160
- * Non-shared memory pool using regular ArrayBuffer.
161
- *
162
- * Use when SharedArrayBuffer is not available (e.g., browsers without
163
- * proper COOP/COEP headers) or when thread-safety is not needed.
164
- *
165
- * @example
166
- * ```typescript
167
- * import { SimpleMemoryPool } from '@btc-vision/bitcoin';
168
- *
169
- * const pool = new SimpleMemoryPool(1024 * 1024);
170
- * const buf = pool.alloc(100);
171
- * ```
172
- */
173
- export declare class SimpleMemoryPool {
174
- #private;
175
- /**
176
- * Creates a new SimpleMemoryPool.
177
- *
178
- * @param size - Size of the pool in bytes
179
- */
180
- constructor(size: number);
181
- /**
182
- * Total capacity of the pool in bytes.
183
- */
184
- get capacity(): number;
185
- /**
186
- * Current allocation offset (bytes used).
187
- */
188
- get used(): number;
189
- /**
190
- * Remaining available bytes.
191
- */
192
- get available(): number;
193
- /**
194
- * Allocates memory from the pool.
195
- *
196
- * @param size - Number of bytes to allocate
197
- * @returns Uint8Array view into the pool
198
- * @throws RangeError if pool is exhausted
199
- */
200
- alloc(size: number): Uint8Array;
201
- /**
202
- * Allocates memory and fills it with zeros.
203
- *
204
- * @param size - Number of bytes to allocate
205
- * @returns Uint8Array view into the pool, filled with zeros
206
- */
207
- allocZeroed(size: number): Uint8Array;
208
- /**
209
- * Resets the pool, making all memory available again.
210
- */
211
- reset(): void;
212
- /**
213
- * Checks if the pool can accommodate an allocation.
214
- *
215
- * @param size - Number of bytes needed
216
- * @returns True if allocation would succeed
217
- */
218
- canAlloc(size: number): boolean;
219
- }
220
- //# sourceMappingURL=MemoryPool.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MemoryPool.d.ts","sourceRoot":"","sources":["../../src/io/MemoryPool.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBAAa,UAAU;;IAsBnB;;;;;;;;;;;;;;;OAeG;gBACgB,IAAI,GAAE,MAAwB;IASjD;;OAEG;IACH,IAAW,QAAQ,IAAI,MAAM,CAE5B;IAED;;;;OAIG;IACH,IAAW,IAAI,IAAI,MAAM,CAExB;IAED;;OAEG;IACH,IAAW,SAAS,IAAI,MAAM,CAE7B;IAED;;;;OAIG;IACH,IAAW,YAAY,IAAI,iBAAiB,CAE3C;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;WACW,gBAAgB,CAAC,MAAM,EAAE,iBAAiB,GAAG,UAAU;IAarE;;;;;;;;;;;;;;;OAeG;IACI,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU;IAmBtC;;;;;;OAMG;IACI,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU;IAM5C;;;;;;;;;;;;;;OAcG;IACI,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,UAAU;IAItE;;;;;;;;;;;;;;;OAeG;IACI,KAAK,IAAI,IAAI;IAIpB;;;;;OAKG;IACI,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;CAGzC;AAED;;;;;;;;;;;;;GAaG;AACH,qBAAa,gBAAgB;;IAIzB;;;;OAIG;gBACgB,IAAI,EAAE,MAAM;IAI/B;;OAEG;IACH,IAAW,QAAQ,IAAI,MAAM,CAE5B;IAED;;OAEG;IACH,IAAW,IAAI,IAAI,MAAM,CAExB;IAED;;OAEG;IACH,IAAW,SAAS,IAAI,MAAM,CAE7B;IAED;;;;;;OAMG;IACI,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU;IAgBtC;;;;;OAKG;IACI,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU;IAM5C;;OAEG;IACI,KAAK,IAAI,IAAI;IAIpB;;;;;OAKG;IACI,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;CAGzC"}
@@ -1,220 +0,0 @@
1
- /**
2
- * Memory pool using SharedArrayBuffer for zero-allocation operations.
3
- *
4
- * Provides thread-safe memory allocation using Atomics for concurrent access.
5
- * Ideal for parsing operations where temporary buffers are needed.
6
- *
7
- * @packageDocumentation
8
- */
9
- /**
10
- * Thread-safe memory pool using SharedArrayBuffer.
11
- *
12
- * Allocates memory from a pre-allocated SharedArrayBuffer pool,
13
- * eliminating garbage collection pressure from repeated allocations.
14
- *
15
- * Uses Atomics for thread-safe allocation when used with Workers.
16
- *
17
- * @example
18
- * ```typescript
19
- * import { MemoryPool } from '@btc-vision/bitcoin';
20
- *
21
- * // Create a 1MB pool
22
- * const pool = new MemoryPool(1024 * 1024);
23
- *
24
- * // Allocate memory for transaction parsing
25
- * const txBuffer = pool.alloc(500);
26
- * // ... use txBuffer ...
27
- *
28
- * // Reset pool when done (all allocations become invalid)
29
- * pool.reset();
30
- * ```
31
- */
32
- export declare class MemoryPool {
33
- #private;
34
- /**
35
- * Creates a new MemoryPool.
36
- *
37
- * @param size - Size of the pool in bytes (default 4MB)
38
- *
39
- * @example
40
- * ```typescript
41
- * import { MemoryPool } from '@btc-vision/bitcoin';
42
- *
43
- * // 4MB pool (default)
44
- * const pool = new MemoryPool();
45
- *
46
- * // 16MB pool
47
- * const largePool = new MemoryPool(16 * 1024 * 1024);
48
- * ```
49
- */
50
- constructor(size?: number);
51
- /**
52
- * Total capacity of the pool in bytes.
53
- */
54
- get capacity(): number;
55
- /**
56
- * Current allocation offset (bytes used).
57
- *
58
- * Uses Atomics for thread-safe reading.
59
- */
60
- get used(): number;
61
- /**
62
- * Remaining available bytes.
63
- */
64
- get available(): number;
65
- /**
66
- * The underlying SharedArrayBuffer.
67
- *
68
- * Can be transferred to Workers for shared memory access.
69
- */
70
- get sharedBuffer(): SharedArrayBuffer;
71
- /**
72
- * Creates a MemoryPool from an existing SharedArrayBuffer.
73
- *
74
- * Useful for sharing a pool between Workers.
75
- *
76
- * @param buffer - Existing SharedArrayBuffer
77
- * @returns A new MemoryPool instance wrapping the buffer
78
- *
79
- * @example
80
- * ```typescript
81
- * // Main thread
82
- * const pool = new MemoryPool(1024 * 1024);
83
- * worker.postMessage({ buffer: pool.sharedBuffer });
84
- *
85
- * // Worker thread
86
- * self.onmessage = (e) => {
87
- * const pool = MemoryPool.fromSharedBuffer(e.data.buffer);
88
- * const mem = pool.alloc(100);
89
- * };
90
- * ```
91
- */
92
- static fromSharedBuffer(buffer: SharedArrayBuffer): MemoryPool;
93
- /**
94
- * Allocates memory from the pool.
95
- *
96
- * Thread-safe using Atomics.add for concurrent access.
97
- *
98
- * @param size - Number of bytes to allocate
99
- * @returns Uint8Array view into the pool
100
- * @throws RangeError if pool is exhausted
101
- *
102
- * @example
103
- * ```typescript
104
- * const pool = new MemoryPool(1024);
105
- * const buf1 = pool.alloc(100); // First 100 bytes
106
- * const buf2 = pool.alloc(200); // Next 200 bytes
107
- * ```
108
- */
109
- alloc(size: number): Uint8Array;
110
- /**
111
- * Allocates memory and fills it with zeros.
112
- *
113
- * @param size - Number of bytes to allocate
114
- * @returns Uint8Array view into the pool, filled with zeros
115
- * @throws RangeError if pool is exhausted
116
- */
117
- allocZeroed(size: number): Uint8Array;
118
- /**
119
- * Allocates memory for a specific typed array.
120
- *
121
- * @param length - Number of elements
122
- * @param bytesPerElement - Size of each element in bytes
123
- * @returns Uint8Array view (use constructor of target type on underlying buffer)
124
- * @throws RangeError if pool is exhausted
125
- *
126
- * @example
127
- * ```typescript
128
- * const pool = new MemoryPool(1024);
129
- * const bytes = pool.allocTyped(10, 4); // 40 bytes for 10 Uint32
130
- * const u32View = new Uint32Array(bytes.buffer, bytes.byteOffset, 10);
131
- * ```
132
- */
133
- allocTyped(length: number, bytesPerElement: number): Uint8Array;
134
- /**
135
- * Resets the pool, making all memory available again.
136
- *
137
- * WARNING: All previously allocated views become invalid.
138
- * Only call when you're sure no references are held.
139
- *
140
- * Thread-safe using Atomics.store.
141
- *
142
- * @example
143
- * ```typescript
144
- * const pool = new MemoryPool(1024);
145
- * const buf = pool.alloc(100);
146
- * // ... use buf ...
147
- * pool.reset(); // buf is now invalid!
148
- * ```
149
- */
150
- reset(): void;
151
- /**
152
- * Checks if the pool can accommodate an allocation.
153
- *
154
- * @param size - Number of bytes needed
155
- * @returns True if allocation would succeed
156
- */
157
- canAlloc(size: number): boolean;
158
- }
159
- /**
160
- * Non-shared memory pool using regular ArrayBuffer.
161
- *
162
- * Use when SharedArrayBuffer is not available (e.g., browsers without
163
- * proper COOP/COEP headers) or when thread-safety is not needed.
164
- *
165
- * @example
166
- * ```typescript
167
- * import { SimpleMemoryPool } from '@btc-vision/bitcoin';
168
- *
169
- * const pool = new SimpleMemoryPool(1024 * 1024);
170
- * const buf = pool.alloc(100);
171
- * ```
172
- */
173
- export declare class SimpleMemoryPool {
174
- #private;
175
- /**
176
- * Creates a new SimpleMemoryPool.
177
- *
178
- * @param size - Size of the pool in bytes
179
- */
180
- constructor(size: number);
181
- /**
182
- * Total capacity of the pool in bytes.
183
- */
184
- get capacity(): number;
185
- /**
186
- * Current allocation offset (bytes used).
187
- */
188
- get used(): number;
189
- /**
190
- * Remaining available bytes.
191
- */
192
- get available(): number;
193
- /**
194
- * Allocates memory from the pool.
195
- *
196
- * @param size - Number of bytes to allocate
197
- * @returns Uint8Array view into the pool
198
- * @throws RangeError if pool is exhausted
199
- */
200
- alloc(size: number): Uint8Array;
201
- /**
202
- * Allocates memory and fills it with zeros.
203
- *
204
- * @param size - Number of bytes to allocate
205
- * @returns Uint8Array view into the pool, filled with zeros
206
- */
207
- allocZeroed(size: number): Uint8Array;
208
- /**
209
- * Resets the pool, making all memory available again.
210
- */
211
- reset(): void;
212
- /**
213
- * Checks if the pool can accommodate an allocation.
214
- *
215
- * @param size - Number of bytes needed
216
- * @returns True if allocation would succeed
217
- */
218
- canAlloc(size: number): boolean;
219
- }
220
- //# sourceMappingURL=MemoryPool.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MemoryPool.d.ts","sourceRoot":"","sources":["../../src/io/MemoryPool.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBAAa,UAAU;;IAsBnB;;;;;;;;;;;;;;;OAeG;gBACgB,IAAI,GAAE,MAAwB;IASjD;;OAEG;IACH,IAAW,QAAQ,IAAI,MAAM,CAE5B;IAED;;;;OAIG;IACH,IAAW,IAAI,IAAI,MAAM,CAExB;IAED;;OAEG;IACH,IAAW,SAAS,IAAI,MAAM,CAE7B;IAED;;;;OAIG;IACH,IAAW,YAAY,IAAI,iBAAiB,CAE3C;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;WACW,gBAAgB,CAAC,MAAM,EAAE,iBAAiB,GAAG,UAAU;IAarE;;;;;;;;;;;;;;;OAeG;IACI,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU;IAmBtC;;;;;;OAMG;IACI,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU;IAM5C;;;;;;;;;;;;;;OAcG;IACI,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,UAAU;IAItE;;;;;;;;;;;;;;;OAeG;IACI,KAAK,IAAI,IAAI;IAIpB;;;;;OAKG;IACI,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;CAGzC;AAED;;;;;;;;;;;;;GAaG;AACH,qBAAa,gBAAgB;;IAIzB;;;;OAIG;gBACgB,IAAI,EAAE,MAAM;IAI/B;;OAEG;IACH,IAAW,QAAQ,IAAI,MAAM,CAE5B;IAED;;OAEG;IACH,IAAW,IAAI,IAAI,MAAM,CAExB;IAED;;OAEG;IACH,IAAW,SAAS,IAAI,MAAM,CAE7B;IAED;;;;;;OAMG;IACI,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU;IAgBtC;;;;;OAKG;IACI,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU;IAM5C;;OAEG;IACI,KAAK,IAAI,IAAI;IAIpB;;;;;OAKG;IACI,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;CAGzC"}