@azure/storage-blob-changefeed 12.0.0-alpha.20220512.4 → 12.0.0-alpha.20220614.1
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.
- package/dist/index.js +38 -13
- package/dist/index.js.map +1 -1
- package/dist-esm/storage-blob-changefeed/src/BlobChangeFeedClient.js +8 -4
- package/dist-esm/storage-blob-changefeed/src/BlobChangeFeedClient.js.map +1 -1
- package/dist-esm/storage-blob-changefeed/src/ChangeFeedFactory.js +26 -6
- package/dist-esm/storage-blob-changefeed/src/ChangeFeedFactory.js.map +1 -1
- package/dist-esm/storage-blob-changefeed/src/ChunkFactory.js +4 -3
- package/dist-esm/storage-blob-changefeed/src/ChunkFactory.js.map +1 -1
- package/package.json +2 -2
- package/types/3.1/storage-blob-changefeed/src/BlobChangeFeedClient.d.ts +12 -2
- package/types/3.1/storage-blob-changefeed/src/ChangeFeedFactory.d.ts +2 -1
- package/types/3.1/storage-blob-changefeed/src/ChunkFactory.d.ts +2 -1
- package/types/3.1/storage-blob-changefeed.d.ts +12 -2
- package/types/latest/storage-blob-changefeed/src/BlobChangeFeedClient.d.ts +12 -2
- package/types/latest/storage-blob-changefeed/src/BlobChangeFeedClient.d.ts.map +1 -1
- package/types/latest/storage-blob-changefeed/src/ChangeFeedFactory.d.ts +2 -1
- package/types/latest/storage-blob-changefeed/src/ChangeFeedFactory.d.ts.map +1 -1
- package/types/latest/storage-blob-changefeed/src/ChunkFactory.d.ts +2 -1
- package/types/latest/storage-blob-changefeed/src/ChunkFactory.d.ts.map +1 -1
- package/types/latest/storage-blob-changefeed.d.ts +13 -2
- package/CHANGELOG.md +0 -25
package/dist/index.js
CHANGED
|
@@ -1182,18 +1182,19 @@ class Chunk {
|
|
|
1182
1182
|
|
|
1183
1183
|
// Copyright (c) Microsoft Corporation.
|
|
1184
1184
|
class ChunkFactory {
|
|
1185
|
-
constructor(avroReaderFactory, lazyLoadingBlobStreamFactory) {
|
|
1185
|
+
constructor(avroReaderFactory, lazyLoadingBlobStreamFactory, maxTransferSize) {
|
|
1186
1186
|
this.avroReaderFactory = avroReaderFactory;
|
|
1187
1187
|
this.lazyLoadingBlobStreamFactory = lazyLoadingBlobStreamFactory;
|
|
1188
|
+
this.maxTransferSize = maxTransferSize;
|
|
1188
1189
|
}
|
|
1189
1190
|
async create(containerClient, chunkPath, blockOffset, eventIndex, options = {}) {
|
|
1190
1191
|
const blobClient = containerClient.getBlobClient(chunkPath);
|
|
1191
1192
|
blockOffset = blockOffset || 0;
|
|
1192
1193
|
eventIndex = eventIndex || 0;
|
|
1193
|
-
const dataStream = streamToAvroReadable(this.lazyLoadingBlobStreamFactory.create(blobClient, blockOffset, CHANGE_FEED_CHUNK_BLOCK_DOWNLOAD_SIZE, options));
|
|
1194
|
+
const dataStream = streamToAvroReadable(this.lazyLoadingBlobStreamFactory.create(blobClient, blockOffset, this.maxTransferSize ? this.maxTransferSize : CHANGE_FEED_CHUNK_BLOCK_DOWNLOAD_SIZE, options));
|
|
1194
1195
|
let avroReader;
|
|
1195
1196
|
if (blockOffset !== 0) {
|
|
1196
|
-
const headerStream = streamToAvroReadable(this.lazyLoadingBlobStreamFactory.create(blobClient, 0, CHANGE_FEED_CHUNK_BLOCK_DOWNLOAD_SIZE, options));
|
|
1197
|
+
const headerStream = streamToAvroReadable(this.lazyLoadingBlobStreamFactory.create(blobClient, 0, this.maxTransferSize ? this.maxTransferSize : CHANGE_FEED_CHUNK_BLOCK_DOWNLOAD_SIZE, options));
|
|
1197
1198
|
avroReader = this.avroReaderFactory.create(dataStream, headerStream, blockOffset, eventIndex);
|
|
1198
1199
|
}
|
|
1199
1200
|
else {
|
|
@@ -1328,12 +1329,21 @@ class LazyLoadingBlobStreamFactory {
|
|
|
1328
1329
|
|
|
1329
1330
|
// Copyright (c) Microsoft Corporation.
|
|
1330
1331
|
class ChangeFeedFactory {
|
|
1331
|
-
constructor(
|
|
1332
|
+
constructor(segmentFactoryOrMaxTransferSize) {
|
|
1333
|
+
let segmentFactory;
|
|
1334
|
+
if (segmentFactoryOrMaxTransferSize) {
|
|
1335
|
+
if (Number.isFinite(segmentFactoryOrMaxTransferSize)) {
|
|
1336
|
+
this.maxTransferSize = segmentFactoryOrMaxTransferSize;
|
|
1337
|
+
}
|
|
1338
|
+
else if (segmentFactoryOrMaxTransferSize instanceof SegmentFactory) {
|
|
1339
|
+
segmentFactory = segmentFactoryOrMaxTransferSize;
|
|
1340
|
+
}
|
|
1341
|
+
}
|
|
1332
1342
|
if (segmentFactory) {
|
|
1333
1343
|
this.segmentFactory = segmentFactory;
|
|
1334
1344
|
}
|
|
1335
1345
|
else {
|
|
1336
|
-
this.segmentFactory = new SegmentFactory(new ShardFactory(new ChunkFactory(new AvroReaderFactory(), new LazyLoadingBlobStreamFactory())));
|
|
1346
|
+
this.segmentFactory = new SegmentFactory(new ShardFactory(new ChunkFactory(new AvroReaderFactory(), new LazyLoadingBlobStreamFactory(), this.maxTransferSize)));
|
|
1337
1347
|
}
|
|
1338
1348
|
}
|
|
1339
1349
|
static validateCursor(containerClient, cursor) {
|
|
@@ -1374,10 +1384,21 @@ class ChangeFeedFactory {
|
|
|
1374
1384
|
}
|
|
1375
1385
|
// Get last consumable.
|
|
1376
1386
|
const blobClient = containerClient.getBlobClient(CHANGE_FEED_META_SEGMENT_PATH);
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1387
|
+
let blobDownloadRes;
|
|
1388
|
+
try {
|
|
1389
|
+
blobDownloadRes = await blobClient.download(undefined, undefined, {
|
|
1390
|
+
abortSignal: options.abortSignal,
|
|
1391
|
+
tracingOptions: updatedOptions.tracingOptions,
|
|
1392
|
+
});
|
|
1393
|
+
}
|
|
1394
|
+
catch (err) {
|
|
1395
|
+
if (err.statusCode === 404) {
|
|
1396
|
+
return new ChangeFeed();
|
|
1397
|
+
}
|
|
1398
|
+
else {
|
|
1399
|
+
throw err;
|
|
1400
|
+
}
|
|
1401
|
+
}
|
|
1381
1402
|
const lastConsumable = new Date(JSON.parse(await bodyToString(blobDownloadRes)).lastConsumable);
|
|
1382
1403
|
// Get year paths
|
|
1383
1404
|
const years = await getYearsPaths(containerClient, {
|
|
@@ -1467,8 +1488,9 @@ class BlobChangeFeedClient {
|
|
|
1467
1488
|
constructor(urlOrClient, credentialOrPipeline,
|
|
1468
1489
|
// Legacy, no way to fix the eslint error without breaking. Disable the rule for this line.
|
|
1469
1490
|
/* eslint-disable-next-line @azure/azure-sdk/ts-naming-options */
|
|
1470
|
-
options) {
|
|
1471
|
-
this.
|
|
1491
|
+
options, changeFeedClientOptions) {
|
|
1492
|
+
this.changeFeedClientOptions = changeFeedClientOptions || {};
|
|
1493
|
+
this.changeFeedFactory = new ChangeFeedFactory(this.changeFeedClientOptions.maximumTransferSize);
|
|
1472
1494
|
if (credentialOrPipeline instanceof storageBlob.Pipeline) {
|
|
1473
1495
|
this.blobServiceClient = new storageBlob.BlobServiceClient(urlOrClient, credentialOrPipeline);
|
|
1474
1496
|
}
|
|
@@ -1491,9 +1513,12 @@ class BlobChangeFeedClient {
|
|
|
1491
1513
|
static fromConnectionString(connectionString,
|
|
1492
1514
|
// Legacy, no way to fix the eslint error without breaking. Disable the rule for this line.
|
|
1493
1515
|
/* eslint-disable-next-line @azure/azure-sdk/ts-naming-options */
|
|
1494
|
-
options
|
|
1516
|
+
options,
|
|
1517
|
+
// Static method to construct an object, the option is for the object not for the method.
|
|
1518
|
+
/* eslint-disable-next-line @azure/azure-sdk/ts-naming-options */
|
|
1519
|
+
changeFeedClientOptions) {
|
|
1495
1520
|
const blobServiceClient = storageBlob.BlobServiceClient.fromConnectionString(connectionString, options);
|
|
1496
|
-
return new BlobChangeFeedClient(blobServiceClient.url, blobServiceClient.credential, appendUserAgentPrefix(options));
|
|
1521
|
+
return new BlobChangeFeedClient(blobServiceClient.url, blobServiceClient.credential, appendUserAgentPrefix(options), changeFeedClientOptions);
|
|
1497
1522
|
}
|
|
1498
1523
|
getChange(options = {}) {
|
|
1499
1524
|
return tslib.__asyncGenerator(this, arguments, function* getChange_1() {
|