Search Results for

    Show / Hide Table of Contents

    Interface IStorageService

    An implementation of a storage medium that can be configured (via StorageType, StorageConnectionString, and StorageBasePath) for the web/task services to share

    This permits easy saving/loading of files, and for queue messages

    The default implementations for this by the LemonEdge platform are a simple file storage implementation and an Azure blob/queue service implementation.
    Namespace: LemonEdge.API.Entities.Storage
    Assembly: LemonEdge.API.dll
    Syntax
    public interface IStorageService

    Methods

    DeleteContainer()

    Deletes the configured container/base path

    Declaration
    Task DeleteContainer()
    Returns
    Type Description
    Task

    DeleteFile(string, string)

    Deletes a file at the specified path

    Declaration
    Task DeleteFile(string path, string fileName)
    Parameters
    Type Name Description
    string path
    string fileName
    Returns
    Type Description
    Task

    Dequeue(string, CancellationToken)

    Retrieves the first of any visible messages sitting in the specified queue

    Declaration
    Task<TaskServiceQueueMessage?> Dequeue(string queueName, CancellationToken token = default)
    Parameters
    Type Name Description
    string queueName

    The name of the queue to retrieve any visible messages from

    CancellationToken token
    Returns
    Type Description
    Task<TaskServiceQueueMessage>

    The first valid queue message in the queue or false if there are no valid messages

    GetFile(long, Guid, Guid?, string, string, Guid?, Guid?)

    Returns the specified file from the backing storage

    Declaration
    Task<byte[]> GetFile(long accountID, Guid typeID, Guid? id, string fileName, string folder = "", Guid? teamID = null, Guid? taskId = null)
    Parameters
    Type Name Description
    long accountID

    The unique account id this request originates from

    Guid typeID

    The type of entity that this file is associated with

    Guid? id

    The optional id of the entity type that this file is associated with

    string fileName

    The name of the file being retrieved

    string folder

    A folder this file is located within

    Guid? teamID

    The optional team this file is for to prevent those with other permissions from retrieving this file

    Guid? taskId

    An optional task ID to be used as part of the file path when locating the file

    Returns
    Type Description
    Task<byte[]>

    A task holding the retrieved file in byte form

    GetFile(string, string)

    Returns the specified file from the backing storage

    Declaration
    Task<byte[]> GetFile(string path, string fileName)
    Parameters
    Type Name Description
    string path

    The path to retrieve this file from

    string fileName

    The name of the file being retrieved

    Returns
    Type Description
    Task<byte[]>

    A task holding the retrieved file in byte form

    Queue(string, TaskServiceQueueMessage, TimeSpan?, CancellationToken)

    Adds the specified message to the specified queue with a delay indicating when it is available to be dequeued

    Declaration
    Task Queue(string queueName, TaskServiceQueueMessage taskServiceQueueMessage, TimeSpan? hideDuration = null, CancellationToken token = default)
    Parameters
    Type Name Description
    string queueName

    The name of the queue to add the message to

    TaskServiceQueueMessage taskServiceQueueMessage

    The message to add to the queue

    TimeSpan? hideDuration

    A timespan indicating the period that must elapse before the message is visible and can be retrieved from the queue

    CancellationToken token
    Returns
    Type Description
    Task

    A task indicating the completion of the operation

    RemoveFromQueue(string, object, CancellationToken)

    When a message has been retrieved from a queue, it is not removed until the consumer has a chance to correctly process it.

    When it has been correctly processed this function removes the message permanently from the queue.

    If this is not called within the timeout of the TryDequeue call then the message will be added back to the queue for processing by another consumer
    Declaration
    Task RemoveFromQueue(string queueName, object removeHandle, CancellationToken token = default)
    Parameters
    Type Name Description
    string queueName

    The name of the queue to permanently remove a message from

    object removeHandle

    The unique handle to the message to remove

    CancellationToken token
    Returns
    Type Description
    Task

    A task indicating the completion of the operation

    WriteStream(long, Stream, Guid, Guid?, string, string, Guid?, Guid?)

    Writes the specified stream to the backing storage for the specified location

    Declaration
    Task WriteStream(long accountID, Stream stream, Guid typeID, Guid? id, string fileName, string folder = "", Guid? teamID = null, Guid? taskId = null)
    Parameters
    Type Name Description
    long accountID

    The unique account id this request originates from

    Stream stream

    The stream to write to backing storage

    Guid typeID

    The type of entity that this stream is associated with

    Guid? id

    The optional id of the entity type that this stream is associated with

    string fileName

    The name of the file being saved

    string folder

    A folder to place this file within

    Guid? teamID

    The optional team this file is for to prevent those with other permissions from retrieving this file

    Guid? taskId

    An optional task ID to be used as part of the file path when storing the file

    Returns
    Type Description
    Task

    A task indicating the completion of this operation

    WriteStream(string, string, Stream)

    Writes the specified stream to the backing storage for the specified location

    Declaration
    Task WriteStream(string path, string fileName, Stream stream)
    Parameters
    Type Name Description
    string path

    The path to store this stream in

    string fileName

    The name of the file being saved

    Stream stream

    The stream to write to backing storage

    Returns
    Type Description
    Task

    A task indicating the completion of this operation

    Extension Methods

    LinqExtensions.AsArray<T>(T)
    LinqExtensions.ToArrayOfOne<T>(T)
    LinqExtensions.ToListOfOne<T>(T)
    MiscExtensions.SetIfNotEqual<T, TP>(T, Expression<Func<T, TP>>, TP)
    WeakReferenceExtensions.WeakReference(object)
    SQLExtensions.ToSQLValue(object, bool)
    ReflectionExtensions.ClearEventInvocations(object, string)
    StringExtensions.ToCSVFormatString(object, Type)
    In this article
    Back to top © LemonEdge Technologies. All rights reserved.