@@ -78,7 +78,6 @@ interface ChunkHeader {
78
78
const CHUNK_HEADER_BYTES = 8 ;
79
79
80
80
// eslint-disable-next-line @typescript-eslint/no-unused-vars
81
- const debug = ( ...args : unknown [ ] ) => { } ;
82
81
83
82
/**
84
83
* XetBlob is a blob implementation that fetches data directly from the Xet storage
@@ -153,7 +152,6 @@ export class XetBlob extends Blob {
153
152
this . #reconstructionInfoPromise = ( async ( ) => {
154
153
const connParams = await getAccessToken ( this . repoId , this . accessToken , this . fetch , this . hubUrl ) ;
155
154
156
- // debug(
157
155
// `curl '${connParams.casUrl}/reconstruction/${this.hash}' -H 'Authorization: Bearer ${connParams.accessToken}'`
158
156
// );
159
157
@@ -220,15 +218,14 @@ export class XetBlob extends Blob {
220
218
const termRanges = rangeList . getRanges ( term . range . start , term . range . end ) ;
221
219
222
220
if ( termRanges . every ( ( range ) => range . data ) ) {
223
- debug ( "all data available for term" , term . hash , readBytesToSkip ) ;
224
221
rangeLoop: for ( const range of termRanges ) {
225
222
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
226
223
for ( let chunk of range . data ! ) {
227
224
if ( chunk . length > maxBytes - totalBytesRead ) {
228
225
chunk = chunk . slice ( 0 , maxBytes - totalBytesRead ) ;
229
226
}
230
227
totalBytesRead += chunk . length ;
231
- debug ( "yield" , chunk . length , "bytes" , "total read" , totalBytesRead ) ;
228
+
232
229
// The stream consumer can decide to transfer ownership of the chunk, so we need to return a clone
233
230
// if there's more than one range for the same term
234
231
yield range . refCount > 1 ? chunk . slice ( ) : chunk ;
@@ -253,10 +250,6 @@ export class XetBlob extends Blob {
253
250
) ;
254
251
}
255
252
256
- debug ( "term" , term ) ;
257
- debug ( "fetchinfo" , fetchInfo ) ;
258
- debug ( "readBytesToSkip" , readBytesToSkip ) ;
259
-
260
253
let resp = await customFetch ( fetchInfo . url , {
261
254
headers : {
262
255
Range : `bytes=${ fetchInfo . url_range . start } -${ fetchInfo . url_range . end } ` ,
@@ -292,8 +285,6 @@ export class XetBlob extends Blob {
292
285
const result = await reader . read ( ) ;
293
286
done = result . done ;
294
287
295
- debug ( "read" , result . value ?. length , "bytes" , "total read" , totalBytesRead , "toSkip" , readBytesToSkip ) ;
296
-
297
288
if ( ! result . value ) {
298
289
continue ;
299
290
}
@@ -318,8 +309,6 @@ export class XetBlob extends Blob {
318
309
uncompressed_length : header . getUint8 ( 5 ) | ( header . getUint8 ( 6 ) << 8 ) | ( header . getUint8 ( 7 ) << 16 ) ,
319
310
} ;
320
311
321
- debug ( "chunk header" , chunkHeader , "to skip" , readBytesToSkip ) ;
322
-
323
312
if ( chunkHeader . version !== 0 ) {
324
313
throw new Error ( `Unsupported chunk version ${ chunkHeader . version } ` ) ;
325
314
}
@@ -380,10 +369,8 @@ export class XetBlob extends Blob {
380
369
}
381
370
382
371
if ( uncompressed . length ) {
383
- debug ( "yield" , uncompressed . length , "bytes" , result . value . length , "total read" , totalBytesRead , stored ) ;
384
372
totalBytesRead += uncompressed . length ;
385
373
yield stored ? uncompressed . slice ( ) : uncompressed ;
386
- debug ( "yielded" , uncompressed . length , "bytes" , result . value . length , "total read" , totalBytesRead ) ;
387
374
}
388
375
}
389
376
@@ -392,8 +379,6 @@ export class XetBlob extends Blob {
392
379
}
393
380
}
394
381
395
- debug ( "done" , done , "total read" , totalBytesRead ) ;
396
-
397
382
// Release the reader
398
383
await reader . cancel ( ) ;
399
384
}
0 commit comments