23.17. Class ObjectStorage

Namespace: ArmoniK.Core.Adapters.LocalStorage
Assembly: ArmoniK.Core.Adapters.LocalStorage.dll

public class ObjectStorage : IObjectStorage, IInitializable, IHealthCheckProvider

23.17.1. Inheritance

objectObjectStorage

23.17.2. Implements

IObjectStorage, IInitializable, IHealthCheckProvider

23.17.3. Inherited Members

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()

23.17.4. Constructors

23.17.4.1. ObjectStorage(string, int, ILogger<ObjectStorage>)

implementation for LocalStorage

public ObjectStorage(string path, int chunkSize, ILogger<ObjectStorage> logger)

23.17.4.1.1. Parameters

path string

Path where the objects are stored

chunkSize int

Size of the chunks when reading

logger ILogger<ObjectStorage>

Logger used to print logs

23.17.5. Methods

23.17.5.1. AddOrUpdateAsync(ObjectData, IAsyncEnumerable<ReadOnlyMemory<byte>>, CancellationToken)

Add the given data in the storage at the given key Update data if it already exists

public Task<(byte[] id, long size)> AddOrUpdateAsync(ObjectData metaData, IAsyncEnumerable<ReadOnlyMemory<byte>> valueChunks, CancellationToken cancellationToken = default)

23.17.5.1.1. Parameters

metaData ObjectData

valueChunks IAsyncEnumerable<ReadOnlyMemory<byte>>

Chunks of data that will be stored in the Object Storage

cancellationToken CancellationToken

Token used to cancel the execution of the method

23.17.5.1.2. Returns

Task<(byte[] id, long size)>

The opaque unique identifier representing the object and the size of the object that has been uploaded.

23.17.5.1.3. Remarks

Opaque ID will be used to refer to the object. The implementation of this interface should generate it.

23.17.5.1.4. Exceptions

ObjectDataNotFoundException

the key is not found

23.17.5.2. Check(HealthCheckTag)

Checks the status of a class for the given health check type.

public Task<HealthCheckResult> Check(HealthCheckTag tag)

23.17.5.2.1. Parameters

tag HealthCheckTag

Health check for which the class has to answer.

23.17.5.2.2. Returns

Task<HealthCheckResult>

The result of the check containing the status of the class for the health check type.

23.17.5.3. GetSizesAsync(IEnumerable<byte[]>, CancellationToken)

Check if the given keys are existing in the object storage

public Task<IDictionary<byte[], long?>> GetSizesAsync(IEnumerable<byte[]> ids, CancellationToken cancellationToken = default)

23.17.5.3.1. Parameters

ids IEnumerable<byte[]>

Opaque unique identifiers representing the objects to check

cancellationToken CancellationToken

Token used to cancel the execution of the method

23.17.5.3.2. Returns

Task<IDictionary<byte[], long?>>

A map giving the results size if it exits, null otherwise

23.17.5.4. GetValuesAsync(byte[], CancellationToken)

Get object in the Object Storage

public IAsyncEnumerable<byte[]> GetValuesAsync(byte[] id, CancellationToken cancellationToken = default)

23.17.5.4.1. Parameters

id byte[]

Opaque unique identifier representing the object

cancellationToken CancellationToken

Token used to cancel the execution of the method

23.17.5.4.2. Returns

IAsyncEnumerable<byte[]>

Byte arrays representing the object chunked

23.17.5.4.3. Exceptions

ObjectDataNotFoundException

the key is not found

23.17.5.5. Init(CancellationToken)

Executes an initialization process for the class

public Task Init(CancellationToken cancellationToken)

23.17.5.5.1. Parameters

cancellationToken CancellationToken

Token used to cancel the execution of the method

23.17.5.5.2. Returns

Task

Task representing the asynchronous execution of the method

23.17.5.6. TryDeleteAsync(IEnumerable<byte[]>, CancellationToken)

Delete data in the object storage

public Task TryDeleteAsync(IEnumerable<byte[]> ids, CancellationToken cancellationToken = default)

23.17.5.6.1. Parameters

ids IEnumerable<byte[]>

Opaque unique identifiers representing the objects to delete

cancellationToken CancellationToken

Token used to cancel the execution of the method

23.17.5.6.2. Returns

Task

Task representing the asynchronous execution of the method

23.17.5.6.3. Exceptions

ObjectDataNotFoundException

the key is not found

23.17.5.7. TryDeleteAsync(string, CancellationToken)

public Task<bool> TryDeleteAsync(string key, CancellationToken cancellationToken = default)

23.17.5.7.1. Parameters

key string

cancellationToken CancellationToken

23.17.5.7.2. Returns

Task<bool>