Interface IStorage
The storage interface, inherit 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. |
CatalogIdentifier
The catalog identifier of this storage.
Declaration
string CatalogIdentifier { get; }
Property Value
Type | Description |
---|---|
System. |
MetaSuffix
The meta item identifier suffix of this storage.
Declaration
string MetaSuffix { get; }
Property Value
Type | Description |
---|---|
System. |
TextEncoding
The storage text encoding.
Declaration
Encoding TextEncoding { get; set; }
Property Value
Type | Description |
---|---|
System. |
UseCatalog
Gets or sets whether to use catalog or not.
Declaration
bool UseCatalog { get; set; }
Property Value
Type | Description |
---|---|
System. |
UseMetaData
Gets or sets whether to use meta data or not.
Declaration
bool UseMetaData { get; set; }
Property Value
Type | Description |
---|---|
System. |
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. |
True if operation was successful otherwise false |
CommitWriteStream(IStorageStream)
Commits the writable stream changes.
Declaration
Task CommitWriteStream(IStorageStream stream)
Parameters
Type | Name | Description |
---|---|---|
IStorage |
stream | The stream to commit its changes |
Returns
Type | Description |
---|---|
System. |
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. |
fromIdentifier | The item source location |
System. |
toIdentifier | The itme destination location |
System. |
replace | Replace the item at the destination or not if exists |
Returns
Type | Description |
---|---|
System. |
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. |
identifier |
Returns
Type | Description |
---|---|
System. |
The created backup information Storage |
Delete(String)
Deletes the specified item.
Declaration
Task<StorageDeleteOperationResult> Delete(string identifier)
Parameters
Type | Name | Description |
---|---|---|
System. |
identifier | The item identifier |
Returns
Type | Description |
---|---|
System. |
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. |
identifier | The storage item identifier |
Storage |
backup | The backup information |
Returns
Type | Description |
---|---|
System. |
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. |
identifier | The storage item identifier |
Returns
Type | Description |
---|---|
System. |
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. |
identifier |
Returns
Type | Description |
---|---|
System. |
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. |
identifier | The item identifier |
Returns
Type | Description |
---|---|
System. |
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. |
identifier | The storage item identifier to get backups from |
Returns
Type | Description |
---|---|
System. |
The storage item backups |
GetLatestBackup(String)
Gets the latest backup information.
Declaration
Task<StorageBackup> GetLatestBackup(string identifier)
Parameters
Type | Name | Description |
---|---|---|
System. |
identifier | The storage item identifier to get latest backup from |
Returns
Type | Description |
---|---|
System. |
The latest backup information |
GetReadStream(String)
Retrieves a readable stream from the storage.
Declaration
Task<IStorageStream> GetReadStream(string identifier)
Parameters
Type | Name | Description |
---|---|---|
System. |
identifier | The item identifier |
Returns
Type | Description |
---|---|
System. |
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. |
identifier | The item identifier |
Returns
Type | Description |
---|---|
System. |
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. |
identifier | The item identifier |
Returns
Type | Description |
---|---|
System. |
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. |
identifier | The location to look for items |
Storage |
options | The list options |
Returns
Type | Description |
---|---|
System. |
An array of items found at the specified location |
ListAll()
Lists all available items.
Declaration
Task<string[]> ListAll()
Returns
Type | Description |
---|---|
System. |
An array of all items found |
LoadCatalog()
Loads the catalog.
Declaration
Task<List<string>> LoadCatalog()
Returns
Type | Description |
---|---|
System. |
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. |
identifier | The item identifier |
Returns
Type | Description |
---|---|
System. |
The saved storage meta data if exists, otherwise returns a new instance of Storage |
Move(String, String, Boolean)
Declaration
Task<StorageMoveOperationResult> Move(string oldIdentifier, string newIdentifier, bool replace)
Parameters
Type | Name | Description |
---|---|---|
System. |
oldIdentifier | |
System. |
newIdentifier | |
System. |
replace |
Returns
Type | Description |
---|---|
System. |
ReadAllBytes(String)
Reads all the binary data.
Declaration
Task<byte[]> ReadAllBytes(string identifier)
Parameters
Type | Name | Description |
---|---|---|
System. |
identifier | The item identifier |
Returns
Type | Description |
---|---|
System. |
The binary data |
ReadAllText(String)
Reads all the text data.
Declaration
Task<string> ReadAllText(string identifier)
Parameters
Type | Name | Description |
---|---|---|
System. |
identifier | The item identifier |
Returns
Type | Description |
---|---|
System. |
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. |
identifier | The storage item identifier to restore backup |
Storage |
backup | The backup information |
Returns
Type | Description |
---|---|
System. |
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. |
identifier | The storage item identifier to restore backup |
Returns
Type | Description |
---|---|
System. |
True if operation was successful otherwise false |
SaveCatalog(List<String>)
Saves the catalog.
Declaration
Task SaveCatalog(List<string> catalog)
Parameters
Type | Name | Description |
---|---|---|
System. |
catalog | The catalog list |
Returns
Type | Description |
---|---|
System. |
SaveMetaData(String, StorageMetaData)
Saves the meta data for the specified item.
Declaration
Task SaveMetaData(string identifier, StorageMetaData metaData)
Parameters
Type | Name | Description |
---|---|---|
System. |
identifier | The item identifier |
Storage |
metaData | The meta data |
Returns
Type | Description |
---|---|
System. |
UpdateMetaData(String, Boolean, Boolean)
Updates the storage item meta data.
Declaration
Task UpdateMetaData(string identifier, bool isWrite, bool encrypted)
Parameters
Type | Name | Description |
---|---|---|
System. |
identifier | The item identifier |
System. |
isWrite | Specifies whether it is a write/read process |
System. |
encrypted | Whether the item is encrypted or not |
Returns
Type | Description |
---|---|
System. |
WriteAllBytes(String, Byte[])
Writes all the binary data.
Declaration
Task WriteAllBytes(string identifier, byte[] data)
Parameters
Type | Name | Description |
---|---|---|
System. |
identifier | The item identifier |
System. |
data | The binary data |
Returns
Type | Description |
---|---|
System. |
WriteAllText(String, String)
Writes all the text data.
Declaration
Task WriteAllText(string identifier, string data)
Parameters
Type | Name | Description |
---|---|---|
System. |
identifier | The item identifier |
System. |
data | The text data |
Returns
Type | Description |
---|---|
System. |