MockDataAccess

@requestnetwork/request-client.jsGlobals"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

Index

Constructors

Properties

Methods

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

Protected isInitialized

isInitialized: boolean

Inherited from MockDataAccess.isInitialized

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


transactionIndex

transactionIndex: ITransactionIndex

Inherited from MockDataAccess.transactionIndex

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

Methods

_getStatus

_getStatus(detailed?: undefined | false | true): Promise‹any›

Inherited from MockDataAccess._getStatus

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

Gets information of the data indexed

Parameters:

NameTypeDescription
detailed?undefined | false | trueif true get the list of the files hashes

Returns: Promise‹any›


getChannelsByMultipleTopics

getChannelsByMultipleTopics(topics: string[], updatedBetween?: DataAccessTypes.ITimestampBoundaries): Promise‹IReturnGetChannelsByTopic›

Inherited from MockDataAccess.getChannelsByMultipleTopics

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

Function to get a list of channels indexed by multiple topics

Parameters:

NameTypeDescription
topicsstring[]topics to retrieve the channels from
updatedBetween?DataAccessTypes.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?: DataAccessTypes.ITimestampBoundaries): Promise‹IReturnGetChannelsByTopic›

Inherited from MockDataAccess.getChannelsByTopic

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

Function to get a list of channels indexed by topic

Parameters:

NameTypeDescription
topicstringtopic to retrieve the channels from
updatedBetween?DataAccessTypes.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?: DataAccessTypes.ITimestampBoundaries): Promise‹IReturnGetTransactions›

Inherited from MockDataAccess.getTransactionsByChannelId

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

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?DataAccessTypes.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:49

Function to initialize the dataId topic with the previous block

Returns: Promise‹void›


persistTransaction

persistTransaction(transaction: ITransaction, channelId: string, topics?: string[]): Promise‹IReturnPersistTransaction›

Inherited from MockDataAccess.persistTransaction

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

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‹IReturnPersistTransaction›

string dataId where the transaction is stored


startAutoSynchronization

startAutoSynchronization(): void

Inherited from MockDataAccess.startAutoSynchronization

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

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

Returns: void


stopAutoSynchronization

stopAutoSynchronization(): void

Inherited from MockDataAccess.stopAutoSynchronization

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

Stop to synchronize with the storage automatically

Returns: void


synchronizeNewDataIds

synchronizeNewDataIds(): Promise‹void›

Inherited from MockDataAccess.synchronizeNewDataIds

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

Function to synchronize with the new dataIds on the storage

Returns: Promise‹void›