forked from ipfs/helia
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: update @helia/interface for http lib
- fixes ipfs#352
- Loading branch information
1 parent
299bb09
commit 65a85b8
Showing
3 changed files
with
78 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"packages/helia":"2.1.0","packages/interface":"2.1.0","packages/interop":"1.1.0"} | ||
{"packages/helia":"2.1.0","packages/interface":"2.2.0","packages/interop":"1.1.0"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/** | ||
* @packageDocumentation | ||
* | ||
* The API defined by a {@link HeliaHTTP} node | ||
* | ||
* @example | ||
* | ||
* ```typescript | ||
* import type { HeliaHTTP } from '@helia/interface' | ||
* | ||
* export function doSomething(heliaHTTP: HeliaHTTP) { | ||
* // use heliaHTTP node functions here | ||
* } | ||
* ``` | ||
*/ | ||
|
||
import type { Blocks } from './blocks.js' | ||
import type { Pins } from './pins.js' | ||
import type { AbortOptions, ComponentLogger } from '@libp2p/interface' | ||
import type { Datastore } from 'interface-datastore' | ||
import type { CID } from 'multiformats/cid' | ||
import type { ProgressEvent, ProgressOptions } from 'progress-events' | ||
|
||
export type { Await, AwaitIterable } from 'interface-store' | ||
|
||
/** | ||
* The API presented by a Helia node. | ||
*/ | ||
export interface HeliaHTTP { | ||
|
||
/** | ||
* Where the blocks are stored | ||
*/ | ||
blockstore: Blocks | ||
|
||
/** | ||
* A key/value store | ||
*/ | ||
datastore: Datastore | ||
|
||
/** | ||
* Pinning operations for blocks in the blockstore | ||
*/ | ||
pins: Pins | ||
|
||
/** | ||
* A logging component that can be reused by consumers | ||
*/ | ||
logger: ComponentLogger | ||
|
||
/** | ||
* Starts the HeliaHTTP node | ||
*/ | ||
start(): Promise<void> | ||
|
||
/** | ||
* Stops the HeliaHTTP node | ||
*/ | ||
stop(): Promise<void> | ||
|
||
/** | ||
* Remove any unpinned blocks from the blockstore | ||
*/ | ||
gc(options?: GCOptions): Promise<void> | ||
} | ||
|
||
export type GcEvents = | ||
ProgressEvent<'heliaHTTP:gc:deleted', CID> | | ||
ProgressEvent<'heliaHTTP:gc:error', Error> | ||
|
||
export interface GCOptions extends AbortOptions, ProgressOptions<GcEvents> { | ||
|
||
} |