예제 #1
0
        /// <summary>Creates a directory with the given <paramref name="path"/> (creating parent directories if necessary).
        /// An error is raised if the given directory already exists.
        /// </summary>
        public static Task <FdbDirectorySubspace> CreateAsync([NotNull] this IFdbDirectory directory, [NotNull] IFdbRetryable db, FdbDirectoryPath path, CancellationToken ct)
        {
            Contract.NotNull(directory, nameof(directory));
            Contract.NotNull(db, nameof(db));

            return(db.ReadWriteAsync((tr) => directory.CreateAsync(tr, path, Slice.Nil), ct));
        }
        /// <summary>Creates a directory with the given <paramref name="name"/>.
        /// An error is raised if the given directory already exists.
        /// If <paramref name="layer"/> is specified, it is recorded with the directory and will be checked by future calls to open.
        /// </summary>
        public static Task <FdbDirectorySubspace> CreateAsync([NotNull] this IFdbDirectory directory, [NotNull] IFdbTransaction trans, [NotNull] string name, Slice layer = default(Slice))
        {
            if (directory == null)
            {
                throw new ArgumentNullException(nameof(directory));
            }
            if (trans == null)
            {
                throw new ArgumentNullException(nameof(trans));
            }
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }

            return(directory.CreateAsync(trans, new[] { name }, layer));
        }
        /// <summary>Creates a directory with the given <paramref name="name"/>.
        /// An error is raised if the given directory already exists.
        /// If <paramref name="layer"/> is specified, it is recorded with the directory and will be checked by future calls to open.
        /// </summary>
        public static Task <FdbDirectorySubspace> CreateAsync([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.ReadWriteAsync((tr) => directory.CreateAsync(tr, new[] { name }, layer), ct));
        }
        /// <summary>Creates a directory with the given <paramref name="path"/> (creating parent directories if necessary).
        /// An error is raised if the given directory already exists.
        /// </summary>
        public static Task <FdbDirectorySubspace> CreateAsync([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.ReadWriteAsync((tr) => directory.CreateAsync(tr, path, Slice.Nil), ct));
        }
        /// <summary>Creates a directory with the given <paramref name="name"/>.
        /// An error is raised if the given directory already exists.
        /// </summary>
        public static Task <FdbDirectorySubspace> CreateAsync([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.ReadWriteAsync((tr) => directory.CreateAsync(tr, new [] { name }, Slice.Nil), cancellationToken));
        }
        /// <summary>Creates a directory with the given <paramref name="path"/> (creating parent directories if necessary).
        /// An error is raised if the given directory already exists.
        /// If <paramref name="layer"/> is specified, it is recorded with the directory and will be checked by future calls to open.
        /// </summary>
        public static Task <FdbDirectorySubspace> CreateAsync([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.ReadWriteAsync((tr) => directory.CreateAsync(tr, path, layer), cancellationToken));
        }
예제 #7
0
 public Task <FdbDirectorySubspace> CreateAsync([NotNull] string name, CancellationToken cancellationToken)
 {
     return(m_database.ReadWriteAsync((tr) => m_directory.CreateAsync(tr, new[] { name }, Slice.Nil), cancellationToken));
 }