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:
Name | Type |
---|---|
storage | IStorage |
Returns: MockDataAccess
Properties
isInitialized
• Protected
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?
: boolean): Promise<any>
Inherited from MockDataAccess._getStatus
Defined in data-access/dist/data-access.d.ts:109
Gets information of the data indexed
Parameters:
Name | Type | Description |
---|---|---|
detailed? | boolean | if true get the list of the files hashes |
Returns: Promise<any>
getChannelsByMultipleTopics
▸ getChannelsByMultipleTopics(topics
: string[], updatedBetween?
: 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:
Name | Type | Description |
---|---|---|
topics | string[] | topics to retrieve the channels from |
updatedBetween? | ITimestampBoundaries | filter 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:81
Function to get a list of channels indexed by topic
Parameters:
Name | Type | Description |
---|---|---|
topic | string | topic to retrieve the channels from |
updatedBetween? | ITimestampBoundaries | filter 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: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:
Name | Type | Description |
---|---|---|
channelId | string | channel id to retrieve the transaction from |
timestampBoundaries? | ITimestampBoundaries | timestamp 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:
Name | Type | Description |
---|---|---|
transaction | ITransaction | transaction to persist |
channelId | string | string 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>