Class QBucket
This class manages the Qarnot Ceph buckets (S3 compatible).
Inherited Members
Namespace: QarnotSDK
Assembly: QarnotSDK.dll
Syntax
public class QBucket : QAbstractStorage
Constructors
QBucket(Connection, string, bool)
Create a bucket object.
Declaration
public QBucket(Connection connection, string shortname, bool create = true)
Parameters
Type | Name | Description |
---|---|---|
Connection | connection | The inner connection object. |
string | shortname | The bucket name. |
bool | create | bool, to create the resource on the api too. |
Properties
CacheTTLSec
Time to live for the resource cache (in seconds). Override the task default value DefaultResourcesCacheTTLSec
Declaration
public int? CacheTTLSec { get; protected set; }
Property Value
Type | Description |
---|---|
int? |
Connection
The inner Connection object.
Declaration
public override Connection Connection { get; }
Property Value
Type | Description |
---|---|
Connection |
Overrides
CreationDate
The bucket creation date
Declaration
public override DateTime CreationDate { get; }
Property Value
Type | Description |
---|---|
DateTime |
Overrides
FileCount
Number of files in this bucket. Use Update or UpdateAsync to refresh. Note: only available for Qarnot's Buckets.
Declaration
public override int FileCount { get; }
Property Value
Type | Description |
---|---|
int |
Overrides
Filtering
Add filtering to the bucket content so that only part of it is made available to tasks
Declaration
public ABucketFiltering Filtering { get; protected set; }
Property Value
Type | Description |
---|---|
ABucketFiltering |
ResourcesTransformation
Add a transformation to resources as seen in the execution environment
Declaration
public AResourcesTransformation ResourcesTransformation { get; protected set; }
Property Value
Type | Description |
---|---|
AResourcesTransformation |
Shortname
The bucket name.
Declaration
public override string Shortname { get; protected set; }
Property Value
Type | Description |
---|---|
string |
Overrides
UniqueId
The bucket name.
Declaration
public override string UniqueId { get; }
Property Value
Type | Description |
---|---|
string |
Overrides
UsedSpaceBytes
Size of this bucket in bytes. Use Update or UpdateAsync to refresh. Note: only available for Qarnot's Buckets.
Declaration
public override long UsedSpaceBytes { get; }
Property Value
Type | Description |
---|---|
long |
Overrides
Methods
CreateAsync(CancellationToken)
Create the bucket.
Declaration
public override Task CreateAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | A token to cancel the request. |
Returns
Type | Description |
---|---|
Task |
Overrides
DeleteAsync(CancellationToken)
Delete this bucket. Note: this method also remove all the objects inside this bucket.
Declaration
public override Task DeleteAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | Optional token to cancel the request. |
Returns
Type | Description |
---|---|
Task |
Overrides
DeleteEntryAsync(string, CancellationToken)
Delete a file or folder in this bucket. Note: this method also remove all the sub-objects inside the deleted folder.
Declaration
public override Task DeleteEntryAsync(string remotePath, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | remotePath | The entry to remove. |
CancellationToken | cancellationToken | Optional token to cancel the request. |
Returns
Type | Description |
---|---|
Task |
Overrides
DownloadStreamAsync(string, char, CancellationToken)
Get a stream on a file in this bucket.(should be disposed)
Declaration
public override Task<Stream> DownloadStreamAsync(string remoteFile, char pathDirectorySeparator, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | remoteFile | The source file name in this bucket. |
char | pathDirectorySeparator | PathDirectorySeparator char that will change the remote file path to match the folder hierarchy ('/' on linux, '' on windows). |
CancellationToken | cancellationToken | Optional token to cancel the request. |
Returns
Type | Description |
---|---|
Task<Stream> | A stream with the file's data. |
Overrides
DownloadStreamAsync(string, CancellationToken)
Get a stream on a file in this bucket.
Declaration
public override Task<Stream> DownloadStreamAsync(string remoteFile, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | remoteFile | The source file name in this bucket. |
CancellationToken | cancellationToken | Optional token to cancel the request. |
Returns
Type | Description |
---|---|
Task<Stream> | A stream with the file's data. |
Overrides
ListEntriesAsync(string, CancellationToken)
List the files and folders entries in the corresponding folder (without content of subfolders).
Declaration
public override Task<List<QAbstractStorageEntry>> ListEntriesAsync(string remoteFolder = "", CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | remoteFolder | The folder to list. |
CancellationToken | cancellationToken | Optional token to cancel the request. |
Returns
Type | Description |
---|---|
Task<List<QAbstractStorageEntry>> | A list of QAbstractStorageEntry |
Overrides
ListFilesAsync(string, CancellationToken)
List all files and folders from the root of the bucket.
Declaration
public override Task<List<QAbstractStorageEntry>> ListFilesAsync(string prefix, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | prefix | Prefix for file search. |
CancellationToken | cancellationToken | Optional token to cancel the request. |
Returns
Type | Description |
---|---|
Task<List<QAbstractStorageEntry>> | A list of storage entries |
Overrides
ListFilesAsync(CancellationToken)
List all files and folders from the root of the bucket.
Declaration
public override Task<List<QAbstractStorageEntry>> ListFilesAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | Optional token to cancel the request. |
Returns
Type | Description |
---|---|
Task<List<QAbstractStorageEntry>> | A list of storage entries |
Overrides
UpdateAsync(CancellationToken)
Update this bucket statistics.
Declaration
public override Task UpdateAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | Optional token to cancel the request. |
Returns
Type | Description |
---|---|
Task |
Overrides
UploadStreamAsync(Stream, string, char, CancellationToken)
Write a stream to a file in this bucket.
Declaration
public override Task UploadStreamAsync(Stream sourceStream, string remoteFile, char pathDirectorySeparator, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
Stream | sourceStream | The source stream. |
string | remoteFile | The destination file name in this bucket. |
char | pathDirectorySeparator | PathDirectorySeparator char that will change the remote file path to match the folder hierarchy ('/' on linux, '' on windows). |
CancellationToken | cancellationToken | Optional token to cancel the request. |
Returns
Type | Description |
---|---|
Task |
Overrides
UploadStreamAsync(Stream, string, CancellationToken)
Write a stream to a file in this bucket.
Declaration
public override Task UploadStreamAsync(Stream sourceStream, string remoteFile, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
Stream | sourceStream | The source stream. |
string | remoteFile | The destination file name in this bucket. |
CancellationToken | cancellationToken | Optional token to cancel the request. |
Returns
Type | Description |
---|---|
Task |
Overrides
WithCacheTTL(int)
Returns a copy of the bucket object with a cache TTL added
Declaration
public QBucket WithCacheTTL(int ttl)
Parameters
Type | Name | Description |
---|---|---|
int | ttl | The resources cache TTL to add |
Returns
Type | Description |
---|---|
QBucket |
WithFiltering(ABucketFiltering)
Returns a copy of the bucket object with a filtering added
Declaration
public QBucket WithFiltering(ABucketFiltering filtering)
Parameters
Type | Name | Description |
---|---|---|
ABucketFiltering | filtering | The filtering to add |
Returns
Type | Description |
---|---|
QBucket |
WithResourcesTransformation(AResourcesTransformation)
Returns a copy of the bucket object with a resources transformation added
Declaration
public QBucket WithResourcesTransformation(AResourcesTransformation transformation)
Parameters
Type | Name | Description |
---|---|---|
AResourcesTransformation | transformation | The resources transformation to add |
Returns
Type | Description |
---|---|
QBucket |