Skip to content
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

IWritableVault: Support for renaming entities #39

Open
SakuraIsayeki opened this issue Apr 6, 2024 · 0 comments
Open

IWritableVault: Support for renaming entities #39

SakuraIsayeki opened this issue Apr 6, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@SakuraIsayeki
Copy link
Member

SakuraIsayeki commented Apr 6, 2024

Problem

As a downstream developer, I have no key-in-hand solution to rename a vault entity. I must implement my own solution.

Solution

Implement three new methods to IWritableVault:

/// <summary>
/// Moves a folder to a new location.
/// </summary>
/// <param name="sourcePath">The path of the folder to move.</param>
/// <param name="destinationPath">The path to move the folder to.</param>
/// <returns>A task containing the moved folder as its result.</returns>
/// <exception cref="ArgumentException">Thrown if the specified path is invalid.</exception>
/// <exception cref="InvalidOperationException">Thrown if a folder with the specified path already exists.</exception>
/// <exception cref="IOException">Thrown if an I/O error occurs.</exception>
ValueTask<IVaultFolder> MoveFolderAsync(string sourcePath, string destinationPath);

/// <summary>
/// Moves a file to a new location.
/// </summary>
/// <param name="sourcePath">The path of the file to move.</param>
/// <param name="destinationPath">The path to move the file to.</param>
/// <returns>A task containing the moved file as its result.</returns>
/// <exception cref="ArgumentException">Thrown if the specified path is invalid.</exception>
/// <exception cref="InvalidOperationException">Thrown if a file with the specified path already exists.</exception>
/// <exception cref="IOException">Thrown if an I/O error occurs.</exception>
ValueTask<IVaultFile> MoveFileAsync(string sourcePath, string destinationPath);

/// <summary>
/// Moves a note to a new location.
/// </summary>
/// <param name="sourcePath">The path of the note to move.</param>
/// <param name="destinationPath">The path to move the note to.</param>
/// <returns>A task containing the moved note as its result.</returns>
/// <exception cref="ArgumentException">Thrown if the specified path is invalid.</exception>
/// <exception cref="InvalidOperationException">Thrown if a note with the specified path already exists.</exception>
/// <exception cref="IOException">Thrown if an I/O error occurs.</exception>
ValueTask<IVaultNote> MoveNoteAsync(string sourcePath, string destinationPath);

Notes

Given the complexity in propagating changes, and the as of yet limited utility in entity renaming, we deliberately omitted the implementation of rename operations. This issue aims at implementing this feature as needed, at a later time.

@SakuraIsayeki SakuraIsayeki added the enhancement New feature or request label Apr 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Development

No branches or pull requests

1 participant