@libp2p/utils 6.4.0-c1d0b7fa4 → 6.4.0
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.
|
@@ -1,30 +1,6 @@
|
|
|
1
1
|
import type { AbortOptions } from '@libp2p/interface';
|
|
2
2
|
export interface RepeatingTask {
|
|
3
|
-
/**
|
|
4
|
-
* Update the interval after which the next iteration of the task will run.
|
|
5
|
-
*
|
|
6
|
-
* This is useful if, for example, you want to retry a task with a short rest
|
|
7
|
-
* duration until it succeeds, then periodically after that.
|
|
8
|
-
*
|
|
9
|
-
* This only affects the next iteration of the task, if it is currently
|
|
10
|
-
* running, that run will not be interrupted.
|
|
11
|
-
*/
|
|
12
|
-
setInterval(ms: number): void;
|
|
13
|
-
/**
|
|
14
|
-
* Update the amount of time a task will run before the passed abort signal
|
|
15
|
-
* will fire.
|
|
16
|
-
*
|
|
17
|
-
* * This only affects the next iteration of the task, if it is currently
|
|
18
|
-
* running, that run will not be interrupted.
|
|
19
|
-
*/
|
|
20
|
-
setTimeout(ms: number): void;
|
|
21
|
-
/**
|
|
22
|
-
* Start the task running
|
|
23
|
-
*/
|
|
24
3
|
start(): void;
|
|
25
|
-
/**
|
|
26
|
-
* Stop the task running
|
|
27
|
-
*/
|
|
28
4
|
stop(): void;
|
|
29
5
|
}
|
|
30
6
|
export interface RepeatingTaskOptions {
|
|
@@ -35,8 +11,6 @@ export interface RepeatingTaskOptions {
|
|
|
35
11
|
timeout?: number;
|
|
36
12
|
/**
|
|
37
13
|
* Whether to schedule the task to run immediately
|
|
38
|
-
*
|
|
39
|
-
* @default false
|
|
40
14
|
*/
|
|
41
15
|
runImmediately?: boolean;
|
|
42
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repeating-task.d.ts","sourceRoot":"","sources":["../../src/repeating-task.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAErD,MAAM,WAAW,aAAa;IAC5B
|
|
1
|
+
{"version":3,"file":"repeating-task.d.ts","sourceRoot":"","sources":["../../src/repeating-task.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAErD,MAAM,WAAW,aAAa;IAC5B,KAAK,IAAI,IAAI,CAAA;IACb,IAAI,IAAI,IAAI,CAAA;CACb;AAED,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAEhB;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;CACzB;AAED,wBAAgB,aAAa,CAAE,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,YAAY,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,oBAAoB,GAAG,aAAa,CA2DpJ"}
|
|
@@ -27,20 +27,6 @@ export function repeatingTask(fn, interval, options) {
|
|
|
27
27
|
}
|
|
28
28
|
let started = false;
|
|
29
29
|
return {
|
|
30
|
-
setInterval: (ms) => {
|
|
31
|
-
interval = ms;
|
|
32
|
-
// maybe reschedule
|
|
33
|
-
if (timeout != null) {
|
|
34
|
-
clearTimeout(timeout);
|
|
35
|
-
timeout = setTimeout(runTask, interval);
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
setTimeout: (ms) => {
|
|
39
|
-
if (options == null) {
|
|
40
|
-
options = {};
|
|
41
|
-
}
|
|
42
|
-
options.timeout = ms;
|
|
43
|
-
},
|
|
44
30
|
start: () => {
|
|
45
31
|
if (started) {
|
|
46
32
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repeating-task.js","sourceRoot":"","sources":["../../src/repeating-task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"repeating-task.js","sourceRoot":"","sources":["../../src/repeating-task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAqBtC,MAAM,UAAU,aAAa,CAAE,EAAoD,EAAE,QAAgB,EAAE,OAA8B;IACnI,IAAI,OAAsC,CAAA;IAC1C,IAAI,kBAAmC,CAAA;IAEvC,SAAS,OAAO;QACd,MAAM,IAAI,GAAiB;YACzB,MAAM,EAAE,kBAAkB,CAAC,MAAM;SAClC,CAAA;QAED,IAAI,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,CAAC;YAC7B,MAAM,MAAM,GAAG,SAAS,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;YAC3F,eAAe,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;YAEjC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACtB,CAAC;QAED,OAAO,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE;YAChC,MAAM,EAAE,CAAC,IAAI,CAAC,CAAA;QAChB,CAAC,CAAC;aACC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC;aACf,OAAO,CAAC,GAAG,EAAE;YACZ,IAAI,kBAAkB,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;gBACtC,gCAAgC;gBAChC,OAAM;YACR,CAAC;YAED,aAAa;YACb,OAAO,GAAG,UAAU,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAA;QACzC,CAAC,CAAC,CAAA;IACN,CAAC;IAED,IAAI,OAAO,GAAG,KAAK,CAAA;IAEnB,OAAO;QACL,KAAK,EAAE,GAAG,EAAE;YACV,IAAI,OAAO,EAAE,CAAC;gBACZ,OAAM;YACR,CAAC;YAED,OAAO,GAAG,IAAI,CAAA;YACd,kBAAkB,GAAG,IAAI,eAAe,EAAE,CAAA;YAC1C,eAAe,CAAC,QAAQ,EAAE,kBAAkB,CAAC,MAAM,CAAC,CAAA;YAEpD,UAAU;YACV,IAAI,OAAO,EAAE,cAAc,KAAK,IAAI,EAAE,CAAC;gBACrC,cAAc,CAAC,GAAG,EAAE;oBAClB,OAAO,EAAE,CAAA;gBACX,CAAC,CAAC,CAAA;YACJ,CAAC;iBAAM,CAAC;gBACN,YAAY;gBACZ,OAAO,GAAG,UAAU,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAA;YACzC,CAAC;QACH,CAAC;QACD,IAAI,EAAE,GAAG,EAAE;YACT,YAAY,CAAC,OAAO,CAAC,CAAA;YACrB,kBAAkB,EAAE,KAAK,EAAE,CAAA;YAC3B,OAAO,GAAG,KAAK,CAAA;QACjB,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
{
|
|
2
|
+
"createTimeoutOptions": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.abort_options.createTimeoutOptions.html",
|
|
3
|
+
"./abort-options:createTimeoutOptions": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.abort_options.createTimeoutOptions.html",
|
|
4
|
+
"AbstractStream": "https://libp2p.github.io/js-libp2p/classes/_libp2p_utils.abstract_stream.AbstractStream.html",
|
|
5
|
+
"./abstract-stream:AbstractStream": "https://libp2p.github.io/js-libp2p/classes/_libp2p_utils.abstract_stream.AbstractStream.html",
|
|
6
|
+
"AbstractStreamInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.abstract_stream.AbstractStreamInit.html",
|
|
7
|
+
"./abstract-stream:AbstractStreamInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.abstract_stream.AbstractStreamInit.html",
|
|
8
|
+
"AdaptiveTimeout": "https://libp2p.github.io/js-libp2p/classes/_libp2p_utils.adaptive_timeout.AdaptiveTimeout.html",
|
|
9
|
+
"./adaptive-timeout:AdaptiveTimeout": "https://libp2p.github.io/js-libp2p/classes/_libp2p_utils.adaptive_timeout.AdaptiveTimeout.html",
|
|
10
|
+
"AdaptiveTimeoutInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.adaptive_timeout.AdaptiveTimeoutInit.html",
|
|
11
|
+
"./adaptive-timeout:AdaptiveTimeoutInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.adaptive_timeout.AdaptiveTimeoutInit.html",
|
|
12
|
+
"AdaptiveTimeoutSignal": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.adaptive_timeout.AdaptiveTimeoutSignal.html",
|
|
13
|
+
"./adaptive-timeout:AdaptiveTimeoutSignal": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.adaptive_timeout.AdaptiveTimeoutSignal.html",
|
|
14
|
+
"GetTimeoutSignalOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.adaptive_timeout.GetTimeoutSignalOptions.html",
|
|
15
|
+
"./adaptive-timeout:GetTimeoutSignalOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.adaptive_timeout.GetTimeoutSignalOptions.html",
|
|
16
|
+
"DEFAULT_FAILURE_MULTIPLIER": "https://libp2p.github.io/js-libp2p/variables/_libp2p_utils.adaptive_timeout.DEFAULT_FAILURE_MULTIPLIER.html",
|
|
17
|
+
"./adaptive-timeout:DEFAULT_FAILURE_MULTIPLIER": "https://libp2p.github.io/js-libp2p/variables/_libp2p_utils.adaptive_timeout.DEFAULT_FAILURE_MULTIPLIER.html",
|
|
18
|
+
"DEFAULT_MIN_TIMEOUT": "https://libp2p.github.io/js-libp2p/variables/_libp2p_utils.adaptive_timeout.DEFAULT_MIN_TIMEOUT.html",
|
|
19
|
+
"./adaptive-timeout:DEFAULT_MIN_TIMEOUT": "https://libp2p.github.io/js-libp2p/variables/_libp2p_utils.adaptive_timeout.DEFAULT_MIN_TIMEOUT.html",
|
|
20
|
+
"DEFAULT_TIMEOUT_MULTIPLIER": "https://libp2p.github.io/js-libp2p/variables/_libp2p_utils.adaptive_timeout.DEFAULT_TIMEOUT_MULTIPLIER.html",
|
|
21
|
+
"./adaptive-timeout:DEFAULT_TIMEOUT_MULTIPLIER": "https://libp2p.github.io/js-libp2p/variables/_libp2p_utils.adaptive_timeout.DEFAULT_TIMEOUT_MULTIPLIER.html",
|
|
22
|
+
"arrayEquals": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.array_equals.arrayEquals.html",
|
|
23
|
+
"./array-equals:arrayEquals": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.array_equals.arrayEquals.html",
|
|
24
|
+
"SafelyCloseConnectionOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.close.SafelyCloseConnectionOptions.html",
|
|
25
|
+
"./close:SafelyCloseConnectionOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.close.SafelyCloseConnectionOptions.html",
|
|
26
|
+
"safelyCloseConnectionIfUnused": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.close.safelyCloseConnectionIfUnused.html",
|
|
27
|
+
"./close:safelyCloseConnectionIfUnused": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.close.safelyCloseConnectionIfUnused.html",
|
|
28
|
+
"safelyCloseStream": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.close.safelyCloseStream.html",
|
|
29
|
+
"./close:safelyCloseStream": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.close.safelyCloseStream.html",
|
|
30
|
+
"closeSource": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.close_source.closeSource.html",
|
|
31
|
+
"./close-source:closeSource": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.close_source.closeSource.html",
|
|
32
|
+
"DebouncedFunction": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.debounce.DebouncedFunction.html",
|
|
33
|
+
"./debounce:DebouncedFunction": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.debounce.DebouncedFunction.html",
|
|
34
|
+
"debounce": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.debounce.debounce.html",
|
|
35
|
+
"./debounce:debounce": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.debounce.debounce.html",
|
|
36
|
+
"BloomFilter": "https://libp2p.github.io/js-libp2p/classes/_libp2p_utils.filters.BloomFilter.html",
|
|
37
|
+
"Bucket": "https://libp2p.github.io/js-libp2p/classes/_libp2p_utils.filters.Bucket.html",
|
|
38
|
+
"CuckooFilter": "https://libp2p.github.io/js-libp2p/classes/_libp2p_utils.filters.CuckooFilter.html",
|
|
39
|
+
"Fingerprint": "https://libp2p.github.io/js-libp2p/classes/_libp2p_utils.filters.Fingerprint.html",
|
|
40
|
+
"ScalableCuckooFilter": "https://libp2p.github.io/js-libp2p/classes/_libp2p_utils.filters.ScalableCuckooFilter.html",
|
|
41
|
+
"BloomFilterOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.filters.BloomFilterOptions.html",
|
|
42
|
+
"CuckooFilterInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.filters.CuckooFilterInit.html",
|
|
43
|
+
"Filter": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.filters.Filter.html",
|
|
44
|
+
"./filters:Filter": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.filters.Filter.html",
|
|
45
|
+
"Hash": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.filters.Hash.html",
|
|
46
|
+
"ScalableCuckooFilterInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.filters.ScalableCuckooFilterInit.html",
|
|
47
|
+
"createBloomFilter": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.filters.createBloomFilter.html",
|
|
48
|
+
"createCuckooFilter": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.filters.createCuckooFilter.html",
|
|
49
|
+
"createScalableCuckooFilter": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.filters.createScalableCuckooFilter.html",
|
|
50
|
+
"isGlobalUnicastIp": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.global_unicast_ip.isGlobalUnicastIp.html",
|
|
51
|
+
"./global-unicast-ip:isGlobalUnicastIp": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.global_unicast_ip.isGlobalUnicastIp.html",
|
|
52
|
+
"ipPortToMultiaddr": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.ip_port_to_multiaddr.ipPortToMultiaddr.html",
|
|
53
|
+
"./ip-port-to-multiaddr:ipPortToMultiaddr": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.ip_port_to_multiaddr.ipPortToMultiaddr.html",
|
|
54
|
+
"isAsyncGenerator": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.is_async_generator.isAsyncGenerator.html",
|
|
55
|
+
"./is-async-generator:isAsyncGenerator": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.is_async_generator.isAsyncGenerator.html",
|
|
56
|
+
"isGenerator": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.is_generator.isGenerator.html",
|
|
57
|
+
"./is-generator:isGenerator": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.is_generator.isGenerator.html",
|
|
58
|
+
"isPromise": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.is_promise.isPromise.html",
|
|
59
|
+
"./is-promise:isPromise": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.is_promise.isPromise.html",
|
|
60
|
+
"isLinkLocalIp": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.link_local_ip.isLinkLocalIp.html",
|
|
61
|
+
"./link-local-ip:isLinkLocalIp": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.link_local_ip.isLinkLocalIp.html",
|
|
62
|
+
"MovingAverage": "https://libp2p.github.io/js-libp2p/classes/_libp2p_utils.moving_average.MovingAverage.html",
|
|
63
|
+
"./moving-average:MovingAverage": "https://libp2p.github.io/js-libp2p/classes/_libp2p_utils.moving_average.MovingAverage.html",
|
|
64
|
+
"isGlobalUnicast": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.multiaddr_is_global_unicast.isGlobalUnicast.html",
|
|
65
|
+
"./multiaddr/is-global-unicast:isGlobalUnicast": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.multiaddr_is_global_unicast.isGlobalUnicast.html",
|
|
66
|
+
"isLinkLocal": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.multiaddr_is_link_local.isLinkLocal.html",
|
|
67
|
+
"./multiaddr/is-link-local:isLinkLocal": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.multiaddr_is_link_local.isLinkLocal.html",
|
|
68
|
+
"isLoopback": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.multiaddr_is_loopback.isLoopback.html",
|
|
69
|
+
"./multiaddr/is-loopback:isLoopback": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.multiaddr_is_loopback.isLoopback.html",
|
|
70
|
+
"isPrivate": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.multiaddr_is_private.isPrivate.html",
|
|
71
|
+
"./multiaddr/is-private:isPrivate": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.multiaddr_is_private.isPrivate.html",
|
|
72
|
+
"PeerQueue": "https://libp2p.github.io/js-libp2p/classes/_libp2p_utils.peer_queue.PeerQueue.html",
|
|
73
|
+
"./peer-queue:PeerQueue": "https://libp2p.github.io/js-libp2p/classes/_libp2p_utils.peer_queue.PeerQueue.html",
|
|
74
|
+
"PeerQueueJobOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.peer_queue.PeerQueueJobOptions.html",
|
|
75
|
+
"./peer-queue:PeerQueueJobOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.peer_queue.PeerQueueJobOptions.html",
|
|
76
|
+
"PriorityQueue": "https://libp2p.github.io/js-libp2p/classes/_libp2p_utils.priority_queue.PriorityQueue.html",
|
|
77
|
+
"./priority-queue:PriorityQueue": "https://libp2p.github.io/js-libp2p/classes/_libp2p_utils.priority_queue.PriorityQueue.html",
|
|
78
|
+
"PriorityQueueJobOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.priority_queue.PriorityQueueJobOptions.html",
|
|
79
|
+
"./priority-queue:PriorityQueueJobOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.priority_queue.PriorityQueueJobOptions.html",
|
|
80
|
+
"isPrivateIp": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.private_ip.isPrivateIp.html",
|
|
81
|
+
"./private-ip:isPrivateIp": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.private_ip.isPrivateIp.html",
|
|
82
|
+
"Job": "https://libp2p.github.io/js-libp2p/classes/_libp2p_utils.queue.Job.html",
|
|
83
|
+
"JobRecipient": "https://libp2p.github.io/js-libp2p/classes/_libp2p_utils.queue.JobRecipient.html",
|
|
84
|
+
"Queue": "https://libp2p.github.io/js-libp2p/classes/_libp2p_utils.queue.Queue.html",
|
|
85
|
+
"./queue:Queue": "https://libp2p.github.io/js-libp2p/classes/_libp2p_utils.queue.Queue.html",
|
|
86
|
+
"Comparator": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.queue.Comparator.html",
|
|
87
|
+
"./queue:Comparator": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.queue.Comparator.html",
|
|
88
|
+
"JobMatcher": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.queue.JobMatcher.html",
|
|
89
|
+
"./queue:JobMatcher": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.queue.JobMatcher.html",
|
|
90
|
+
"JobTimeline": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.queue.JobTimeline.html",
|
|
91
|
+
"QueueEvents": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.queue.QueueEvents.html",
|
|
92
|
+
"./queue:QueueEvents": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.queue.QueueEvents.html",
|
|
93
|
+
"QueueInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.queue.QueueInit.html",
|
|
94
|
+
"./queue:QueueInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.queue.QueueInit.html",
|
|
95
|
+
"QueueJobFailure": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.queue.QueueJobFailure.html",
|
|
96
|
+
"./queue:QueueJobFailure": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.queue.QueueJobFailure.html",
|
|
97
|
+
"QueueJobSuccess": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.queue.QueueJobSuccess.html",
|
|
98
|
+
"./queue:QueueJobSuccess": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.queue.QueueJobSuccess.html",
|
|
99
|
+
"RunFunction": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.queue.RunFunction.html",
|
|
100
|
+
"./queue:RunFunction": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.queue.RunFunction.html",
|
|
101
|
+
"JobStatus": "https://libp2p.github.io/js-libp2p/types/_libp2p_utils.queue.JobStatus.html",
|
|
102
|
+
"./queue:JobStatus": "https://libp2p.github.io/js-libp2p/types/_libp2p_utils.queue.JobStatus.html",
|
|
103
|
+
"MemoryStorage": "https://libp2p.github.io/js-libp2p/classes/_libp2p_utils.rate_limiter.MemoryStorage.html",
|
|
104
|
+
"./rate-limiter:MemoryStorage": "https://libp2p.github.io/js-libp2p/classes/_libp2p_utils.rate_limiter.MemoryStorage.html",
|
|
105
|
+
"RateLimiter": "https://libp2p.github.io/js-libp2p/classes/_libp2p_utils.rate_limiter.RateLimiter.html",
|
|
106
|
+
"./rate-limiter:RateLimiter": "https://libp2p.github.io/js-libp2p/classes/_libp2p_utils.rate_limiter.RateLimiter.html",
|
|
107
|
+
"GetKeySecDurationOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.rate_limiter.GetKeySecDurationOptions.html",
|
|
108
|
+
"./rate-limiter:GetKeySecDurationOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.rate_limiter.GetKeySecDurationOptions.html",
|
|
109
|
+
"RateLimiterInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.rate_limiter.RateLimiterInit.html",
|
|
110
|
+
"./rate-limiter:RateLimiterInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.rate_limiter.RateLimiterInit.html",
|
|
111
|
+
"RateLimiterResult": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.rate_limiter.RateLimiterResult.html",
|
|
112
|
+
"./rate-limiter:RateLimiterResult": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.rate_limiter.RateLimiterResult.html",
|
|
113
|
+
"RateRecord": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.rate_limiter.RateRecord.html",
|
|
114
|
+
"./rate-limiter:RateRecord": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.rate_limiter.RateRecord.html",
|
|
115
|
+
"RepeatingTask": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.repeating_task.RepeatingTask.html",
|
|
116
|
+
"./repeating-task:RepeatingTask": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.repeating_task.RepeatingTask.html",
|
|
117
|
+
"RepeatingTaskOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.repeating_task.RepeatingTaskOptions.html",
|
|
118
|
+
"./repeating-task:RepeatingTaskOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.repeating_task.RepeatingTaskOptions.html",
|
|
119
|
+
"repeatingTask": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.repeating_task.repeatingTask-1.html",
|
|
120
|
+
"./repeating-task:repeatingTask": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.repeating_task.repeatingTask-1.html",
|
|
121
|
+
"StreamProperties": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.stream_to_ma_conn.StreamProperties.html",
|
|
122
|
+
"./stream-to-ma-conn:StreamProperties": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.stream_to_ma_conn.StreamProperties.html",
|
|
123
|
+
"streamToMaConnection": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.stream_to_ma_conn.streamToMaConnection.html",
|
|
124
|
+
"./stream-to-ma-conn:streamToMaConnection": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.stream_to_ma_conn.streamToMaConnection.html",
|
|
125
|
+
"CreateTrackedListInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.tracked_list.CreateTrackedListInit.html",
|
|
126
|
+
"./tracked-list:CreateTrackedListInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.tracked_list.CreateTrackedListInit.html",
|
|
127
|
+
"trackedList": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.tracked_list.trackedList.html",
|
|
128
|
+
"./tracked-list:trackedList": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.tracked_list.trackedList.html",
|
|
129
|
+
"CreateTrackedMapInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.tracked_map.CreateTrackedMapInit.html",
|
|
130
|
+
"./tracked-map:CreateTrackedMapInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.tracked_map.CreateTrackedMapInit.html",
|
|
131
|
+
"TrackedMapInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.tracked_map.TrackedMapInit.html",
|
|
132
|
+
"./tracked-map:TrackedMapInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.tracked_map.TrackedMapInit.html",
|
|
133
|
+
"trackedMap": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.tracked_map.trackedMap.html",
|
|
134
|
+
"./tracked-map:trackedMap": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.tracked_map.trackedMap.html"
|
|
135
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@libp2p/utils",
|
|
3
|
-
"version": "6.4.0
|
|
3
|
+
"version": "6.4.0",
|
|
4
4
|
"description": "Package to aggregate shared logic and dependencies for the libp2p ecosystem",
|
|
5
5
|
"license": "Apache-2.0 OR MIT",
|
|
6
6
|
"homepage": "https://github.com/libp2p/js-libp2p/tree/main/packages/utils#readme",
|
|
@@ -181,9 +181,9 @@
|
|
|
181
181
|
"dependencies": {
|
|
182
182
|
"@chainsafe/is-ip": "^2.0.2",
|
|
183
183
|
"@chainsafe/netmask": "^2.0.0",
|
|
184
|
-
"@libp2p/crypto": "5.0.10
|
|
185
|
-
"@libp2p/interface": "2.4.1
|
|
186
|
-
"@libp2p/logger": "5.1.7
|
|
184
|
+
"@libp2p/crypto": "^5.0.10",
|
|
185
|
+
"@libp2p/interface": "^2.4.1",
|
|
186
|
+
"@libp2p/logger": "^5.1.7",
|
|
187
187
|
"@multiformats/multiaddr": "^12.3.3",
|
|
188
188
|
"@sindresorhus/fnv1a": "^3.1.0",
|
|
189
189
|
"@types/murmurhash3js-revisited": "^3.0.3",
|
|
@@ -204,7 +204,7 @@
|
|
|
204
204
|
"uint8arrays": "^5.1.0"
|
|
205
205
|
},
|
|
206
206
|
"devDependencies": {
|
|
207
|
-
"@libp2p/peer-id": "5.0.11
|
|
207
|
+
"@libp2p/peer-id": "^5.0.11",
|
|
208
208
|
"@types/netmask": "^2.0.5",
|
|
209
209
|
"aegir": "^45.0.5",
|
|
210
210
|
"benchmark": "^2.1.4",
|
package/src/repeating-task.ts
CHANGED
|
@@ -3,34 +3,7 @@ import { anySignal } from 'any-signal'
|
|
|
3
3
|
import type { AbortOptions } from '@libp2p/interface'
|
|
4
4
|
|
|
5
5
|
export interface RepeatingTask {
|
|
6
|
-
/**
|
|
7
|
-
* Update the interval after which the next iteration of the task will run.
|
|
8
|
-
*
|
|
9
|
-
* This is useful if, for example, you want to retry a task with a short rest
|
|
10
|
-
* duration until it succeeds, then periodically after that.
|
|
11
|
-
*
|
|
12
|
-
* This only affects the next iteration of the task, if it is currently
|
|
13
|
-
* running, that run will not be interrupted.
|
|
14
|
-
*/
|
|
15
|
-
setInterval(ms: number): void
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Update the amount of time a task will run before the passed abort signal
|
|
19
|
-
* will fire.
|
|
20
|
-
*
|
|
21
|
-
* * This only affects the next iteration of the task, if it is currently
|
|
22
|
-
* running, that run will not be interrupted.
|
|
23
|
-
*/
|
|
24
|
-
setTimeout(ms: number): void
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Start the task running
|
|
28
|
-
*/
|
|
29
6
|
start(): void
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Stop the task running
|
|
33
|
-
*/
|
|
34
7
|
stop(): void
|
|
35
8
|
}
|
|
36
9
|
|
|
@@ -43,8 +16,6 @@ export interface RepeatingTaskOptions {
|
|
|
43
16
|
|
|
44
17
|
/**
|
|
45
18
|
* Whether to schedule the task to run immediately
|
|
46
|
-
*
|
|
47
|
-
* @default false
|
|
48
19
|
*/
|
|
49
20
|
runImmediately?: boolean
|
|
50
21
|
}
|
|
@@ -83,22 +54,6 @@ export function repeatingTask (fn: (options?: AbortOptions) => void | Promise<vo
|
|
|
83
54
|
let started = false
|
|
84
55
|
|
|
85
56
|
return {
|
|
86
|
-
setInterval: (ms) => {
|
|
87
|
-
interval = ms
|
|
88
|
-
|
|
89
|
-
// maybe reschedule
|
|
90
|
-
if (timeout != null) {
|
|
91
|
-
clearTimeout(timeout)
|
|
92
|
-
timeout = setTimeout(runTask, interval)
|
|
93
|
-
}
|
|
94
|
-
},
|
|
95
|
-
setTimeout: (ms) => {
|
|
96
|
-
if (options == null) {
|
|
97
|
-
options = {}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
options.timeout = ms
|
|
101
|
-
},
|
|
102
57
|
start: () => {
|
|
103
58
|
if (started) {
|
|
104
59
|
return
|