aspect-sync 0.1.10 → 0.1.12
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/README.md +8 -6
- package/dist/index.js +10 -169
- package/package.json +11 -7
- package/dist/batchManager.d.ts +0 -21
- package/dist/batchManager.d.ts.map +0 -1
- package/dist/batchManager.js +0 -121
- package/dist/batchManager.js.map +0 -1
- package/dist/cliDisplay.d.ts +0 -9
- package/dist/cliDisplay.d.ts.map +0 -1
- package/dist/cliDisplay.js +0 -302
- package/dist/cliDisplay.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lib/weightedAsyncQueue.d.ts +0 -153
- package/dist/lib/weightedAsyncQueue.d.ts.map +0 -1
- package/dist/lib/weightedAsyncQueue.js +0 -322
- package/dist/lib/weightedAsyncQueue.js.map +0 -1
- package/dist/rclone.d.ts +0 -28
- package/dist/rclone.d.ts.map +0 -1
- package/dist/rclone.js +0 -397
- package/dist/rclone.js.map +0 -1
- package/dist/statusTracker.d.ts +0 -46
- package/dist/statusTracker.d.ts.map +0 -1
- package/dist/statusTracker.js +0 -272
- package/dist/statusTracker.js.map +0 -1
- package/dist/sync.d.ts +0 -9
- package/dist/sync.d.ts.map +0 -1
- package/dist/sync.js +0 -529
- package/dist/sync.js.map +0 -1
- package/dist/types.d.ts +0 -135
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -18
- package/dist/types.js.map +0 -1
- package/dist/uploader.d.ts +0 -7
- package/dist/uploader.d.ts.map +0 -1
- package/dist/uploader.js +0 -203
- package/dist/uploader.js.map +0 -1
- package/dist/util.d.ts +0 -4
- package/dist/util.d.ts.map +0 -1
- package/dist/util.js +0 -41
- package/dist/util.js.map +0 -1
|
@@ -1,322 +0,0 @@
|
|
|
1
|
-
import { v4 as uuidv4 } from "uuid";
|
|
2
|
-
const generateUUID = () => uuidv4();
|
|
3
|
-
/**
|
|
4
|
-
* WeightedAsyncQueue - A concurrency queue that manages tasks with weighted costs
|
|
5
|
-
*
|
|
6
|
-
* ## Overview
|
|
7
|
-
*
|
|
8
|
-
* This queue allows you to enqueue tasks with different "weights" (point costs). The queue
|
|
9
|
-
* has a maximum concurrency limit (e.g., 4 points), and tasks compete for these points.
|
|
10
|
-
*
|
|
11
|
-
* ## How It Works
|
|
12
|
-
*
|
|
13
|
-
* 1. **Starting tasks**: When you enqueue a task with a certain weight, it will start running
|
|
14
|
-
* as soon as at least 1 point is available in the global pool. The task reserves its full
|
|
15
|
-
* weight from the pool immediately upon starting.
|
|
16
|
-
*
|
|
17
|
-
* 2. **Managing concurrency within tasks**: Once a task starts, it can use the `acquire()`
|
|
18
|
-
* method to control how many of its reserved points are actively being used at once. This
|
|
19
|
-
* is useful for tasks that have multiple subtasks (like uploading file chunks) that need
|
|
20
|
-
* to run with controlled concurrency.
|
|
21
|
-
*
|
|
22
|
-
* 3. **Releasing points**: When a subtask completes, call `release()` to free that point back
|
|
23
|
-
* to the global pool. This makes it available for other tasks waiting in the queue, or for
|
|
24
|
-
* other subtasks within the same task.
|
|
25
|
-
*
|
|
26
|
-
* 4. **Automatic cleanup**: If a task finishes without calling `release()` for all its points,
|
|
27
|
-
* any unreleased points are automatically freed back to the global pool.
|
|
28
|
-
*
|
|
29
|
-
* 5. **Simple tasks**: For single-point tasks that don't need internal concurrency management,
|
|
30
|
-
* you don't need to call `acquire()` or `release()` at all. Just do your work, and when
|
|
31
|
-
* the task completes, its point will be automatically released.
|
|
32
|
-
*
|
|
33
|
-
* ## Example Usage
|
|
34
|
-
*
|
|
35
|
-
* ```typescript
|
|
36
|
-
* const queue = new WeightedAsyncQueue({ maxConcurrency: 4 })
|
|
37
|
-
*
|
|
38
|
-
* // Simple single-point upload (no acquire/release needed)
|
|
39
|
-
* queue.enqueue(1, async (controller) => {
|
|
40
|
-
* await uploadFile(file)
|
|
41
|
-
* // Point automatically released when task completes
|
|
42
|
-
* })
|
|
43
|
-
*
|
|
44
|
-
* // Multi-part upload with 3 chunks (uses acquire/release)
|
|
45
|
-
* queue.enqueue(3, async (controller) => {
|
|
46
|
-
* for (const chunk of chunks) {
|
|
47
|
-
* await controller.acquire() // Wait for a point to be available
|
|
48
|
-
* uploadChunk(chunk).then(() => controller.release()) // Free the point when done
|
|
49
|
-
* }
|
|
50
|
-
* })
|
|
51
|
-
* ```
|
|
52
|
-
*
|
|
53
|
-
* ## Key Benefits
|
|
54
|
-
*
|
|
55
|
-
* - Tasks with high weights can run subtasks with controlled concurrency
|
|
56
|
-
* - Simple tasks don't need to worry about point management
|
|
57
|
-
* - Automatic cleanup prevents point leaks when tasks error or are cancelled
|
|
58
|
-
*/
|
|
59
|
-
export class WeightedTaskController {
|
|
60
|
-
#taskWeight;
|
|
61
|
-
#queue;
|
|
62
|
-
#pointsLeftToRun;
|
|
63
|
-
#unreleasedPoints;
|
|
64
|
-
#concurrentPoints;
|
|
65
|
-
#calledAcquire = false;
|
|
66
|
-
#waitingInternalRequests = [];
|
|
67
|
-
#releaseGlobalPoints;
|
|
68
|
-
#acquireGlobalConcurrentPoints;
|
|
69
|
-
constructor({ taskWeight, queue, releaseGlobalPoints, acquireGlobalConcurrentPoints, }) {
|
|
70
|
-
this.#taskWeight = taskWeight;
|
|
71
|
-
this.#queue = queue;
|
|
72
|
-
this.#releaseGlobalPoints = releaseGlobalPoints;
|
|
73
|
-
this.#acquireGlobalConcurrentPoints = acquireGlobalConcurrentPoints;
|
|
74
|
-
this.#pointsLeftToRun = taskWeight;
|
|
75
|
-
this.#unreleasedPoints = taskWeight;
|
|
76
|
-
this.#concurrentPoints = 0;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Acquire points internally (doesn't affect global pool, just manages internal concurrency)
|
|
80
|
-
* Blocks if would exceed task's weight.
|
|
81
|
-
*/
|
|
82
|
-
async acquire() {
|
|
83
|
-
this.#calledAcquire = true;
|
|
84
|
-
// Check if we have internal capacity
|
|
85
|
-
if (this.#pointsLeftToRun === this.#taskWeight || this.#queue.getStats().availablePoints > 0) {
|
|
86
|
-
if (this.#pointsLeftToRun !== this.#taskWeight) {
|
|
87
|
-
this.#acquireGlobalConcurrentPoints(1);
|
|
88
|
-
}
|
|
89
|
-
this.#pointsLeftToRun -= 1;
|
|
90
|
-
this.#concurrentPoints += 1;
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
// Wait for internal capacity
|
|
94
|
-
await new Promise((resolve) => {
|
|
95
|
-
this.#waitingInternalRequests.push({ resolve });
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Release points internally
|
|
100
|
-
*/
|
|
101
|
-
release() {
|
|
102
|
-
this.#releaseGlobalPoints(1);
|
|
103
|
-
this.#unreleasedPoints -= 1;
|
|
104
|
-
this.#concurrentPoints -= 1;
|
|
105
|
-
// Check if any waiting internal requests can now proceed
|
|
106
|
-
this._processWaitingInternalRequests();
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Process waiting internal requests
|
|
110
|
-
*/
|
|
111
|
-
_processWaitingInternalRequests() {
|
|
112
|
-
let index = 0;
|
|
113
|
-
while (index < this.#waitingInternalRequests.length) {
|
|
114
|
-
const request = this.#waitingInternalRequests[index];
|
|
115
|
-
if (this.#queue.getStats().availablePoints > 0) {
|
|
116
|
-
this.#waitingInternalRequests.splice(index, 1);
|
|
117
|
-
this.#pointsLeftToRun -= 1;
|
|
118
|
-
this.#concurrentPoints += 1;
|
|
119
|
-
this.#acquireGlobalConcurrentPoints(1);
|
|
120
|
-
request.resolve();
|
|
121
|
-
}
|
|
122
|
-
else {
|
|
123
|
-
index++;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* Get task weight
|
|
129
|
-
*/
|
|
130
|
-
getTaskWeight() {
|
|
131
|
-
return this.#taskWeight;
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* Get unreleased points
|
|
135
|
-
*/
|
|
136
|
-
getUnreleasedPoints() {
|
|
137
|
-
return this.#unreleasedPoints;
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* Get concurrent points
|
|
141
|
-
*/
|
|
142
|
-
getConcurrentPoints() {
|
|
143
|
-
if (this.#calledAcquire) {
|
|
144
|
-
return this.#concurrentPoints;
|
|
145
|
-
}
|
|
146
|
-
return 1;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
/**
|
|
150
|
-
* WeightedAsyncQueue manages concurrent execution of async tasks with weighted concurrency.
|
|
151
|
-
*
|
|
152
|
-
* Simple model:
|
|
153
|
-
* - When a task starts, it reserves its full weight from the global pool
|
|
154
|
-
* - When a task ends, it releases its full weight back to the global pool
|
|
155
|
-
* - Tasks use acquire/release ONLY for internal concurrency management (doesn't affect global pool)
|
|
156
|
-
*/
|
|
157
|
-
export class WeightedAsyncQueue {
|
|
158
|
-
#maxConcurrency;
|
|
159
|
-
#onTaskComplete;
|
|
160
|
-
#onTaskError;
|
|
161
|
-
#onQueueEmpty;
|
|
162
|
-
#taskQueue = [];
|
|
163
|
-
#runningTasks = new Set();
|
|
164
|
-
#allocatedPoints = 0; // number of points allocated to running tasks (can be > maxConcurrency)
|
|
165
|
-
#concurrentPoints = 0; // number of points currently being used by running tasks (cannot be > maxConcurrency)
|
|
166
|
-
#totalProcessed = 0;
|
|
167
|
-
#totalFailed = 0;
|
|
168
|
-
#isDestroyed = false;
|
|
169
|
-
#controllers = new Set();
|
|
170
|
-
constructor(options) {
|
|
171
|
-
this.#maxConcurrency = Math.max(1, options.maxConcurrency);
|
|
172
|
-
this.#onTaskComplete = options.onTaskComplete;
|
|
173
|
-
this.#onTaskError = options.onTaskError;
|
|
174
|
-
this.#onQueueEmpty = options.onQueueEmpty;
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* Add a weighted task to the queue
|
|
178
|
-
*/
|
|
179
|
-
async enqueue(weight, taskFunction, taskId = this.#generateTaskId()) {
|
|
180
|
-
if (this.#isDestroyed) {
|
|
181
|
-
throw new Error('WeightedAsyncQueue has been destroyed and cannot accept new tasks');
|
|
182
|
-
}
|
|
183
|
-
if (weight <= 0) {
|
|
184
|
-
throw new Error('Task weight must be positive');
|
|
185
|
-
}
|
|
186
|
-
return new Promise((resolve, reject) => {
|
|
187
|
-
const task = {
|
|
188
|
-
taskFunction: taskFunction,
|
|
189
|
-
weight,
|
|
190
|
-
taskId,
|
|
191
|
-
resolve: resolve,
|
|
192
|
-
reject,
|
|
193
|
-
};
|
|
194
|
-
this.#taskQueue.push(task);
|
|
195
|
-
this.#processQueue();
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
|
-
/**
|
|
199
|
-
* Get current queue statistics
|
|
200
|
-
*/
|
|
201
|
-
getStats() {
|
|
202
|
-
return {
|
|
203
|
-
queuedTasks: this.#taskQueue.length,
|
|
204
|
-
runningTasks: this.#runningTasks.size,
|
|
205
|
-
allocatedPoints: this.#allocatedPoints,
|
|
206
|
-
concurrentPoints: this.#concurrentPoints,
|
|
207
|
-
availablePoints: Math.max(0, this.#maxConcurrency - this.#concurrentPoints),
|
|
208
|
-
totalProcessed: this.#totalProcessed,
|
|
209
|
-
totalFailed: this.#totalFailed,
|
|
210
|
-
};
|
|
211
|
-
}
|
|
212
|
-
/**
|
|
213
|
-
* Check if the queue is currently processing any tasks
|
|
214
|
-
*/
|
|
215
|
-
isActive() {
|
|
216
|
-
return this.#taskQueue.length > 0 || this.#runningTasks.size > 0;
|
|
217
|
-
}
|
|
218
|
-
/**
|
|
219
|
-
* Clear all pending tasks from the queue (does not stop running tasks)
|
|
220
|
-
*/
|
|
221
|
-
clearPendingTasks() {
|
|
222
|
-
const clearedTasksCount = this.#taskQueue.length;
|
|
223
|
-
// Reject all pending tasks
|
|
224
|
-
// this.#taskQueue.forEach((task) => {
|
|
225
|
-
// task.reject(new Error('Task was cleared from queue'))
|
|
226
|
-
// })
|
|
227
|
-
this.#taskQueue = [];
|
|
228
|
-
return clearedTasksCount;
|
|
229
|
-
}
|
|
230
|
-
/**
|
|
231
|
-
* Cancel a task by its ID
|
|
232
|
-
*/
|
|
233
|
-
cancelTask(taskId) {
|
|
234
|
-
this.#taskQueue = this.#taskQueue.filter((task) => task.taskId !== taskId);
|
|
235
|
-
}
|
|
236
|
-
/**
|
|
237
|
-
* Destroy the queue and reject all pending tasks
|
|
238
|
-
*/
|
|
239
|
-
destroy() {
|
|
240
|
-
this.#isDestroyed = true;
|
|
241
|
-
this.clearPendingTasks();
|
|
242
|
-
}
|
|
243
|
-
/**
|
|
244
|
-
* Process tasks from the queue based on available capacity
|
|
245
|
-
*/
|
|
246
|
-
#processQueue() {
|
|
247
|
-
if (this.#isDestroyed) {
|
|
248
|
-
return;
|
|
249
|
-
}
|
|
250
|
-
// Try to start as many tasks as possible
|
|
251
|
-
while (this.#taskQueue.length > 0) {
|
|
252
|
-
const task = this.#taskQueue[0];
|
|
253
|
-
// Check if we have enough capacity for this task's weight
|
|
254
|
-
if (this.#allocatedPoints < this.#maxConcurrency) {
|
|
255
|
-
// Reserve the points and start the task
|
|
256
|
-
this.#allocatedPoints += task.weight;
|
|
257
|
-
this.#concurrentPoints += 1;
|
|
258
|
-
this.#taskQueue.shift();
|
|
259
|
-
this.#executeTask(task);
|
|
260
|
-
}
|
|
261
|
-
else {
|
|
262
|
-
// Not enough capacity, stop trying
|
|
263
|
-
break;
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
// Check if queue is now empty
|
|
267
|
-
if (this.#taskQueue.length === 0 && this.#runningTasks.size === 0) {
|
|
268
|
-
this.#onQueueEmpty?.();
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
/**
|
|
272
|
-
* Execute a single weighted task and handle its completion
|
|
273
|
-
*/
|
|
274
|
-
async #executeTask(task) {
|
|
275
|
-
this.#runningTasks.add(task.taskId);
|
|
276
|
-
const controller = new WeightedTaskController({
|
|
277
|
-
taskWeight: task.weight,
|
|
278
|
-
queue: this,
|
|
279
|
-
releaseGlobalPoints: (points) => {
|
|
280
|
-
this.#allocatedPoints -= points;
|
|
281
|
-
this.#concurrentPoints -= points;
|
|
282
|
-
this.#processQueue();
|
|
283
|
-
},
|
|
284
|
-
acquireGlobalConcurrentPoints: (points) => {
|
|
285
|
-
this.#concurrentPoints += points;
|
|
286
|
-
}
|
|
287
|
-
});
|
|
288
|
-
this.#controllers.add(controller);
|
|
289
|
-
try {
|
|
290
|
-
const result = await task.taskFunction(controller);
|
|
291
|
-
task.resolve(result);
|
|
292
|
-
this.#totalProcessed++;
|
|
293
|
-
this.#onTaskComplete?.(task.taskId, result);
|
|
294
|
-
}
|
|
295
|
-
catch (error) {
|
|
296
|
-
task.reject(error);
|
|
297
|
-
this.#totalFailed++;
|
|
298
|
-
this.#onTaskError?.(task.taskId, error);
|
|
299
|
-
}
|
|
300
|
-
finally {
|
|
301
|
-
// Release the task's reserved weight back to the pool
|
|
302
|
-
this.#allocatedPoints -= controller.getUnreleasedPoints();
|
|
303
|
-
this.#concurrentPoints -= controller.getConcurrentPoints();
|
|
304
|
-
this.#controllers.delete(controller);
|
|
305
|
-
// Clean up
|
|
306
|
-
this.#runningTasks.delete(task.taskId);
|
|
307
|
-
// Try to start more tasks
|
|
308
|
-
this.#processQueue();
|
|
309
|
-
// ping subtasks as well
|
|
310
|
-
this.#controllers.forEach((controller) => {
|
|
311
|
-
controller._processWaitingInternalRequests();
|
|
312
|
-
});
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
/**
|
|
316
|
-
* Generate a unique task ID
|
|
317
|
-
*/
|
|
318
|
-
#generateTaskId() {
|
|
319
|
-
return generateUUID();
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
//# sourceMappingURL=weightedAsyncQueue.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"weightedAsyncQueue.js","sourceRoot":"","sources":["../../src/lib/weightedAsyncQueue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM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,CAAC,CAAC,CAAA;QACJ,CAAC;IACH,CAAC;IAED;;OAEG;IACH,eAAe;QACb,OAAO,YAAY,EAAE,CAAA;IACvB,CAAC;CACF"}
|
package/dist/rclone.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { RcloneOptions, DownloadProgress } from "./types.js";
|
|
2
|
-
export declare class RcloneError extends Error {
|
|
3
|
-
readonly stderr: string;
|
|
4
|
-
constructor(message: string, stderr: string);
|
|
5
|
-
}
|
|
6
|
-
export declare function checkRcloneInstalled(): Promise<void>;
|
|
7
|
-
export declare function syncFromRemote(remote: string, remotePath: string, localPath: string, options: RcloneOptions): Promise<void>;
|
|
8
|
-
export declare function syncFromRemoteWithFiles(remote: string, remotePath: string, localPath: string, batchFilePath: string, options: RcloneOptions, onProgress?: (progress: DownloadProgress) => void): Promise<void>;
|
|
9
|
-
export declare function listRemoteFiles(remote: string, remotePath: string): Promise<string[]>;
|
|
10
|
-
export interface LocalFileInfo {
|
|
11
|
-
relativePath: string;
|
|
12
|
-
absolutePath: string;
|
|
13
|
-
fileName: string;
|
|
14
|
-
size: number;
|
|
15
|
-
}
|
|
16
|
-
export interface ScanResult {
|
|
17
|
-
files: LocalFileInfo[];
|
|
18
|
-
directoryCount: number;
|
|
19
|
-
}
|
|
20
|
-
export interface RemoteFileListing {
|
|
21
|
-
path: string;
|
|
22
|
-
size: number;
|
|
23
|
-
}
|
|
24
|
-
export declare function listRemoteFilesWithSize(remote: string, remotePath: string, extraArgs?: string[]): Promise<RemoteFileListing[]>;
|
|
25
|
-
export declare function scanLocalDirectory(localPath: string): Promise<ScanResult>;
|
|
26
|
-
export declare function deleteLocalFile(filePath: string): Promise<void>;
|
|
27
|
-
export declare function deleteEmptyDirectories(rootPath: string): Promise<void>;
|
|
28
|
-
//# sourceMappingURL=rclone.d.ts.map
|
package/dist/rclone.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rclone.d.ts","sourceRoot":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