/// <summary>Returns the list of all the subdirectories of a sub-directory.</summary> public Task <List <string> > ListAsync(IFdbReadOnlyTransaction trans, FdbDirectoryPath path) { Contract.NotNull(trans, nameof(trans)); return(this.DirectoryLayer.ListInternalAsync(trans, ToRelativePath(path), throwIfMissing: true)); }
/// <summary>Opens a sub-directory with the given <paramref name="path"/>. /// An exception is thrown if the sub-directory if a layer is specified and a different layer was specified when the sub-directory was created. /// </summary> /// <param name="trans">Transaction to use for the operation</param> /// <param name="path">Relative path of the sub-directory to open</param> /// <param name="layer">If specified, the opened directory must have the same layer id.</param> /// <returns>Returns the directory if it exists, or null if it was not found</returns> public Task <FdbDirectorySubspace> TryOpenAsync(IFdbReadOnlyTransaction trans, FdbDirectoryPath path, Slice layer = default) { Contract.NotNull(trans, nameof(trans)); if (path.IsEmpty) { throw new ArgumentNullException(nameof(path)); } return(this.DirectoryLayer.CreateOrOpenInternalAsync(trans, null, ToRelativePath(path), layer, prefix: Slice.Nil, allowCreate: false, allowOpen: true, throwOnError: false)); }
/// <summary>Attempts to move the specified sub-directory to <paramref name="newPath"/>. /// There is no effect on the physical prefix of the given directory, or on clients that already have the directory open. /// An error is raised if a directory already exists at `new_path`. /// </summary> /// <param name="trans">Transaction to use for the operation</param> /// <param name="oldPath">Relative path under this directory of the sub-directory to be moved</param> /// <param name="newPath">Relative path under this directory where the sub-directory will be moved to</param> /// <returns>Returns the directory at its new location if successful. If the directory cannot be moved, then null is returned.</returns> Task <FdbDirectorySubspace> IFdbDirectory.TryMoveAsync(IFdbTransaction trans, FdbDirectoryPath oldPath, FdbDirectoryPath newPath) { return(this.DirectoryLayer.TryMoveAsync(trans, this.ToRelativePath(oldPath).ToArray <string>(), this.ToRelativePath(newPath).ToArray <string>())); }
protected IVarTuple ToRelativePath(FdbDirectoryPath path) { return(ToRelativePath(path.IsEmpty ? null : STuple.FromEnumerable <string>(path.Segments))); }