Skip to main content

Class: MockDataAccess#

"mock-data-access".MockDataAccess

Mock Data access that bypasses the initialization. This class is meant to be used with HttpRequestNetwork and useMockStorage=true. Data-access initialization is asynchronous and this class is a hack to avoid having an asynchronous operation in the HttpRequestNetwork constructor.

Hierarchy#

  • DataAccess

    MockDataAccess

Implements#

  • IDataAccess

Constructors#

constructor#

+ new MockDataAccess(storage: IStorage): MockDataAccess

Overrides void

Defined in request-client.js/src/mock-data-access.ts:9

Parameters:#

NameType
storageIStorage

Returns: MockDataAccess

Properties#

isInitialized#

Protected isInitialized: boolean

Inherited from MockDataAccess.isInitialized

Defined in data-access/dist/data-access.d.ts:34

Methods#

_getStatus#

_getStatus(detailed?: boolean): Promise<IDataAccessStatus>

Inherited from MockDataAccess._getStatus

Defined in data-access/dist/data-access.d.ts:117

Gets information of the data indexed

Parameters:#

NameTypeDescription
detailed?booleanif true get the list of the files hashes

Returns: Promise<IDataAccessStatus>


close#

close(): Promise<void>

Inherited from MockDataAccess.close

Defined in data-access/dist/data-access.d.ts:57

Returns: Promise<void>


getChannelsByMultipleTopics#

getChannelsByMultipleTopics(topics: string[], updatedBetween?: ITimestampBoundaries): Promise<IReturnGetChannelsByTopic>

Inherited from MockDataAccess.getChannelsByMultipleTopics

Defined in data-access/dist/data-access.d.ts:98

Function to get a list of channels indexed by multiple topics

Parameters:#

NameTypeDescription
topicsstring[]topics to retrieve the channels from
updatedBetween?ITimestampBoundariesfilter the channels that have received new data within the time boundaries

Returns: Promise<IReturnGetChannelsByTopic>

list of channels indexed by topics


getChannelsByTopic#

getChannelsByTopic(topic: string, updatedBetween?: ITimestampBoundaries): Promise<IReturnGetChannelsByTopic>

Inherited from MockDataAccess.getChannelsByTopic

Defined in data-access/dist/data-access.d.ts:89

Function to get a list of channels indexed by topic

Parameters:#

NameTypeDescription
topicstringtopic to retrieve the channels from
updatedBetween?ITimestampBoundariesfilter the channels that have received new data within the time boundaries

Returns: Promise<IReturnGetChannelsByTopic>

list of channels indexed by topic


getTransactionsByChannelId#

getTransactionsByChannelId(channelId: string, timestampBoundaries?: ITimestampBoundaries): Promise<IReturnGetTransactions>

Inherited from MockDataAccess.getTransactionsByChannelId

Defined in data-access/dist/data-access.d.ts:80

Function to get a list of transactions indexed by channel id if timestampBoundaries is given, the search will be restrict from timestamp 'from' to the timestamp 'to'. if timestampBoundaries.from is not given, the search will be start from the very start if timestampBoundaries.to is not given, the search will be stop at the current timestamp

Parameters:#

NameTypeDescription
channelIdstringchannel id to retrieve the transaction from
timestampBoundaries?ITimestampBoundariestimestamp boundaries of the transactions search

Returns: Promise<IReturnGetTransactions>

list of transactions in the channel


initialize#

initialize(): Promise<void>

Inherited from MockDataAccess.initialize

Defined in data-access/dist/data-access.d.ts:56

Function to initialize the dataId topic with the previous block

Returns: Promise<void>


persistTransaction#

persistTransaction(transaction: ITransaction, channelId: string, topics?: string[]): Promise<DataAccessTypes.IReturnPersistTransaction>

Inherited from MockDataAccess.persistTransaction

Defined in data-access/dist/data-access.d.ts:68

Function to persist transaction and topic in storage For now, we create a block for each transaction

Parameters:#

NameTypeDescription
transactionITransactiontransaction to persist
channelIdstringstring to identify a bunch of transaction
topics?string[]list of string to topic the transaction

Returns: Promise<DataAccessTypes.IReturnPersistTransaction>

string dataId where the transaction is stored


startAutoSynchronization#

startAutoSynchronization(): void

Inherited from MockDataAccess.startAutoSynchronization

Defined in data-access/dist/data-access.d.ts:107

Start to synchronize with the storage automatically Once called, synchronizeNewDataId function is called periodically

Returns: void


stopAutoSynchronization#

stopAutoSynchronization(): Promise<void>

Inherited from MockDataAccess.stopAutoSynchronization

Defined in data-access/dist/data-access.d.ts:111

Stop to synchronize with the storage automatically

Returns: Promise<void>


synchronizeNewDataIds#

synchronizeNewDataIds(): Promise<void>

Inherited from MockDataAccess.synchronizeNewDataIds

Defined in data-access/dist/data-access.d.ts:102

Function to synchronize with the new dataIds on the storage

Returns: Promise<void>