Skip to content

Commit 3977409

Browse files
committed
2 parents 4932c8e + fbedc00 commit 3977409

File tree

3 files changed

+110
-0
lines changed

3 files changed

+110
-0
lines changed

src/CoreApi/AddFileOptions.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,5 +96,15 @@ public class AddFileOptions
9696
/// Used to report the progress of a file transfer.
9797
/// </summary>
9898
public IProgress<TransferProgress>? Progress { get; set; }
99+
100+
/// <summary>
101+
/// Add the file using filestore. Implies raw-leaves.
102+
/// </summary>
103+
public bool? NoCopy {get; set; }
104+
105+
/// <summary>
106+
/// Check the filestore for pre-existing blocks.
107+
/// </summary>
108+
public bool? FsCache{get; set; }
99109
}
100110
}

src/CoreApi/IFilestoreApi.cs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Text;
4+
using System.Threading;
5+
using System.Threading.Tasks;
6+
7+
namespace Ipfs.CoreApi
8+
{
9+
/// <summary>
10+
/// Abstraction for the file store api.
11+
/// </summary>
12+
public interface IFilestoreApi
13+
{
14+
/// <summary>
15+
/// Lists blocks that are both in the filestore and standard block storage.
16+
/// </summary>
17+
public Task<IDupsResponse> DupsAsync(CancellationToken token);
18+
19+
/// <summary>
20+
/// Lists filestore objects
21+
/// </summary>
22+
/// <param name="cid">Cid of objects to verify. Required: no.</param>
23+
/// <param name="token">The cancellation token.</param>
24+
/// <param name="fileOrder">Verify the objects based on the order of the backing file. Required: no.</param>
25+
/// <returns></returns>
26+
public Task<IFilestoreApiObjectResponse> ListAsync(string cid, bool fileOrder, CancellationToken token);
27+
28+
/// <summary>
29+
///
30+
/// </summary>
31+
/// <param name="cid">Cid of objects to list. Required: no.</param>
32+
/// <param name="token">The cancellation token.</param>
33+
/// <param name="fileOrder">Lists the objects based on the order of the backing file. Required: no.</param>
34+
/// <returns></returns>
35+
public Task<IFilestoreApiObjectResponse> VerifyObjectsAsync(string cid, bool fileOrder, CancellationToken token);
36+
}
37+
}
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
using Newtonsoft.Json;
2+
3+
namespace Ipfs.CoreApi
4+
{
5+
/// <summary>
6+
/// Interface for <see cref="IFilestoreApi"/> repsonse.
7+
/// </summary>
8+
public interface IFilestoreApiObjectResponse
9+
{
10+
/// <summary>
11+
/// Holds any error message.
12+
/// </summary>
13+
public string ErrorMsg { get; set; }
14+
15+
/// <summary>
16+
/// Path to the file
17+
/// </summary>
18+
public string FilePath { get; set; }
19+
20+
/// <summary>
21+
/// The response offset.
22+
/// </summary>
23+
public string Offset { get; set; }
24+
25+
/// <summary>
26+
/// The size of the object.
27+
/// </summary>
28+
public string Size { get; set; }
29+
30+
/// <summary>
31+
/// The object status.
32+
/// </summary>
33+
public string Status { get; set; }
34+
}
35+
36+
/// <summary>
37+
/// Model for the hold filestore key
38+
/// </summary>
39+
public interface IFilestoreKey
40+
{
41+
/// <summary>
42+
/// Key value.
43+
/// </summary>
44+
[JsonProperty("/")]
45+
public string _ { get; set; }
46+
}
47+
48+
/// <summary>
49+
/// Interface for <see cref="IDupsResponse"/> response.
50+
/// </summary>
51+
public interface IDupsResponse
52+
{
53+
/// <summary>
54+
/// Any error in the <see cref="IFilestoreApi"/> Dups response.
55+
/// </summary>
56+
public string Err { get; set; }
57+
58+
/// <summary>
59+
/// The error in the <see cref="IFilestoreApi"/> Dups response.
60+
/// </summary>
61+
public string Ref { get; set; }
62+
}
63+
}

0 commit comments

Comments
 (0)