-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
210 additions
and
2 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
44 changes: 44 additions & 0 deletions
44
LeedsExperiment/Fedora/Abstractions/Transfer/BinaryFile.cs
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,44 @@ | ||
namespace Fedora.Abstractions.Transfer; | ||
|
||
/// <summary> | ||
/// Used when importing new files into the repository from a source location (disk or S3) | ||
/// or exporting to a location | ||
/// </summary> | ||
public class BinaryFile | ||
{ | ||
/// <summary> | ||
/// The repository path (not a full Uri), will end with Slug | ||
/// Only contains permitted characters (e.g., no spaces) | ||
/// </summary> | ||
public required string Path { get; set; } | ||
|
||
/// <summary> | ||
/// An S3 key, a filesystem path - somewhere accessible to the Preservation API, to import from or export to | ||
/// </summary> | ||
public required string Location { get; set; } | ||
|
||
public required string StorageType { get; set; } | ||
|
||
/// <summary> | ||
/// Only contains permitted characters (e.g., no spaces) | ||
/// </summary> | ||
public string Slug => Path.Split('/')[^1]; | ||
|
||
/// <summary> | ||
/// The name of the resource in Fedora (dc:title) | ||
/// </summary> | ||
public required string Name { get; set; } | ||
|
||
/// <summary> | ||
/// The Original / actual name of the file, rather than the path-safe, reduced character set slug | ||
/// </summary> | ||
public required string FileName { get; set; } | ||
|
||
// NB ^^^ for a filename like readme.txt, Slug, Name and FileName will all be the same. | ||
// And in practice, Name and FileName are going ot be the same | ||
// But Slug may differ as it always must be in the reduced character set | ||
|
||
public required string ContentType { get; set; } | ||
|
||
public string? Digest { get; set; } | ||
} |
17 changes: 17 additions & 0 deletions
17
LeedsExperiment/Fedora/Abstractions/Transfer/ContainerDirectory.cs
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,17 @@ | ||
namespace Fedora.Abstractions.Transfer; | ||
|
||
public class ContainerDirectory | ||
{ | ||
/// <summary> | ||
/// The repository path (not a full Uri), will end with Slug | ||
/// Only contains permitted characters (e.g., no spaces) | ||
/// </summary> | ||
public required string Path { get; set; } | ||
|
||
public string Slug => Path.Split('/')[^1]; | ||
|
||
/// <summary> | ||
/// The name of the resource in Fedora (dc:title) | ||
/// </summary> | ||
public required string Name { get; set; } | ||
} |
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,8 @@ | ||
| ||
namespace Fedora.Storage; | ||
|
||
public static class StorageTypes | ||
{ | ||
public const string S3 = "S3"; | ||
public const string FileSystem = "FileSystem"; | ||
} |
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,26 @@ | ||
| ||
using Fedora.Abstractions.Transfer; | ||
using Fedora.Storage; | ||
|
||
namespace Preservation; | ||
|
||
public class ExportResult | ||
{ | ||
/// <summary> | ||
/// For info - the path of the source archival group | ||
/// </summary> | ||
public required string Path { get; set; } | ||
|
||
/// <summary> | ||
/// The version that was exported | ||
/// </summary> | ||
public required ObjectVersion Version { get; set; } | ||
public DateTime Start { get; set; } | ||
public DateTime End { get; set; } | ||
|
||
// The root location (S3 Uri, directory path) where the ArchivalGroup has been exported | ||
public required string Source { get; set; } | ||
public required string StorageType { get; set; } | ||
|
||
public List<BinaryFile> Files { get; set; } = []; | ||
} |
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,57 @@ | ||
using Fedora.Abstractions.Transfer; | ||
using Fedora.Storage; | ||
|
||
namespace Preservation; | ||
|
||
public class ImportJob | ||
{ | ||
public required string ArchivalGroupPath { get; set; } | ||
// Must be an S3 URI, for now | ||
public required string Source { get; set; } | ||
public required string StorageType { get; set; } | ||
|
||
public Uri? ArchivalGroupUri { get; set; } | ||
|
||
|
||
public DateTime DiffStart { get; set; } | ||
public DateTime DiffEnd { get; set; } | ||
|
||
/// <summary> | ||
/// What version at HEAD is this diff based on? | ||
/// When it comes to execute the job, need to make sure it's the same | ||
/// And then execute the update in a transaction. | ||
/// (null if a new object, IsUpdate = false) | ||
/// </summary> | ||
public ObjectVersion? DiffVersion { get; set; } | ||
|
||
public List<ContainerDirectory> ContainersToAdd { get; set; } = []; | ||
public List<BinaryFile> FilesToAdd { get; set; } = []; | ||
public List<BinaryFile> FilesToDelete { get; set; } = []; | ||
public List<BinaryFile> FilesToPatch { get; set; } = []; | ||
// FilesToRename? | ||
|
||
/// <summary> | ||
/// While any required new containers can be created as files are added (create along path), | ||
/// we may end up with containers that have no files in them; these need to be deleted from Fedora. | ||
/// </summary> | ||
public List<ContainerDirectory> ContainersToDelete { get; set; } = []; | ||
|
||
|
||
public List<ContainerDirectory> ContainersAdded { get; set; } = []; | ||
public List<BinaryFile> FilesAdded { get; set; } = []; | ||
public List<BinaryFile> FilesDeleted { get; set; } = []; | ||
public List<BinaryFile> FilesPatched { get; set; } = []; | ||
public List<ContainerDirectory> ContainersDeleted { get; set; } = []; | ||
|
||
// Must be explicitly set to true to allow an update of an existing ArchivalGroup | ||
public bool IsUpdate { get; set; } | ||
|
||
|
||
public DateTime Start { get; set; } | ||
public DateTime End { get; set; } | ||
|
||
|
||
public ObjectVersion? NewVersion { get; set; } | ||
|
||
|
||
} |
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