Class IpfsEngine
Implements the ICoreApi which makes it possible to create a decentralised and distributed application without relying on an "IPFS daemon".
Inherited Members
Namespace: Ipfs.Engine
Assembly: Ipfs.Engine.dll
Syntax
public class IpfsEngine : ICoreApi, IService, IDisposable
Remarks
The engine should be used as a shared object in your program. It is thread safe (re-entrant) and conserves resources when only one instance is used.
Constructors
| Improve this Doc View SourceIpfsEngine()
Creates a new instance of the IpfsEngine class with the IPFS_PASS environment variable.
Declaration
public IpfsEngine()
Remarks
Th passphrase must be in the IPFS_PASS environment variable.
IpfsEngine(Char[])
Creates a new instance of the IpfsEngine class with the specified passphrase.
Declaration
public IpfsEngine(char[] passphrase)
Parameters
| Type | Name | Description |
|---|---|---|
| Char[] | passphrase | The password used to access the keychain. |
Remarks
A SecureString copy of the passphrase is made so that the array can be zeroed out after the call.
IpfsEngine(SecureString)
Creates a new instance of the IpfsEngine class with the specified passphrase.
Declaration
public IpfsEngine(SecureString passphrase)
Parameters
| Type | Name | Description |
|---|---|---|
| SecureString | passphrase | The password used to access the keychain. |
Remarks
A copy of the passphrase is made.
Properties
| Improve this Doc View SourceBitswap
Declaration
public IBitswapApi Bitswap { get; set; }
Property Value
| Type | Description |
|---|---|
| IBitswapApi |
BitswapService
Exchange blocks with other peers.
Declaration
public AsyncLazy<Bitswap> BitswapService { get; }
Property Value
| Type | Description |
|---|---|
| Nito.AsyncEx.AsyncLazy<Bitswap> |
Block
Declaration
public IBlockApi Block { get; set; }
Property Value
| Type | Description |
|---|---|
| IBlockApi |
BlockRepository
Declaration
public IBlockRepositoryApi BlockRepository { get; set; }
Property Value
| Type | Description |
|---|---|
| IBlockRepositoryApi |
Bootstrap
Declaration
public IBootstrapApi Bootstrap { get; set; }
Property Value
| Type | Description |
|---|---|
| IBootstrapApi |
Config
Declaration
public IConfigApi Config { get; set; }
Property Value
| Type | Description |
|---|---|
| IConfigApi |
Dag
Declaration
public IDagApi Dag { get; set; }
Property Value
| Type | Description |
|---|---|
| IDagApi |
Dht
Declaration
public IDhtApi Dht { get; set; }
Property Value
| Type | Description |
|---|---|
| IDhtApi |
DhtService
Finds information with a distributed hash table.
Declaration
public AsyncLazy<Dht1> DhtService { get; }
Property Value
| Type | Description |
|---|---|
| Nito.AsyncEx.AsyncLazy<Dht1> |
Dns
Declaration
public IDnsApi Dns { get; set; }
Property Value
| Type | Description |
|---|---|
| IDnsApi |
FileSystem
Declaration
public IFileSystemApi FileSystem { get; set; }
Property Value
| Type | Description |
|---|---|
| IFileSystemApi |
Generic
Declaration
public IGenericApi Generic { get; set; }
Property Value
| Type | Description |
|---|---|
| IGenericApi |
IsStarted
Determines if the engine has started.
Declaration
public bool IsStarted { get; }
Property Value
| Type | Description |
|---|---|
| Boolean | true if the engine has started; otherwise, false. |
See Also
| Improve this Doc View SourceKey
Declaration
public IKeyApi Key { get; set; }
Property Value
| Type | Description |
|---|---|
| IKeyApi |
LocalPeer
Provides access to the local peer.
Declaration
public AsyncLazy<Peer> LocalPeer { get; }
Property Value
| Type | Description |
|---|---|
| Nito.AsyncEx.AsyncLazy<Peer> | A task that represents the asynchronous operation. The task's result is a Peer. |
MigrationManager
Manages the version of the repository.
Declaration
public MigrationManager MigrationManager { get; set; }
Property Value
| Type | Description |
|---|---|
| MigrationManager |
Name
Declaration
public INameApi Name { get; set; }
Property Value
| Type | Description |
|---|---|
| INameApi |
Object
Declaration
public IObjectApi Object { get; set; }
Property Value
| Type | Description |
|---|---|
| IObjectApi |
Options
The configuration options.
Declaration
public IpfsEngineOptions Options { get; set; }
Property Value
| Type | Description |
|---|---|
| IpfsEngineOptions |
Pin
Declaration
public IPinApi Pin { get; set; }
Property Value
| Type | Description |
|---|---|
| IPinApi |
PingService
Determines latency to a peer.
Declaration
public AsyncLazy<Ping1> PingService { get; }
Property Value
| Type | Description |
|---|---|
| Nito.AsyncEx.AsyncLazy<Ping1> |
PubSub
Declaration
public IPubSubApi PubSub { get; set; }
Property Value
| Type | Description |
|---|---|
| IPubSubApi |
PubSubService
Manages publishng and subscribing to messages.
Declaration
public AsyncLazy<NotificationService> PubSubService { get; }
Property Value
| Type | Description |
|---|---|
| Nito.AsyncEx.AsyncLazy<NotificationService> |
Stats
Declaration
public IStatsApi Stats { get; set; }
Property Value
| Type | Description |
|---|---|
| IStatsApi |
Swarm
Declaration
public ISwarmApi Swarm { get; set; }
Property Value
| Type | Description |
|---|---|
| ISwarmApi |
SwarmService
Manages communication with other peers.
Declaration
public AsyncLazy<Swarm> SwarmService { get; }
Property Value
| Type | Description |
|---|---|
| Nito.AsyncEx.AsyncLazy<Swarm> |
Methods
| Improve this Doc View SourceDispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
public void Dispose()
Dispose(Boolean)
Releases the unmanaged and optionally managed resources.
Declaration
protected virtual void Dispose(bool disposing)
Parameters
| Type | Name | Description |
|---|---|---|
| Boolean | disposing | true to release both managed and unmanaged resources; false to release only unmanaged resources. |
KeyChainAsync(CancellationToken)
Provides access to the KeyChain.
Declaration
public Task<KeyChain> KeyChainAsync(CancellationToken cancel = default(CancellationToken))
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancel | Is used to stop the task. When cancelled, the TaskCanceledException is raised. |
Returns
| Type | Description |
|---|---|
| Task<KeyChain> | A task that represents the asynchronous operation. The task's result is the KeyChain. |
ResolveIpfsPathToCidAsync(String, CancellationToken)
Resolve an "IPFS path" to a content ID.
Declaration
public Task<Cid> ResolveIpfsPathToCidAsync(string path, CancellationToken cancel = default(CancellationToken))
Parameters
| Type | Name | Description |
|---|---|---|
| String | path | A IPFS path, such as "Qm...", "Qm.../a/b/c" or "/ipfs/QM..." |
| CancellationToken | cancel | Is used to stop the task. When cancelled, the TaskCanceledException is raised. |
Returns
| Type | Description |
|---|---|
| Task<Cid> | The content ID of |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | The |
Start()
A synchronous start.
Declaration
public void Start()
Remarks
Calls StartAsync() and waits for it to complete.
StartAsync()
Starts the network services.
Declaration
public Task StartAsync()
Returns
| Type | Description |
|---|---|
| Task | A task that represents the asynchronous operation. |
Remarks
Starts the various IPFS and PeerTalk network services. This should be called after any configuration changes.
Exceptions
| Type | Condition |
|---|---|
| Exception | When the engine is already started. |
Stop()
A synchronous stop.
Declaration
public void Stop()
Remarks
Calls StopAsync() and waits for it to complete.
StopAsync()
Stops the running services.
Declaration
public Task StopAsync()
Returns
| Type | Description |
|---|---|
| Task | A task that represents the asynchronous operation. |
Remarks
Multiple calls are okay.