示例#1
0
        /// <summary>Attempts to create a directory with the given <paramref name="path"/> (creating parent directories if necessary).
        /// 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> TryCreateAsync([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.ReadWriteAsync((tr) => directory.TryCreateAsync(tr, path, layer), ct));
        }
 /// <summary>Attempts to create a directory with the given <paramref name="name"/>.
 /// 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> TryCreateAsync([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.TryCreateAsync(tr, new[] { name }, layer), ct));
 }
 /// <summary>Attempts to create a directory with the given <paramref name="name"/>.</summary>
 public static Task <FdbDirectorySubspace> TryCreateAsync([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.TryCreateAsync(tr, new [] { name }, Slice.Nil), cancellationToken));
 }
        /// <summary>Attempts to create a directory with the given <paramref name="name"/>.
        /// 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> TryCreateAsync([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.TryCreateAsync(trans, new[] { name }, layer));
        }
        /// <summary>Attempts to create a directory with the given <paramref name="path"/> (creating parent directories if necessary).</summary>
        public static Task <FdbDirectorySubspace> TryCreateAsync([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.TryCreateAsync(tr, path, Slice.Nil), ct));
        }
        /// <summary>Attempts to create a directory with the given <paramref name="path"/> (creating parent directories if necessary).
        /// 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> TryCreateAsync([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.TryCreateAsync(tr, path, layer), cancellationToken));
        }
示例#7
0
 public Task <FdbDirectorySubspace> TryCreateAsync([NotNull] string name, CancellationToken cancellationToken)
 {
     return(m_database.ReadWriteAsync((tr) => m_directory.TryCreateAsync(tr, new [] { name }, Slice.Nil), cancellationToken));
 }