Interface IDfs
Provides read-write access to a distributed file system.
Namespace: Catalyst.Abstractions.Dfs
Assembly: Catalyst.Abstractions.dll
Syntax
public interface IDfs
Methods
| Improve this Doc View SourceAddAsync(Stream, String, CancellationToken)
Adds content from a stream of data to the DFS.
Declaration
Task<Cid> AddAsync(Stream content, string name = "", CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | content | A stream containing the data to be stored on the DFS. |
System.String | name | A name for the |
System.Threading.CancellationToken | cancellationToken | A cancellation token that can be used to cancel the work. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<Cid> | The unique ID to the newly added content on the DFS. |
AddTextAsync(String, CancellationToken)
Add some text to the distributed file system.
Declaration
Task<Cid> AddTextAsync(string content, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
System.String | content | The text to add to the DFS. |
System.Threading.CancellationToken | cancellationToken | A cancellation token that can be used to cancel the work. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<Cid> | The unique ID to the content created on the DFS. |
ReadAsync(Cid, CancellationToken)
Streams the content of an existing file on the DFS.
Declaration
Task<Stream> ReadAsync(Cid cid, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
Cid | cid | |
System.Threading.CancellationToken | cancellationToken | A cancellation token that can be used to cancel the work. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.IO.Stream> | A System.IO.Stream to the content of the file. |
Remarks
The returned System.IO.Stream must be disposed.
ReadTextAsync(Cid, CancellationToken)
Reads the content of an existing file on the DFS as a UTF8 string.
Declaration
Task<string> ReadTextAsync(Cid cid, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
Cid | cid | |
System.Threading.CancellationToken | cancellationToken | A cancellation token that can be used to cancel the work. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.String> | The content of the DFS file as a UTF8 encoded string. |