Interface IStorage
The storage interface, inherit StorageBase for implementing your own storage.
Namespace: Bayat.SaveSystem.Storage
Assembly: Bayat.SaveSystem.Runtime.dll
Syntax
public interface IStorage
Properties
| Improve this Doc View SourceBackupSuffix
The backup item identifier suffix of this storage.
Declaration
string BackupSuffix { get; }
Property Value
Type | Description |
---|---|
System.String |
CatalogIdentifier
The catalog identifier of this storage.
Declaration
string CatalogIdentifier { get; }
Property Value
Type | Description |
---|---|
System.String |
MetaSuffix
The meta item identifier suffix of this storage.
Declaration
string MetaSuffix { get; }
Property Value
Type | Description |
---|---|
System.String |
TextEncoding
The storage text encoding.
Declaration
Encoding TextEncoding { get; set; }
Property Value
Type | Description |
---|---|
System.Text.Encoding |
UseCatalog
Gets or sets whether to use catalog or not.
Declaration
bool UseCatalog { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
UseMetaData
Gets or sets whether to use meta data or not.
Declaration
bool UseMetaData { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Methods
| Improve this Doc View SourceClear()
Clears all items in the storage, this method will delete all items in the storage so use it at your own risk.
Declaration
Task<StorageClearOperationResult> Clear()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<StorageClearOperationResult> | True if operation was successful otherwise false |
CommitWriteStream(IStorageStream)
Commits the writable stream changes.
Declaration
Task CommitWriteStream(IStorageStream stream)
Parameters
Type | Name | Description |
---|---|---|
IStorageStream | stream | The stream to commit its changes |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Copy(String, String, Boolean)
Copies the specified item to the new location.
Declaration
Task<StorageCopyOperationResult> Copy(string fromIdentifier, string toIdentifier, bool replace)
Parameters
Type | Name | Description |
---|---|---|
System.String | fromIdentifier | The item source location |
System.String | toIdentifier | The itme destination location |
System.Boolean | replace | Replace the item at the destination or not if exists |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<StorageCopyOperationResult> | True if operation was successful otherwise false |
CreateBackup(String)
Creates a new backup for the storage item.
Declaration
Task<StorageBackup> CreateBackup(string identifier)
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<StorageBackup> | The created backup information StorageBackup |
Delete(String)
Deletes the specified item.
Declaration
Task<StorageDeleteOperationResult> Delete(string identifier)
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The item identifier |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<StorageDeleteOperationResult> | True if operation was successful otherwise false |
DeleteBackup(String, StorageBackup)
Deletes the specified backup for the storage item.
Declaration
Task<StorageDeleteOperationResult> DeleteBackup(string identifier, StorageBackup backup)
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The storage item identifier |
StorageBackup | backup | The backup information |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<StorageDeleteOperationResult> | True if operation was successful otherwise false |
DeleteBackups(String)
Deletes all the backups for the storage item.
Declaration
Task<bool> DeleteBackups(string identifier)
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The storage item identifier |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Boolean> | True if operation was successful otherwise false |
DeleteMetaData(String)
Deletes the specified item meta data.
Declaration
Task<StorageDeleteOperationResult> DeleteMetaData(string identifier)
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<StorageDeleteOperationResult> | True if operation was successful otherwise false |
Exists(String)
Checks whether the specified item exists or not.
Declaration
Task<bool> Exists(string identifier)
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The item identifier |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Boolean> | True if item exists otherwise false |
GetBackups(String)
Gets the storage item backups.
Declaration
Task<List<StorageBackup>> GetBackups(string identifier)
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The storage item identifier to get backups from |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Collections.Generic.List<StorageBackup>> | The storage item backups |
GetLatestBackup(String)
Gets the latest backup information.
Declaration
Task<StorageBackup> GetLatestBackup(string identifier)
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The storage item identifier to get latest backup from |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<StorageBackup> | The latest backup information |
GetReadStream(String)
Retrieves a readable stream from the storage.
Declaration
Task<IStorageStream> GetReadStream(string identifier)
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The item identifier |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<IStorageStream> | A readable storage stream wrapper |
GetWriteStream(String)
Retrieves a writable stream from the storage.
Declaration
Task<IStorageStream> GetWriteStream(string identifier)
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The item identifier |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<IStorageStream> | A writable storage stream wrapper |
HasMetaData(String)
Checks whether the specified item has meta data or not.
Declaration
Task<bool> HasMetaData(string identifier)
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The item identifier |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Boolean> | True if the specified item has meta data otherwise false |
List(String, StorageListOptions)
Lists items available at the specified location.
Declaration
Task<string[]> List(string identifier, StorageListOptions options)
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The location to look for items |
StorageListOptions | options | The list options |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.String[]> | An array of items found at the specified location |
ListAll()
Lists all available items.
Declaration
Task<string[]> ListAll()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.String[]> | An array of all items found |
LoadCatalog()
Loads the catalog.
Declaration
Task<List<string>> LoadCatalog()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Collections.Generic.List<System.String>> | A list of items available in the catalog |
LoadMetaData(String)
Loads the meta data for the specified item.
Declaration
Task<StorageMetaData> LoadMetaData(string identifier)
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The item identifier |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<StorageMetaData> | The saved storage meta data if exists, otherwise returns a new instance of StorageMetaData |
Move(String, String, Boolean)
Declaration
Task<StorageMoveOperationResult> Move(string oldIdentifier, string newIdentifier, bool replace)
Parameters
Type | Name | Description |
---|---|---|
System.String | oldIdentifier | |
System.String | newIdentifier | |
System.Boolean | replace |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<StorageMoveOperationResult> |
ReadAllBytes(String)
Reads all the binary data.
Declaration
Task<byte[]> ReadAllBytes(string identifier)
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The item identifier |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Byte[]> | The binary data |
ReadAllText(String)
Reads all the text data.
Declaration
Task<string> ReadAllText(string identifier)
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The item identifier |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.String> | The text data |
RestoreBackup(String, StorageBackup)
Restores the backup for the storage item.
Declaration
Task<bool> RestoreBackup(string identifier, StorageBackup backup)
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The storage item identifier to restore backup |
StorageBackup | backup | The backup information |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Boolean> | True if operation was successful otherwise false |
RestoreLatestBackup(String)
Restores the latest backup for the storage item.
Declaration
Task<bool> RestoreLatestBackup(string identifier)
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The storage item identifier to restore backup |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Boolean> | True if operation was successful otherwise false |
SaveCatalog(List<String>)
Saves the catalog.
Declaration
Task SaveCatalog(List<string> catalog)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.List<System.String> | catalog | The catalog list |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
SaveMetaData(String, StorageMetaData)
Saves the meta data for the specified item.
Declaration
Task SaveMetaData(string identifier, StorageMetaData metaData)
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The item identifier |
StorageMetaData | metaData | The meta data |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
UpdateMetaData(String, Boolean, Boolean)
Updates the storage item meta data.
Declaration
Task UpdateMetaData(string identifier, bool isWrite, bool encrypted)
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The item identifier |
System.Boolean | isWrite | Specifies whether it is a write/read process |
System.Boolean | encrypted | Whether the item is encrypted or not |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
WriteAllBytes(String, Byte[])
Writes all the binary data.
Declaration
Task WriteAllBytes(string identifier, byte[] data)
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The item identifier |
System.Byte[] | data | The binary data |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
WriteAllText(String, String)
Writes all the text data.
Declaration
Task WriteAllText(string identifier, string data)
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The item identifier |
System.String | data | The text data |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |