/// <summary>Returns the list of subdirectories of the sub-directory with the given <paramref name="name"/>.</summary> public static Task <List <string> > ListAsync([NotNull] this IFdbDirectory directory, [NotNull] IFdbReadOnlyRetryable db, [NotNull] string name, CancellationToken cancellationToken) { if (directory == null) { throw new ArgumentNullException("directory"); } if (db == null) { throw new ArgumentNullException("db"); } if (name == null) { throw new ArgumentNullException("name"); } return(db.ReadAsync((tr) => directory.ListAsync(tr, new [] { name }), cancellationToken)); }
/// <summary>Attempts to open the directory with the given <paramref name="path"/>.</summary> public static Task <FdbDirectorySubspace> TryOpenAsync([NotNull] this IFdbDirectory directory, [NotNull] IFdbReadOnlyRetryable db, FdbDirectoryPath path, Slice layer, CancellationToken ct) { Contract.NotNull(directory, nameof(directory)); Contract.NotNull(db, nameof(db)); return(db.ReadAsync((tr) => directory.TryOpenAsync(tr, path, layer), ct)); }
/// <summary>Checks if this directory exists</summary> /// <returns>Returns true if the directory exists, otherwise false.</returns> public static Task <bool> ExistsAsync([NotNull] this FdbDirectorySubspace subspace, [NotNull] IFdbReadOnlyRetryable db, CancellationToken cancellationToken) { if (subspace == null) { throw new ArgumentNullException("subspace"); } if (db == null) { throw new ArgumentNullException("db"); } return(db.ReadAsync((tr) => subspace.ExistsAsync(tr), cancellationToken)); }
/// <summary>Returns the list of subdirectories of directory at <paramref name="path"/>.</summary> public static Task <List <string> > ListAsync([NotNull] this IFdbDirectory directory, [NotNull] IFdbReadOnlyRetryable db, [NotNull] IEnumerable <string> path, CancellationToken cancellationToken) { if (directory == null) { throw new ArgumentNullException("directory"); } if (db == null) { throw new ArgumentNullException("db"); } if (path == null) { throw new ArgumentNullException("path"); } return(db.ReadAsync((tr) => directory.ListAsync(tr, path), cancellationToken)); }
/// <summary>Attempts to open the directory with the given <paramref name="path"/>.</summary> public static Task <FdbDirectorySubspace> TryOpenAsync([NotNull] this IFdbDirectory directory, [NotNull] IFdbReadOnlyRetryable db, [NotNull] IEnumerable <string> path, Slice layer, CancellationToken cancellationToken) { if (directory == null) { throw new ArgumentNullException("directory"); } if (db == null) { throw new ArgumentNullException("db"); } if (path == null) { throw new ArgumentNullException("path"); } return(db.ReadAsync((tr) => directory.TryOpenAsync(tr, path, layer), cancellationToken)); }
/// <summary>Attempts to open the directory with the given <paramref name="name"/>.</summary> public static Task <FdbDirectorySubspace> TryOpenAsync([NotNull] this IFdbDirectory directory, [NotNull] IFdbReadOnlyRetryable db, [NotNull] string name, Slice layer, CancellationToken cancellationToken) { if (directory == null) { throw new ArgumentNullException("directory"); } if (db == null) { throw new ArgumentNullException("db"); } if (name == null) { throw new ArgumentNullException("name"); } return(db.ReadAsync((tr) => directory.TryOpenAsync(tr, new[] { name }, layer), cancellationToken)); }
/// <summary>Attempts to open the directory with the given <paramref name="name"/>.</summary> public static Task <FdbDirectorySubspace> TryOpenAsync([NotNull] this IFdbDirectory directory, [NotNull] IFdbReadOnlyRetryable db, [NotNull] string name, CancellationToken ct) { if (directory == null) { throw new ArgumentNullException(nameof(directory)); } if (db == null) { throw new ArgumentNullException(nameof(db)); } if (name == null) { throw new ArgumentNullException(nameof(name)); } return(db.ReadAsync((tr) => directory.TryOpenAsync(tr, new[] { name }, Slice.Nil), ct)); }
/// <summary>Resolve a single key selector from the database, using a dedicated transaction.</summary> /// <param name="db">Database instance</param> /// <remarks> /// Use this method only if you intend to perform a single operation inside your execution context (ex: HTTP request). /// If you need to combine multiple read or write operations, consider using on of the multiple <see cref="IFdbReadOnlyRetryable.ReadAsync"/> or <see cref="IFdbRetryable.ReadWriteAsync"/> overrides. /// </remarks> public static Task <Slice> GetKeyAsync([NotNull] this IFdbReadOnlyRetryable db, KeySelector keySelector, CancellationToken ct) { Contract.NotNull(db, nameof(db)); return(db.ReadAsync((tr) => tr.GetKeyAsync(keySelector), ct)); }
/// <summary>Returns the list of subdirectories of directory at <paramref name="path"/>, if it exists</summary> public static Task <List <string> > TryListAsync([NotNull] this IFdbDirectory directory, [NotNull] IFdbReadOnlyRetryable db, IEnumerable <string> path, CancellationToken ct) { if (directory == null) { throw new ArgumentNullException(nameof(directory)); } if (db == null) { throw new ArgumentNullException(nameof(db)); } if (path == null) { throw new ArgumentNullException(nameof(path)); //REVIEW: or not? } return(db.ReadAsync((tr) => directory.TryListAsync(tr, path), ct)); }
/// <summary>Returns the list of all the subdirectories of the current directory, it it exists.</summary> public static Task <List <string> > TryListAsync([NotNull] this FdbDirectorySubspace subspace, [NotNull] IFdbReadOnlyRetryable db, CancellationToken ct) { if (subspace == null) { throw new ArgumentNullException(nameof(subspace)); } if (db == null) { throw new ArgumentNullException(nameof(db)); } return(db.ReadAsync((tr) => subspace.TryListAsync(tr), ct)); }
/// <summary>Returns the list of subdirectories of the current directory.</summary> public static Task <List <string> > ListAsync([NotNull] this IFdbDirectory directory, [NotNull] IFdbReadOnlyRetryable db, CancellationToken ct) { if (directory == null) { throw new ArgumentNullException(nameof(directory)); } if (db == null) { throw new ArgumentNullException(nameof(db)); } return(db.ReadAsync((tr) => directory.ListAsync(tr), ct)); }
/// <summary>Read a single page of a range query from the database, using a dedicated transaction.</summary> /// <param name="db">Database instance</param> /// <remarks> /// Use this method only if you intend to perform a single operation inside your execution context (ex: HTTP request). /// If you need to combine multiple read or write operations, consider using on of the multiple <see cref="IFdbReadOnlyRetryable.ReadAsync"/> or <see cref="IFdbRetryable.ReadWriteAsync"/> overrides. /// </remarks> public static Task <FdbRangeChunk> GetRangeAsync([NotNull] this IFdbReadOnlyRetryable db, KeySelector beginInclusive, KeySelector endExclusive, FdbRangeOptions options, int iteration, CancellationToken ct) { Contract.NotNull(db, nameof(db)); return(db.ReadAsync((tr) => tr.GetRangeAsync(beginInclusive, endExclusive, options, iteration), ct)); }
public static Task <Slice[]> GetKeysAsync([NotNull] this IFdbReadOnlyRetryable db, [NotNull] IEnumerable <KeySelector> keySelectors, CancellationToken ct) { Contract.NotNull(db, nameof(db)); Contract.NotNull(keySelectors, nameof(keySelectors)); return(db.ReadAsync((tr) => tr.GetKeysAsync(keySelectors), ct)); }
/// <summary>Removes the directory, its contents, and all subdirectories. #endregion #region Exists... /// <summary>Checks if a directory already exists</summary> /// <returns>Returns true if the directory exists, otherwise false.</returns> public static Task <bool> ExistsAsync([NotNull] this IFdbDirectory directory, [NotNull] IFdbReadOnlyRetryable db, FdbDirectoryPath path, CancellationToken ct) { Contract.NotNull(directory, nameof(directory)); Contract.NotNull(db, nameof(db)); return(db.ReadAsync((tr) => directory.ExistsAsync(tr, path), ct)); }
/// <summary>Checks if a directory already exists</summary> /// <returns>Returns true if the directory exists, otherwise false.</returns> public static Task <bool> ExistsAsync([NotNull] this IFdbDirectory directory, [NotNull] IFdbReadOnlyRetryable db, [NotNull] string name, CancellationToken ct) { if (directory == null) { throw new ArgumentNullException(nameof(directory)); } if (db == null) { throw new ArgumentNullException(nameof(db)); } if (name == null) { throw new ArgumentNullException(nameof(name)); } return(db.ReadAsync((tr) => directory.ExistsAsync(tr, new[] { name }), ct)); }
/// <summary>Checks if this directory exists</summary> /// <returns>Returns true if the directory exists, otherwise false.</returns> public static Task <bool> ExistsAsync([NotNull] this FdbDirectorySubspace subspace, [NotNull] IFdbReadOnlyRetryable db, CancellationToken ct) { Contract.NotNull(subspace, nameof(subspace)); Contract.NotNull(db, nameof(db)); return(db.ReadAsync((tr) => subspace.ExistsAsync(tr), ct)); }
public static Task <Slice[]> GetValuesAsync([NotNull] this IFdbReadOnlyRetryable db, [NotNull] Slice[] keys, CancellationToken ct) { Contract.NotNull(db, nameof(db)); return(db.ReadAsync((tr) => tr.GetValuesAsync(keys), ct)); }