weida 0.1.0-alpha.14 → 0.1.0-alpha.16
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/lib/index.d.ts +9 -3
- package/lib/index.js +49 -5
- package/package.json +1 -1
- package/prebuilds/darwin-arm64/libweida.dylib +0 -0
- package/prebuilds/darwin-arm64/weida.node +0 -0
- package/prebuilds/linux-arm64/libweida.so +0 -0
- package/prebuilds/linux-arm64/weida.node +0 -0
- package/prebuilds/linux-x64/libweida.so +0 -0
- package/prebuilds/linux-x64/weida.node +0 -0
- package/prebuilds/win32-x64/weida.dll +0 -0
- package/prebuilds/win32-x64/weida.node +0 -0
package/lib/index.d.ts
CHANGED
|
@@ -1051,12 +1051,14 @@ export class Swarm extends Handle {
|
|
|
1051
1051
|
/** Dropping it aborts every order in flight. */
|
|
1052
1052
|
export class Fetch extends Handle {
|
|
1053
1053
|
blob(): Blob;
|
|
1054
|
-
/** WEIDA_EINVAL while a `next` is pending. */
|
|
1055
1054
|
list(): PieceList | null;
|
|
1056
|
-
/** WEIDA_EINVAL while a `next` is pending. */
|
|
1057
1055
|
delivered(): Bits;
|
|
1058
|
-
/** WEIDA_EINVAL while a `next` is pending. */
|
|
1059
1056
|
inFlight(): Bits;
|
|
1057
|
+
/** What `next` waits for until a seeder gains it, a copy. */
|
|
1058
|
+
unavailable(): Bits;
|
|
1059
|
+
/** An empty range clears the priority. */
|
|
1060
|
+
prioritize(start: number, end: number): void;
|
|
1061
|
+
clearPriority(): void;
|
|
1060
1062
|
/** The next verified piece, or null once every piece is held; rejects
|
|
1061
1063
|
* with WEIDA_ENOT_CONNECTED when no seeder is left. */
|
|
1062
1064
|
next(options?: WaitOptions): Promise<Piece | null>;
|
|
@@ -1080,6 +1082,8 @@ export class SeedSession extends Handle {
|
|
|
1080
1082
|
answerList(list: PieceList, options?: WaitOptions): Promise<void>;
|
|
1081
1083
|
answerHave(have: Bits, options?: WaitOptions): Promise<void>;
|
|
1082
1084
|
answerPiece(data: Bytes, options?: WaitOptions): Promise<void>;
|
|
1085
|
+
/** Answers PIECE `index` with "no longer held". */
|
|
1086
|
+
answerGone(index: number, options?: WaitOptions): Promise<void>;
|
|
1083
1087
|
/** Consumes the session. */
|
|
1084
1088
|
decline(options?: WaitOptions): Promise<void>;
|
|
1085
1089
|
}
|
|
@@ -1154,6 +1158,8 @@ export class RelayRequest extends Handle {
|
|
|
1154
1158
|
target(): string | null;
|
|
1155
1159
|
/** Serves it; consumes the request. */
|
|
1156
1160
|
admit(options?: WaitOptions): Promise<void>;
|
|
1161
|
+
/** As `admit`, holding a tunnel to `bytesPerSec`; consumes the request. */
|
|
1162
|
+
admitWith(bytesPerSec: Count, options?: WaitOptions): Promise<void>;
|
|
1157
1163
|
/** Refuses it with WEIDA_EREJECTED; consumes the request. */
|
|
1158
1164
|
refuse(options?: WaitOptions): Promise<void>;
|
|
1159
1165
|
}
|
package/lib/index.js
CHANGED
|
@@ -2651,25 +2651,44 @@ export class Fetch extends Handle {
|
|
|
2651
2651
|
}
|
|
2652
2652
|
|
|
2653
2653
|
/** The piece list once it is known and verified, or null: keep it to
|
|
2654
|
-
* resume without asking for it (`{ list }`).
|
|
2655
|
-
*
|
|
2654
|
+
* resume without asking for it (`{ list }`). A pending `next` goes on
|
|
2655
|
+
* unharmed. */
|
|
2656
2656
|
list() {
|
|
2657
2657
|
const list = native.fetchList(this[HANDLE]);
|
|
2658
2658
|
return list === null ? null : adopt(PieceList, list);
|
|
2659
2659
|
}
|
|
2660
2660
|
|
|
2661
2661
|
/** The pieces the caller holds: those it started with and those this
|
|
2662
|
-
* fetch yielded, a copy.
|
|
2662
|
+
* fetch yielded, a copy. A pending `next` goes on unharmed. */
|
|
2663
2663
|
delivered() {
|
|
2664
2664
|
return adopt(Bits, native.fetchDelivered(this[HANDLE]));
|
|
2665
2665
|
}
|
|
2666
2666
|
|
|
2667
|
-
/** The pieces ordered and not yet taken, a copy.
|
|
2668
|
-
*
|
|
2667
|
+
/** The pieces ordered and not yet taken, a copy. A pending `next` goes on
|
|
2668
|
+
* unharmed. */
|
|
2669
2669
|
inFlight() {
|
|
2670
2670
|
return adopt(Bits, native.fetchInFlight(this[HANDLE]));
|
|
2671
2671
|
}
|
|
2672
2672
|
|
|
2673
|
+
/** The missing pieces no order fetches and no seeder holds by its last
|
|
2674
|
+
* HAVE: what `next` waits for until a seeder gains them, a copy. A
|
|
2675
|
+
* pending `next` goes on unharmed. */
|
|
2676
|
+
unavailable() {
|
|
2677
|
+
return adopt(Bits, native.fetchUnavailable(this[HANDLE]));
|
|
2678
|
+
}
|
|
2679
|
+
|
|
2680
|
+
/** Orders the missing pieces of `start..end` before any other, in index
|
|
2681
|
+
* order; replaces an earlier range, and an empty one clears it. Takes
|
|
2682
|
+
* effect at the next order. A pending `next` goes on unharmed. */
|
|
2683
|
+
prioritize(start, end) {
|
|
2684
|
+
native.fetchPrioritize(this[HANDLE], start, end);
|
|
2685
|
+
}
|
|
2686
|
+
|
|
2687
|
+
/** Ends the priority: rarest first again. */
|
|
2688
|
+
clearPriority() {
|
|
2689
|
+
native.fetchClearPriority(this[HANDLE]);
|
|
2690
|
+
}
|
|
2691
|
+
|
|
2673
2692
|
/** The next verified piece, a frozen `{ index, bytes }` copied out at
|
|
2674
2693
|
* once, or null once every piece is held. Rejects with
|
|
2675
2694
|
* WEIDA_ENOT_CONNECTED when no seeder is left that has not failed this
|
|
@@ -2798,6 +2817,18 @@ export class SeedSession extends Handle {
|
|
|
2798
2817
|
);
|
|
2799
2818
|
}
|
|
2800
2819
|
|
|
2820
|
+
/** Answers PIECE `index` with "no longer held": the fetch orders it
|
|
2821
|
+
* elsewhere and keeps the session. */
|
|
2822
|
+
async answerGone(index, { signal } = {}) {
|
|
2823
|
+
await op(
|
|
2824
|
+
this,
|
|
2825
|
+
() => native.seedSessionAnswerGone(this[HANDLE], index),
|
|
2826
|
+
native.seedSessionAnswerGoneOpWait,
|
|
2827
|
+
native.seedSessionAnswerGoneOpFd,
|
|
2828
|
+
signal,
|
|
2829
|
+
);
|
|
2830
|
+
}
|
|
2831
|
+
|
|
2801
2832
|
/** Ends the session: a blob this seeder does not serve or a piece it
|
|
2802
2833
|
* does not hold; the fetch drops this seeder for the blob. Consumes the
|
|
2803
2834
|
* session. */
|
|
@@ -3145,6 +3176,19 @@ export class RelayRequest extends Handle {
|
|
|
3145
3176
|
);
|
|
3146
3177
|
}
|
|
3147
3178
|
|
|
3179
|
+
/** Serves it as `admit` does and holds a tunnel to `bytesPerSec`, both
|
|
3180
|
+
* directions together, with one second of burst; a registration's budget
|
|
3181
|
+
* is unused. Consumes the request. */
|
|
3182
|
+
async admitWith(bytesPerSec, { signal } = {}) {
|
|
3183
|
+
await op(
|
|
3184
|
+
this,
|
|
3185
|
+
() => native.relayRequestAdmitWith(consume(this), bytesPerSec),
|
|
3186
|
+
native.relayRequestAdmitOpWait,
|
|
3187
|
+
native.relayRequestAdmitOpFd,
|
|
3188
|
+
signal,
|
|
3189
|
+
);
|
|
3190
|
+
}
|
|
3191
|
+
|
|
3148
3192
|
/** Refuses it: the asker fails with WEIDA_EREJECTED. Consumes the
|
|
3149
3193
|
* request. */
|
|
3150
3194
|
async refuse({ signal } = {}) {
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|