-
Notifications
You must be signed in to change notification settings - Fork 130
feat: use libp2p in @helia/http and move libp2p to the base helia class #822
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
so that both helia and @helia/http can share the same base class with libp2p configured in a different fashion
Any reason not to target main with this PR? It would make #764 less noisy. |
/** | ||
* Options used to create a Helia node. | ||
*/ | ||
export interface HeliaInit<T extends Libp2p = Libp2p> extends HeliaClassInit { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a breaking change, it should re-export the HeliaInit
type from @helia/utils
to make it non-breaking.
keychain?: KeychainInit | ||
} | ||
|
||
export interface HeliaLibp2p<T extends Libp2p = Libp2p<DefaultLibp2pServices>> extends Helia { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a breaking change, the type should be marked deprecated with a message saying it'll be removed in a future release instead.
@@ -242,6 +271,7 @@ export class Helia implements HeliaInterface { | |||
this.datastore, | |||
this.routing | |||
) | |||
await this.libp2p.start() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.libp2p
can be passed to start
same as the blockstore/datastore/routing implementations.
@@ -250,6 +280,7 @@ export class Helia implements HeliaInterface { | |||
this.datastore, | |||
this.routing | |||
) | |||
await this.libp2p.stop() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.libp2p
can be passed to stop
same as the blockstore/datastore/routing implementations.
*/ | ||
put(routingKey: Uint8Array, marshaledRecord: Uint8Array, metadata: IPNSMetadata, options?: PutOptions): Promise<void> | ||
put(routingKey: Uint8Array, marshaledRecord: Uint8Array, metadata?: IPNSPublishMetadata, options?: PutOptions): Promise<void> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is optional, move it into the options object for consistency.
What
HeliaP2P
class and moves the libp2p instance to the base Helia class which both Helia and @helia/http instantiateNotes & open questions
Change checklist