Ejemplo n.º 1
0
        /// <summary>Opens the directory with the given <paramref name="path"/>.
        /// An error is raised if the directory does not exist, or if a layer is specified and a different layer was specified when the directory was created.
        /// </summary>
        public static Task <FdbDirectorySubspace> OpenAsync([NotNull] this IFdbDirectory directory, [NotNull] IFdbRetryable db, FdbDirectoryPath path, Slice layer, CancellationToken ct)
        {
            Contract.NotNull(directory, nameof(directory));
            Contract.NotNull(db, nameof(db));

            return(db.ReadAsync((tr) => directory.OpenAsync(tr, path, layer), ct));
        }
        /// <summary>Opens the sub-directory with the given <paramref name="name"/>.
        /// An error is raised if the directory does not exist, or if a layer is specified and a different layer was specified when the directory was created.
        /// </summary>
        public static Task <FdbDirectorySubspace> OpenAsync([NotNull] this IFdbDirectory directory, [NotNull] IFdbRetryable db, [NotNull] string name, Slice layer, 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.OpenAsync(tr, new[] { name }, layer), ct));
        }
        /// <summary>Opens the directory with the given <paramref name="path"/>.
        /// An error is raised if the directory does not exist.
        /// </summary>
        public static Task <FdbDirectorySubspace> OpenAsync([NotNull] this IFdbDirectory directory, [NotNull] IFdbRetryable db, [NotNull] 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));
            }

            return(db.ReadAsync((tr) => directory.OpenAsync(tr, path, Slice.Nil), ct));
        }
        /// <summary>Opens the sub-directory with the given <paramref name="name"/>.
        /// An error is raised if the directory does not exist.
        /// </summary>
        public static Task <FdbDirectorySubspace> OpenAsync([NotNull] this IFdbDirectory directory, [NotNull] IFdbRetryable 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.OpenAsync(tr, new[] { name }, Slice.Nil), cancellationToken));
        }
        /// <summary>Opens the directory with the given <paramref name="path"/>.
        /// An error is raised if the directory does not exist, or if a layer is specified and a different layer was specified when the directory was created.
        /// </summary>
        public static Task <FdbDirectorySubspace> OpenAsync([NotNull] this IFdbDirectory directory, [NotNull] IFdbRetryable 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.OpenAsync(tr, path, layer), cancellationToken));
        }