Skip to content

IWritableVault: Support for renaming entities #39

@SakuraIsayeki

Description

@SakuraIsayeki

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions