Class BlobStorage
- Namespace
- TimeCockpit.Data.Database
- Assembly
- TimeCockpit.Data.dll
Acts as the base class for blob storage implementations
public abstract class BlobStorage
- Inheritance
-
ObjectBlobStorage
- Derived
- Inherited Members
-
Object.ToString()Object.Equals(Object)Object.Equals(Object, Object)Object.ReferenceEquals(Object, Object)Object.GetHashCode()Object.GetType()Object.MemberwiseClone()
Constructors
BlobStorage(Guid)
Initializes a new instance of the BlobStorage class
protected BlobStorage(Guid clientReplicaId)
Parameters
clientReplicaIdGuidReplica id of the client to which this blob storage belongs
Properties
BlobEncryptionKey
Gets or sets the optional encryption key used for storing blobs. Blob encryption key must be 32 Bytes/256 bits long or null to disable encryption support.
protected byte[] BlobEncryptionKey { get; set; }
Property Value
- Byte[]
CurrentContainer
Gets the current container (based on tenant replica, internal for testing purposes).
protected string CurrentContainer { get; }
Property Value
- String
Methods
CreateBlob(Guid, Guid, Guid, Byte[])
Creates or replaces a blob in the blob storage
public void CreateBlob(Guid blobId, Guid entityId, Guid propertyId, byte[] blobContent)
Parameters
blobIdGuidGuid of the blob
entityIdGuidGuid of the entity to which the blob belongs
propertyIdGuidGuid of the property to which the blob belongs
blobContentByte[]Content of the blob
CreateBlob(String, String, String, Byte[])
Creates or replaces a blob in the blob storage
protected abstract void CreateBlob(string containerName, string blobName, string categoryName, byte[] blobContent)
Parameters
containerNameStringName of the container
blobNameStringName of the blob
categoryNameStringName of the category to which the blob belongs
blobContentByte[]Content of the blob
CreateBlobAsync(Guid, Guid, Guid, Byte[])
Creates or replaces a blob in the blob storage asynchronously.
public Task CreateBlobAsync(Guid blobId, Guid entityId, Guid propertyId, byte[] blobContent)
Parameters
blobIdGuidGuid of the blob.
entityIdGuidGuid of the entity to which the blob belongs.
propertyIdGuidGuid of the property to which the blob belongs.
blobContentByte[]Content of the blob.
Returns
- Task
The task representing the operation.
CreateBlobAsync(String, String, String, Byte[])
Creates or replaces a blob in the blob storage
protected abstract Task CreateBlobAsync(string containerName, string blobName, string categoryName, byte[] blobContent)
Parameters
containerNameStringName of the container
blobNameStringName of the blob
categoryNameStringName of the category to which the blob belongs
blobContentByte[]Content of the blob
Returns
- Task
The task representing the operation.
CreateContainer(String)
Creates a container in the blob storage
protected abstract void CreateContainer(string containerName)
Parameters
containerNameStringName of the container
DeleteBlob(Guid, Guid, Guid)
Delets a blob in the blob storage
public void DeleteBlob(Guid blobId, Guid entityId, Guid propertyId)
Parameters
blobIdGuidGuid of the blob
entityIdGuidGuid of the entity to which the blob belongs
propertyIdGuidGuid of the property to which the blob belongs
DeleteBlob(String, String, String)
Delets a blob in the blob storage
protected abstract void DeleteBlob(string containerName, string blobName, string categoryName)
Parameters
containerNameStringName of the container
blobNameStringName of the blob
categoryNameStringName of the category to which the blob belongs
GetBlobContent(Guid, Guid, Guid)
Gets the content of a blob in the blob storage
public byte[] GetBlobContent(Guid blobId, Guid entityId, Guid propertyId)
Parameters
blobIdGuidGuid of the blob that should be read
entityIdGuidGuid of the entity to which the blob belongs
propertyIdGuidGuid of the property to which the blob belongs
Returns
- Byte[]
Content of the requested blob
GetBlobContent(String, String, String)
Gets the content of a blob in the blob storage
protected abstract byte[] GetBlobContent(string containerName, string blobName, string categoryName)
Parameters
containerNameStringName of the container
blobNameStringName of the blob
categoryNameStringName of the category to which the blob belongs
Returns
- Byte[]
Content of the requested blob
GetBlobContentAsync(Guid, Guid, Guid)
Gets the blob content asynchronously.
public Task<byte[]> GetBlobContentAsync(Guid blobId, Guid entityId, Guid propertyId)
Parameters
blobIdGuidGuid of the blob that should be read
entityIdGuidGuid of the entity to which the blob belongs
propertyIdGuidGuid of the property to which the blob belongs
Returns
- Task<Byte[]>
A task Producing
GetBlobContentAsync(String, String, String)
Gets the content of a blob in the blob storage asynchronously.
protected abstract Task<byte[]> GetBlobContentAsync(string containerName, string blobName, string categoryName)
Parameters
containerNameStringName of the container
blobNameStringName of the blob
categoryNameStringName of the category to which the blob belongs
Returns
- Task<Byte[]>
Content of the requested blob
OpenCurrentContainer()
Opens the tenant's container which already exist.
public abstract void OpenCurrentContainer()
Remarks
This methods is used for the share access key authenticatio method, where the tenant needs to be created via a key and name pair. A data context which provides name and the shared access signature is nt allowed to create a tenant
OpenOrCreateCurrentContainer()
Creates the tenant's container if it does not already exist.
public abstract void OpenOrCreateCurrentContainer()