@lat-murmeldjur/weeb_3 0.0.337001 → 0.0.339001
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/package.json +1 -1
- package/service.js +34 -7
- package/weeb_3.d.ts +5 -5
- package/weeb_3.js +23 -23
- package/weeb_3_bg.wasm +0 -0
- package/weeb_3_bg.wasm.d.ts +5 -5
package/package.json
CHANGED
package/service.js
CHANGED
|
@@ -9,15 +9,17 @@ const RAW_ROUTE_KINDS = [
|
|
|
9
9
|
["chunks", "chunk"]
|
|
10
10
|
];
|
|
11
11
|
const FETCH_TIMEOUT_MS = 240000;
|
|
12
|
-
const SERVICE_WORKER_MARKER = "forwarder-
|
|
12
|
+
const SERVICE_WORKER_MARKER = "forwarder-default28";
|
|
13
13
|
const SERVICE_WORKER_PROTOCOL = 10;
|
|
14
14
|
const MIB_BYTES = 1024 * 1024;
|
|
15
15
|
const STREAM_STORAGE_WINDOW_BYTES = MIB_BYTES / 2;
|
|
16
16
|
const STREAM_LOOKAHEAD_CHUNKS = 8;
|
|
17
17
|
const HLS_STREAM_WINDOW_BYTES = MIB_BYTES / 2;
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const
|
|
18
|
+
const HLS_STREAM_INITIAL_LOOKAHEAD_CHUNKS = 1;
|
|
19
|
+
const HLS_STREAM_LOOKAHEAD_CHUNKS = 4;
|
|
20
|
+
const HLS_LIVE_STREAM_WINDOW_BYTES = MIB_BYTES / 2;
|
|
21
|
+
const HLS_LIVE_STREAM_LOOKAHEAD_CHUNKS = 4;
|
|
22
|
+
const RANGE_REQUEST_FLIGHTS = new Map();
|
|
21
23
|
const CLIENT_RUNTIME_PROBES = new Map();
|
|
22
24
|
const CLIENT_RUNTIME_PROBE_TIMEOUT_MS = 1_500;
|
|
23
25
|
|
|
@@ -556,7 +558,12 @@ function responseHeaders(headerRows) {
|
|
|
556
558
|
}
|
|
557
559
|
|
|
558
560
|
function requestRustRange(clients, url, start, end, networkId) {
|
|
559
|
-
|
|
561
|
+
const key = `${clients[0]?.id || ""}|${networkId}|${url}|${start}|${end}`;
|
|
562
|
+
const existing = RANGE_REQUEST_FLIGHTS.get(key);
|
|
563
|
+
if (existing) {
|
|
564
|
+
return existing;
|
|
565
|
+
}
|
|
566
|
+
const request = messageFirstClient(clients, {
|
|
560
567
|
type: "WEEB3_FETCH_REQUEST",
|
|
561
568
|
url,
|
|
562
569
|
method: "GET",
|
|
@@ -579,9 +586,24 @@ function requestRustRange(clients, url, start, end, networkId) {
|
|
|
579
586
|
|
|
580
587
|
return { ok: true, body };
|
|
581
588
|
});
|
|
589
|
+
RANGE_REQUEST_FLIGHTS.set(key, request);
|
|
590
|
+
request.finally(() => {
|
|
591
|
+
if (RANGE_REQUEST_FLIGHTS.get(key) === request) {
|
|
592
|
+
RANGE_REQUEST_FLIGHTS.delete(key);
|
|
593
|
+
}
|
|
594
|
+
}).catch(() => {});
|
|
595
|
+
return request;
|
|
582
596
|
}
|
|
583
597
|
|
|
584
|
-
function createRustRangeStream(
|
|
598
|
+
function createRustRangeStream(
|
|
599
|
+
clients,
|
|
600
|
+
url,
|
|
601
|
+
size,
|
|
602
|
+
networkId,
|
|
603
|
+
windowBytes,
|
|
604
|
+
initialLookahead,
|
|
605
|
+
lookahead
|
|
606
|
+
) {
|
|
585
607
|
let position = 0;
|
|
586
608
|
let schedulePosition = 0;
|
|
587
609
|
let admissionOpen = true;
|
|
@@ -610,7 +632,8 @@ function createRustRangeStream(clients, url, size, networkId, windowBytes, looka
|
|
|
610
632
|
};
|
|
611
633
|
|
|
612
634
|
const scheduleMore = () => {
|
|
613
|
-
|
|
635
|
+
const limit = position < initialLookahead * windowBytes ? initialLookahead : lookahead;
|
|
636
|
+
while (admissionOpen && schedulePosition < size && scheduled.size < limit) {
|
|
614
637
|
if (!admitRange()) {
|
|
615
638
|
break;
|
|
616
639
|
}
|
|
@@ -732,12 +755,16 @@ async function forwardRequestToRust(request, event) {
|
|
|
732
755
|
const lookahead = liveHlsResource
|
|
733
756
|
? HLS_LIVE_STREAM_LOOKAHEAD_CHUNKS
|
|
734
757
|
: hlsResource ? HLS_STREAM_LOOKAHEAD_CHUNKS : STREAM_LOOKAHEAD_CHUNKS;
|
|
758
|
+
const initialLookahead = hlsResource
|
|
759
|
+
? HLS_STREAM_INITIAL_LOOKAHEAD_CHUNKS
|
|
760
|
+
: lookahead;
|
|
735
761
|
return new Response(createRustRangeStream(
|
|
736
762
|
clients,
|
|
737
763
|
request.url,
|
|
738
764
|
size,
|
|
739
765
|
networkId,
|
|
740
766
|
windowBytes,
|
|
767
|
+
initialLookahead,
|
|
741
768
|
lookahead
|
|
742
769
|
), {
|
|
743
770
|
status,
|
package/weeb_3.d.ts
CHANGED
|
@@ -84,11 +84,11 @@ export interface InitOutput {
|
|
|
84
84
|
readonly __wbg_requestarguments_free: (a: number, b: number) => void;
|
|
85
85
|
readonly requestarguments_method: (a: number, b: number) => void;
|
|
86
86
|
readonly requestarguments_params: (a: number) => number;
|
|
87
|
-
readonly
|
|
88
|
-
readonly
|
|
89
|
-
readonly
|
|
90
|
-
readonly
|
|
91
|
-
readonly
|
|
87
|
+
readonly __wasm_bindgen_func_elem_545: (a: number, b: number) => void;
|
|
88
|
+
readonly __wasm_bindgen_func_elem_1428: (a: number, b: number, c: number, d: number) => void;
|
|
89
|
+
readonly __wasm_bindgen_func_elem_1430: (a: number, b: number, c: number, d: number) => void;
|
|
90
|
+
readonly __wasm_bindgen_func_elem_3473: (a: number, b: number, c: number) => void;
|
|
91
|
+
readonly __wasm_bindgen_func_elem_3399: (a: number, b: number) => void;
|
|
92
92
|
readonly __wbindgen_export: (a: number, b: number) => number;
|
|
93
93
|
readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
94
94
|
readonly __wbindgen_export3: (a: number) => void;
|
package/weeb_3.js
CHANGED
|
@@ -572,10 +572,6 @@ function __wbg_get_imports() {
|
|
|
572
572
|
__wbg_commit_a54edce65f3858f2: function() { return handleError(function (arg0) {
|
|
573
573
|
getObject(arg0).commit();
|
|
574
574
|
}, arguments); },
|
|
575
|
-
__wbg_config_deb21a1570effbf6: function(arg0) {
|
|
576
|
-
const ret = getObject(arg0).config;
|
|
577
|
-
return addHeapObject(ret);
|
|
578
|
-
},
|
|
579
575
|
__wbg_confirm_0951f3942a645061: function() { return handleError(function (arg0, arg1, arg2) {
|
|
580
576
|
const ret = getObject(arg0).confirm(getStringFromWasm0(arg1, arg2));
|
|
581
577
|
return ret;
|
|
@@ -1035,6 +1031,10 @@ function __wbg_get_imports() {
|
|
|
1035
1031
|
const ret = Number.isSafeInteger(getObject(arg0));
|
|
1036
1032
|
return ret;
|
|
1037
1033
|
},
|
|
1034
|
+
__wbg_is_f29129f676e5410c: function(arg0, arg1) {
|
|
1035
|
+
const ret = Object.is(getObject(arg0), getObject(arg1));
|
|
1036
|
+
return ret;
|
|
1037
|
+
},
|
|
1038
1038
|
__wbg_item_c79c0bccbcfd8735: function(arg0, arg1) {
|
|
1039
1039
|
const ret = getObject(arg0).item(arg1 >>> 0);
|
|
1040
1040
|
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
@@ -1157,7 +1157,7 @@ function __wbg_get_imports() {
|
|
|
1157
1157
|
const a = state0.a;
|
|
1158
1158
|
state0.a = 0;
|
|
1159
1159
|
try {
|
|
1160
|
-
return
|
|
1160
|
+
return __wasm_bindgen_func_elem_1428(a, state0.b, arg0, arg1);
|
|
1161
1161
|
} finally {
|
|
1162
1162
|
state0.a = a;
|
|
1163
1163
|
}
|
|
@@ -1728,38 +1728,38 @@ function __wbg_get_imports() {
|
|
|
1728
1728
|
console.warn(getObject(arg0));
|
|
1729
1729
|
},
|
|
1730
1730
|
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
1731
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx: 3, function: Function { arguments: [Externref, Externref], shim_idx:
|
|
1732
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
1731
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 3, function: Function { arguments: [Externref, Externref], shim_idx: 23, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1732
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_545, __wasm_bindgen_func_elem_1428);
|
|
1733
1733
|
return addHeapObject(ret);
|
|
1734
1734
|
},
|
|
1735
1735
|
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
1736
1736
|
// Cast intrinsic for `Closure(Closure { dtor_idx: 3, function: Function { arguments: [Externref], shim_idx: 4, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1737
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
1737
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_545, __wasm_bindgen_func_elem_3473);
|
|
1738
1738
|
return addHeapObject(ret);
|
|
1739
1739
|
},
|
|
1740
1740
|
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
|
|
1741
1741
|
// Cast intrinsic for `Closure(Closure { dtor_idx: 3, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx: 4, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1742
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
1742
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_545, __wasm_bindgen_func_elem_3473);
|
|
1743
1743
|
return addHeapObject(ret);
|
|
1744
1744
|
},
|
|
1745
1745
|
__wbindgen_cast_0000000000000004: function(arg0, arg1) {
|
|
1746
1746
|
// Cast intrinsic for `Closure(Closure { dtor_idx: 3, function: Function { arguments: [NamedExternref("Event")], shim_idx: 4, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1747
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
1747
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_545, __wasm_bindgen_func_elem_3473);
|
|
1748
1748
|
return addHeapObject(ret);
|
|
1749
1749
|
},
|
|
1750
1750
|
__wbindgen_cast_0000000000000005: function(arg0, arg1) {
|
|
1751
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx: 3, function: Function { arguments: [NamedExternref("IDBVersionChangeEvent")], shim_idx:
|
|
1752
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
1751
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 3, function: Function { arguments: [NamedExternref("IDBVersionChangeEvent")], shim_idx: 25, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
1752
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_545, __wasm_bindgen_func_elem_1430);
|
|
1753
1753
|
return addHeapObject(ret);
|
|
1754
1754
|
},
|
|
1755
1755
|
__wbindgen_cast_0000000000000006: function(arg0, arg1) {
|
|
1756
1756
|
// Cast intrinsic for `Closure(Closure { dtor_idx: 3, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 4, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1757
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
1757
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_545, __wasm_bindgen_func_elem_3473);
|
|
1758
1758
|
return addHeapObject(ret);
|
|
1759
1759
|
},
|
|
1760
1760
|
__wbindgen_cast_0000000000000007: function(arg0, arg1) {
|
|
1761
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx: 3, function: Function { arguments: [], shim_idx:
|
|
1762
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
1761
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 3, function: Function { arguments: [], shim_idx: 98, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1762
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_545, __wasm_bindgen_func_elem_3399);
|
|
1763
1763
|
return addHeapObject(ret);
|
|
1764
1764
|
},
|
|
1765
1765
|
__wbindgen_cast_0000000000000008: function(arg0) {
|
|
@@ -1812,22 +1812,22 @@ function __wbg_get_imports() {
|
|
|
1812
1812
|
};
|
|
1813
1813
|
}
|
|
1814
1814
|
|
|
1815
|
-
function
|
|
1816
|
-
wasm.
|
|
1815
|
+
function __wasm_bindgen_func_elem_3399(arg0, arg1) {
|
|
1816
|
+
wasm.__wasm_bindgen_func_elem_3399(arg0, arg1);
|
|
1817
1817
|
}
|
|
1818
1818
|
|
|
1819
|
-
function
|
|
1820
|
-
wasm.
|
|
1819
|
+
function __wasm_bindgen_func_elem_3473(arg0, arg1, arg2) {
|
|
1820
|
+
wasm.__wasm_bindgen_func_elem_3473(arg0, arg1, addHeapObject(arg2));
|
|
1821
1821
|
}
|
|
1822
1822
|
|
|
1823
|
-
function
|
|
1824
|
-
wasm.
|
|
1823
|
+
function __wasm_bindgen_func_elem_1428(arg0, arg1, arg2, arg3) {
|
|
1824
|
+
wasm.__wasm_bindgen_func_elem_1428(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
1825
1825
|
}
|
|
1826
1826
|
|
|
1827
|
-
function
|
|
1827
|
+
function __wasm_bindgen_func_elem_1430(arg0, arg1, arg2) {
|
|
1828
1828
|
try {
|
|
1829
1829
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1830
|
-
wasm.
|
|
1830
|
+
wasm.__wasm_bindgen_func_elem_1430(retptr, arg0, arg1, addHeapObject(arg2));
|
|
1831
1831
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1832
1832
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1833
1833
|
if (r1) {
|
package/weeb_3_bg.wasm
CHANGED
|
Binary file
|
package/weeb_3_bg.wasm.d.ts
CHANGED
|
@@ -32,11 +32,11 @@ export const weeb3no103_uploadWithRedundancy: (a: number, b: number, c: number,
|
|
|
32
32
|
export const __wbg_requestarguments_free: (a: number, b: number) => void;
|
|
33
33
|
export const requestarguments_method: (a: number, b: number) => void;
|
|
34
34
|
export const requestarguments_params: (a: number) => number;
|
|
35
|
-
export const
|
|
36
|
-
export const
|
|
37
|
-
export const
|
|
38
|
-
export const
|
|
39
|
-
export const
|
|
35
|
+
export const __wasm_bindgen_func_elem_545: (a: number, b: number) => void;
|
|
36
|
+
export const __wasm_bindgen_func_elem_1428: (a: number, b: number, c: number, d: number) => void;
|
|
37
|
+
export const __wasm_bindgen_func_elem_1430: (a: number, b: number, c: number, d: number) => void;
|
|
38
|
+
export const __wasm_bindgen_func_elem_3473: (a: number, b: number, c: number) => void;
|
|
39
|
+
export const __wasm_bindgen_func_elem_3399: (a: number, b: number) => void;
|
|
40
40
|
export const __wbindgen_export: (a: number, b: number) => number;
|
|
41
41
|
export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
42
42
|
export const __wbindgen_export3: (a: number) => void;
|