Skip to content

IFilestore Api implemented #37

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

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/CoreApi/AddFileOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,5 +96,15 @@ public class AddFileOptions
/// Used to report the progress of a file transfer.
/// </summary>
public IProgress<TransferProgress>? Progress { get; set; }

/// <summary>
/// Flag for no cache argument
/// </summary>
public bool? NoCopy {get; set; }

/// <summary>
/// Flag for fs cache argument
/// </summary>
public bool? FsCache{get; set; }
}
}
37 changes: 37 additions & 0 deletions src/CoreApi/IFilestoreApi.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace Ipfs.CoreApi
{
/// <summary>
/// Abstraction for the file store api.
/// </summary>
public interface IFilestoreApi
{
/// <summary>
/// Lists blocks that are both in the filestore and standard block storage.
/// </summary>
public Task<IDupsResponse> DupsAsync(CancellationToken token);

/// <summary>
/// Lists filestore objects
/// </summary>
/// <param name="cid">Cid of objects to verify. Required: no.</param>
/// <param name="token">The cancellation token.</param>
/// <param name="fileOrder">Verify the objects based on the order of the backing file. Required: no.</param>
/// <returns></returns>
public Task<IFilestoreApiObjectResponse> ListAsync(string cid, bool fileOrder, CancellationToken token);

/// <summary>
///
/// </summary>
/// <param name="cid">Cid of objects to list. Required: no.</param>
/// <param name="token">The cancellation token.</param>
/// <param name="fileOrder">Lists the objects based on the order of the backing file. Required: no.</param>
/// <returns></returns>
public Task<IFilestoreApiObjectResponse> VerifyObjectsAsync(string cid, bool fileOrder, CancellationToken token);
}
}
63 changes: 63 additions & 0 deletions src/CoreApi/IFilestoreApiObjectResponse.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
using Newtonsoft.Json;

namespace Ipfs.CoreApi
{
/// <summary>
/// Interface for <see cref="IFilestoreApi"/> repsonse.
/// </summary>
public interface IFilestoreApiObjectResponse
{
/// <summary>
/// Holds any error message.
/// </summary>
public string ErrorMsg { get; set; }

/// <summary>
/// Path to the file
/// </summary>
public string FilePath { get; set; }

/// <summary>
/// The response offset.
/// </summary>
public string Offset { get; set; }

/// <summary>
/// The size of the object.
/// </summary>
public string Size { get; set; }

/// <summary>
/// The object status.k
/// </summary>
public string Status { get; set; }
}

/// <summary>
/// Model for the hold filestore key
/// </summary>
public interface IFilesStoreKey
{
/// <summary>
/// Key value.
/// </summary>
[JsonProperty("/")]
public string _ { get; set; }
}

/// <summary>
/// Interface for <see cref="IDupsResponse"/> response.
/// </summary>
public interface IDupsResponse
{
/// <summary>
/// Any error in the <see cref="IFilestoreApi"/> Dups response.
/// </summary>
public string Err { get; set; }

/// <summary>
/// The error in the <see cref="IFilestoreApi"/> Dups response.
/// </summary>
public string Ref { get; set; }
}
}