コード例 #1
0
		/// <summary>
		/// Read from the blob, starting at <paramref name="offset"/>, retrieving up to <paramref name="n"/> bytes (fewer then n bytes are returned when the end of the blob is reached).
		/// </summary>
		public static Task<Slice> ReadAsync(this FdbBlob blob, IFdbReadOnlyTransactional db, long offset, int n, CancellationToken cancellationToken)
		{
			if (blob == null) throw new ArgumentNullException("blob");
			if (db == null) throw new ArgumentNullException("db");

			return db.ReadAsync((tr) => blob.ReadAsync(tr, offset, n), cancellationToken);
		}
コード例 #2
0
		/// <summary>
		/// Get the size (in bytes) of the blob.
		/// </summary>
		public static Task<long?> GetSizeAsync(this FdbBlob blob, IFdbReadOnlyTransactional db, CancellationToken cancellationToken)
		{
			if (blob == null) throw new ArgumentNullException("blob");
			if (db == null) throw new ArgumentNullException("db");

			return db.ReadAsync((tr) => blob.GetSizeAsync(tr), cancellationToken);
		}
コード例 #3
0
		/// <summary>Returns the list of all the subdirectories of the current directory, it it exists.</summary>
		public static Task<List<string>> TryListAsync(this FdbDirectorySubspace subspace, IFdbReadOnlyTransactional db, CancellationToken cancellationToken)
		{
			if (subspace == null) throw new ArgumentNullException("subspace");
			if (db == null) throw new ArgumentNullException("db");
			return db.ReadAsync((tr) => subspace.TryListAsync(tr), cancellationToken);
		}
コード例 #4
0
		/// <summary>Returns the list of subdirectories of the sub-directory with the given <paramref name="name"/>, if it exists</summary>
		public static Task<List<string>> TryListAsync(this IFdbDirectory directory, IFdbReadOnlyTransactional db, 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.TryListAsync(tr, new [] { name }), cancellationToken);
		}
コード例 #5
0
		/// <summary>Returns the list of subdirectories of directory at <paramref name="path"/>, if it exists</summary>
		public static Task<List<string>> TryListAsync(this IFdbDirectory directory, IFdbReadOnlyTransactional db, 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.TryListAsync(tr, path), cancellationToken);
		}
コード例 #6
0
		/// <summary>Attempts to open the directory with the given <paramref name="name"/>.</summary>
		public static Task<FdbDirectorySubspace> TryOpenAsync(this IFdbDirectory directory, IFdbReadOnlyTransactional db, 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);
		}