Skip to content

Commit

Permalink
VoidResult
Browse files Browse the repository at this point in the history
  • Loading branch information
jchris committed Sep 12, 2024
1 parent 3901d0a commit 8be46ad
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions src/blockstore/fragment-gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { bs, ensureSuperLog, Logger, Result, SuperThis } from "@fireproof/core";

import { base58btc } from "multiformats/bases/base58";
import { encode, decode } from "cborg";
import { VoidResult } from "./gateway";

Check failure on line 6 in src/blockstore/fragment-gateway.ts

View workflow job for this annotation

GitHub Actions / Quality Checks

'VoidResult' is defined but never used

Check failure on line 6 in src/blockstore/fragment-gateway.ts

View workflow job for this annotation

GitHub Actions / Quality Checks

'VoidResult' is defined but never used

function getFragSize(url: URI): number {
const fragSize = url.getParam("fragSize");
Expand Down Expand Up @@ -167,11 +168,12 @@ export class FragmentGateway implements bs.Gateway {
return Result.Ok(buffer || new Uint8Array(0));
}

async subscribe(url: URI, callback: (msg: Uint8Array) => void): Promise<void> {
if (!this.innerGW.subscribe) {
throw this.logger.Error().Msg("Subscribe not supported").AsError();
async subscribe(url: URI, callback: (msg: Uint8Array) => void): Promise<bs.VoidResult> {
if (this.innerGW.subscribe) {
return this.innerGW.subscribe(url, callback);
} else {
return Result.Err(this.logger.Error().Msg("Subscribe not supported").AsError());
}
return this.innerGW.subscribe(url, callback);
}

async delete(url: URI): Promise<bs.VoidResult> {
Expand Down
2 changes: 1 addition & 1 deletion src/blockstore/gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ export interface Gateway {
get(url: URI): Promise<GetResult>;
delete(url: URI): Promise<VoidResult>;
// be notified of remote meta
subscribe?(url: URI, callback: (meta: Uint8Array) => void): Promise<void>;
subscribe?(url: URI, callback: (meta: Uint8Array) => void): Promise<VoidResult>;
}

0 comments on commit 8be46ad

Please sign in to comment.