IStore

Namespace: Proffer.Storage

A store allows to save, list or read files on a container in its configured IStorageProvider.

public interface IStore

Properties

Name

Gets the name of the store.

public abstract string Name { get; }

Property Value

String

Methods

InitAsync(CancellationToken)

Initializes the store by creating a container in its IStorageProvider.

Task InitAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

Returns

Task
A task that represents the asynchronous operation.

ListAsync(String, Boolean, Boolean)

Lists the files under .

ValueTask<IFileReference[]> ListAsync(string path, bool recursive, bool withMetadata)

Parameters

path String
The path.

recursive Boolean
If set to true, recurse the listing across folders.

withMetadata Boolean
If set to true, fetch metadata for each file.

Returns

ValueTask<IFileReference[]>
The list under .

ListAsync(String, String, Boolean, Boolean)

Lists the files under matching the .

ValueTask<IFileReference[]> ListAsync(string path, string searchPattern, bool recursive, bool withMetadata)

Parameters

path String
The path.

searchPattern String
The search pattern.

recursive Boolean
If set to true, recurse the listing across folders.

withMetadata Boolean
If set to true, fetch metadata for each file.

Returns

ValueTask<IFileReference[]>
The list under matching the .

GetAsync(IPrivateFileReference, Boolean)

Gets the file reference from path.

ValueTask<IFileReference> GetAsync(IPrivateFileReference file, bool withMetadata)

Parameters

file IPrivateFileReference
The reference holding the file path.

withMetadata Boolean
If set to true, fetch metadata for the file.

Returns

ValueTask<IFileReference>
The at path.

GetAsync(Uri, Boolean)

Gets the file reference from URI.

ValueTask<IFileReference> GetAsync(Uri uri, bool withMetadata)

Parameters

uri Uri
The file uniform resource identifier (URI).

withMetadata Boolean
If set to true, fetch metadata for the file.

Returns

ValueTask<IFileReference>
The at path.

Exceptions

InvalidOperationException

DeleteAsync(IPrivateFileReference)

Deletes the file.

Task DeleteAsync(IPrivateFileReference file)

Parameters

file IPrivateFileReference
The reference holding the file path.

Returns

Task
A task that represents the asynchronous operation.

ReadAsync(IPrivateFileReference)

Reads the file content.

ValueTask<Stream> ReadAsync(IPrivateFileReference file)

Parameters

file IPrivateFileReference
The reference holding the file path.

Returns

ValueTask<Stream>
A containing the file content.

ReadAllBytesAsync(IPrivateFileReference)

Reads the file content.

ValueTask<Byte[]> ReadAllBytesAsync(IPrivateFileReference file)

Parameters

file IPrivateFileReference
The reference holding the file path.

Returns

ValueTask<Byte[]>
A containing the file content.

ReadAllTextAsync(IPrivateFileReference)

Reads the file content.

ValueTask<string> ReadAllTextAsync(IPrivateFileReference file)

Parameters

file IPrivateFileReference
The reference holding the file path.

Returns

ValueTask<String>
A containing the file content.

SaveAsync(Byte[], IPrivateFileReference, String, OverwritePolicy, IDictionary<String, String>)

Saves the file.

ValueTask<IFileReference> SaveAsync(Byte[] data, IPrivateFileReference file, string contentType, OverwritePolicy overwritePolicy, IDictionary<string, string> metadata)

Parameters

data Byte[]
The file content.

file IPrivateFileReference
The reference holding the file path.

contentType String
The content-type of the file.

overwritePolicy OverwritePolicy
The overwrite policy.

metadata IDictionary<String, String>
The metadata.

Returns

ValueTask<IFileReference>
The saved .

Exceptions

FileAlreadyExistsException

SaveAsync(Stream, IPrivateFileReference, String, OverwritePolicy, IDictionary<String, String>)

Saves the file.

ValueTask<IFileReference> SaveAsync(Stream data, IPrivateFileReference file, string contentType, OverwritePolicy overwritePolicy, IDictionary<string, string> metadata)

Parameters

data Stream
The file content.

file IPrivateFileReference
The reference holding the file path.

contentType String
The content-type of the file.

overwritePolicy OverwritePolicy
The overwrite policy.

metadata IDictionary<String, String>
The metadata.

Returns

ValueTask<IFileReference>
The saved .

Exceptions

FileAlreadyExistsException

GetSharedAccessSignatureAsync(ISharedAccessPolicy)

Gets a shared access signature.

ValueTask<string> GetSharedAccessSignatureAsync(ISharedAccessPolicy policy)

Parameters

policy ISharedAccessPolicy
The policy.

Returns

ValueTask<String>
A shared access signature to read or list the store files.

Exceptions

NotSupportedException