Table of Contents

Class StorageService<T>

Contains generic functionality common to data related service classes.

public abstract class StorageService<T> : EOSService, IDisposable where T : IFileTransferRequest

Type Parameters

T

The type of file transfer request that this data service makes use of.

Inheritance
StorageService<T>
Implements
Derived
Inherited Members

Fields

CurrentTransferHandle

Reference to an instance of a transfer request created within the EOS SDK.

protected T CurrentTransferHandle

Field Value

T

CurrentTransferName

Stores the name of the currently transferring file.

protected string CurrentTransferName

Field Value

string

MAX_CHUNK_SIZE

Indicates the maximum number of bytes that can be read at a time during data transfer operations.

protected const uint MAX_CHUNK_SIZE = 4096

Field Value

uint

_locallyCachedData

Stores the locally cached copy of the data that the service manages.

protected Dictionary<string, string> _locallyCachedData

Field Value

Dictionary<string, string>

_transfersInProgress

Stores the file transfers that are currently in progress for the given data service.

protected Dictionary<string, EOSTransferInProgress> _transfersInProgress

Field Value

Dictionary<string, EOSTransferInProgress>

Methods

CancelCurrentTransfer()

Cancel the current transfer.

protected void CancelCurrentTransfer()

ClearCurrentTransfer()

Clears all the current transfers that the data service is managing.

protected void ClearCurrentTransfer()

FinishFileDownload(string, Result)

Called when a file has finished downloading.

protected void FinishFileDownload(string fileName, Result result)

Parameters

fileName string

The file that has finished downloading.

result Result

The result of the file download operation.

GetLocallyCachedData()

Retrieves the current local cache of data.

public Dictionary<string, string> GetLocallyCachedData()

Returns

Dictionary<string, string>

IsTransferring()

Indicates whether or not there is a current transfer.

protected bool IsTransferring()

Returns

bool

True if a file is transferring, false otherwise.

ReceiveData(string, ArraySegment<byte>, uint)

Called when receiving data.

protected StorageService<T>.FileTransferResult ReceiveData(string fileName, ArraySegment<byte> data, uint totalSize)

Parameters

fileName string

Name of the file for which data is being received.

data ArraySegment<byte>

The data being received for the file in question.

totalSize uint

The total size of the file for which data is currently being received.

Returns

StorageService<T>.FileTransferResult

A FileTransferResult indicating the current state of the request.

TryCancelTransferHandle()

Attempts to cancel the "current" transfer handle (needs to be a field member added to derived classes).

protected bool TryCancelTransferHandle()

Returns

bool

True if the transfer handle is not null, and canceling it was successful, false otherwise.

Events

OnFileDownloaded

Event is triggered when a file is finished downloading.

public event EOSResultEventHandler OnFileDownloaded

Event Type

EOSResultEventHandler