This repository has been archived by the owner on Feb 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: make IPFS API static (remove api-manager) (#3365)
- api-manager is gone. - There is now Storage component that is glorified `{keychain, repo, peerId}` tuple, that one can `async start` and it takes care of repo bootstrapping (which `init` used to do). As per discussion with @achingbrain `init` was mostly there for historical reasons. - There is now `Network` service component that is glorified `{peerId, libp2p, bitswap}` tuple. - All components that depended upon `libp2p` or `peerId` depend on `network` service now. - They can do `await network.use(options)` and get tuple when node is started (if it is starting or started) or an exception if start has not been initiated. - This way IPFS node is no longer mutated and APIs that depend on node been started throw if called before start. - lot of TS typings were added to be able to make this changes with more confidence. - Set of interfaces were added for things like datastore, repo, bitswap - create can be passed implementations and it's useful to decouple interface from a concrete implementation. - We had no types for those and it helped having interfaces to increase coverage and enable making these changes. > I would like to migrate those to other repos, but doing it as would be more effective than having to coordinate changes across many repos. - circular dependencies between pinmanager and dag APIs are resolved. Co-authored-by: Alex Potsides <[email protected]> Co-authored-by: Hugo Dias <[email protected]>
- Loading branch information
1 parent
c7d4376
commit c3c4607
Showing
125 changed files
with
3,784 additions
and
2,112 deletions.
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
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
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
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
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
This file was deleted.
Oops, something went wrong.
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,27 @@ | ||
'use strict' | ||
|
||
const createWantlist = require('./wantlist') | ||
const createWantlistForPeer = require('./wantlist-for-peer') | ||
const createUnwant = require('./unwant') | ||
const createStat = require('./stat') | ||
|
||
class BitswapAPI { | ||
/** | ||
* @param {Object} config | ||
* @param {NetworkService} config.network | ||
*/ | ||
constructor ({ network }) { | ||
this.wantlist = createWantlist({ network }) | ||
this.wantlistForPeer = createWantlistForPeer({ network }) | ||
this.unwant = createUnwant({ network }) | ||
this.stat = createStat({ network }) | ||
} | ||
} | ||
module.exports = BitswapAPI | ||
|
||
/** | ||
* @typedef {import('..').NetworkService} NetworkService | ||
* @typedef {import('..').PeerId} PeerId | ||
* @typedef {import('..').CID} CID | ||
* @typedef {import('..').AbortOptions} AbortOptions | ||
*/ |
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
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
Oops, something went wrong.