-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Release 0.20.0. See release notes or expand full commit message for d…
…etails. [Improvements] Upgraded IpfsShipyard.Ipfs.Http.Client to 0.6.0 with numerous notable improvements and breaking fixes. Added KuboBootstrapper.EnableFilestore flag for use in tandem with the `NoCopy` option now available in the underlying API. GetCidAsync supports the new `NoCopy` and all other AddFileOptions in the underlying API. ContentAddressedSystemFolder supports the new `NoCopy` and automatically handles absolute paths for the filestore to use. GetCidAsync now uses the new FilesystemApi.AddAsync method as the fallback implementation to crawl and upload an entire directory structure for any OwlCore.Storage implementation. [Breaking] See inherited breaking changes in IpfsShipyard.Ipfs.Core 0.7.0 and IpfsShipyard.Ipfs.Http.Client 0.6.0 release notes.
- Loading branch information
1 parent
c6ceba3
commit b62b93f
Showing
14 changed files
with
190 additions
and
39 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 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,51 @@ | ||
using OwlCore.Storage.System.IO; | ||
using System.Diagnostics; | ||
using System.Text; | ||
using CommunityToolkit.Diagnostics; | ||
using OwlCore.Storage; | ||
|
||
namespace OwlCore.Kubo.Tests | ||
{ | ||
[TestClass] | ||
public class FilestoreTests | ||
{ | ||
[TestMethod] | ||
public async Task TestFilestoreAsync() | ||
{ | ||
Guard.IsNotNull(TestFixture.Bootstrapper); | ||
var client = TestFixture.Client; | ||
|
||
var workingFolder = (IModifiableFolder?)await TestFixture.Bootstrapper.RepoFolder.GetParentAsync(); | ||
Guard.IsNotNull(workingFolder); | ||
|
||
var testFolder = (SystemFolder)await workingFolder.CreateFolderAsync("in", overwrite: true); | ||
|
||
// Create random data in working folder | ||
await foreach (var file in testFolder.CreateFilesAsync(2, i => $"{i}.bin", CancellationToken.None)) | ||
await file.WriteRandomBytesAsync(512, 512, CancellationToken.None); | ||
|
||
// Add the same data to filestore | ||
var filestoreFolderCid = await testFolder.GetCidAsync(client, new Ipfs.CoreApi.AddFileOptions { NoCopy = true, CidVersion = 1, }, default); | ||
|
||
// List the filestore | ||
var items = await client.Filestore.ListAsync().ToListAsync(); | ||
Assert.AreEqual(2, items.Count); | ||
|
||
// Verify duplicate don't exist yet | ||
var duplicates = await client.Filestore.DupsAsync().ToListAsync(); | ||
Assert.AreEqual(0, duplicates.Count); | ||
|
||
// Add to ipfs (without filestore) | ||
var folderCid = await testFolder.GetCidAsync(client, new Ipfs.CoreApi.AddFileOptions { NoCopy = false, RawLeaves = true, CidVersion = 1, }, default); | ||
Assert.AreEqual(folderCid, filestoreFolderCid); | ||
|
||
// Verify the filestore | ||
items = await client.Filestore.VerifyObjectsAsync().ToListAsync(); | ||
Assert.AreEqual(2, items.Count); | ||
|
||
// Verify duplicates now exist | ||
duplicates = await client.Filestore.DupsAsync().ToListAsync(); | ||
Assert.AreEqual(2, duplicates.Count); | ||
} | ||
} | ||
} |
Oops, something went wrong.