import Log4js from 'log4js'; import Logger from '../logger'; import StateManager from '../state-manager'; import Profiler from '../utils/profiler'; import * as ShardusTypes from './../shardus/shardus-types'; import Sqlite3Storage from './sqlite3storage'; import { ColumnDescription } from './utils/schemaDefintions'; /** A type alias to avoid both `any` and having to spell this type out any time * we want to use it. */ export type GenericObject = { [key: symbol]: unknown; }; export type ModelAttributes = { [column: string]: ColumnDescription; }; export interface ModelData { tableName: string; columns: string[]; columnsString: string; substitutionString: string; isColumnJSON: { [key: string]: boolean; }; JSONkeys: string[]; insertOrReplaceString?: string; insertString?: string; selectString?: string; updateString?: string; deleteString?: string; } export type OperationOptions = { createOrReplace?: boolean; raw?: boolean; order?: { length: number; }; limit?: number; }; export interface ParamEntry { name: string; type?: string; v1?: string; v2?: string; sql?: string; vals?: string[]; } interface Storage { serverConfig: ShardusTypes.StrictServerConfiguration; profiler: Profiler; mainLogger: Log4js.Logger; fatalLogger: Log4js.Logger; storage: Sqlite3Storage; stateManager: StateManager; storageModels: any; initialized: boolean; _create: any; _read: any; _readOld: any; _update: any; _delete: any; _query: any; _queryOld: any; } declare class Storage { constructor(baseDir: string, config: ShardusTypes.StrictStorageConfiguration, serverConfig: ShardusTypes.StrictServerConfiguration, logger: Logger, profiler: Profiler); init(): Promise; close(): Promise; deleteOldDBPath(): Promise; _checkInit(): void; addCycles(cycles: any): Promise; updateCycle(record: any, newRecord: any): Promise; getCycleByCounter(counter: any): Promise; getCycleByMarker(marker: any): Promise; deleteCycleByCounter(counter: any): Promise; deleteCycleByMarker(marker: any): Promise; listCycles(): Promise; listOldCycles(): Promise; getLastOldNetworkHash(): Promise; getLastOldPartitionHashes(): Promise; addNodes(nodes: any): Promise; getNodes(node: any): Promise; updateNodes(node: any, newNode: any): Promise; deleteNodes(nodes: any): Promise; listNodes(): Promise; setProperty(key: any, value: any): Promise; getProperty(key: any): Promise; deleteProperty(key: any): Promise; listProperties(): Promise; clearP2pState(): Promise; clearAppRelatedState(): Promise; addAcceptedTransactions(acceptedTransactions: any): Promise; addPartitionHash(partition: any): Promise; addReceiptMapHash(receiptMap: any): Promise; addSummaryHash(summaryHash: any): Promise; addNetworkState(networkState: any): Promise; addNetworkReceipt(networkReceipt: any): Promise; addNetworkSummary(networkSummary: any): Promise; addAccountStates(accountStates: any): Promise; queryAcceptedTransactions(tsStart: any, tsEnd: any, limit: any): Promise; queryAcceptedTransactionsByIds(ids: any): Promise; queryAccountStateTable(accountStart: any, accountEnd: any, tsStart: any, tsEnd: any, limit: any): Promise; queryAccountStateTableByList(addressList: any, tsStart: any, tsEnd: any): Promise; queryAccountStateTableByListNewest(accountIDs: any): Promise; clearAccountStateTableByList(addressList: any, tsStart: any, tsEnd: any): Promise; clearAccountStateTableOlderThan(tsEnd: any): Promise; clearAcceptedTX(tsStart: any, tsEnd: any): Promise; searchAccountStateTable(accountId: any, txTimestamp: any): Promise; createAccountCopies(accountCopies: any): Promise; createOrReplaceAccountCopy(accountCopy: any): Promise; getAccountReplacmentCopies1(accountIDs: any, cycleNumber: any): Promise; getAccountReplacmentCopies(accountIDs: any, cycleNumber: any): Promise; clearAccountReplacmentCopies(accountIDs: any, cycleNumber: any): Promise; getAccountCopiesByCycle(cycleNumber: any): Promise; getAccountCopiesByCycleAndRange(cycleNumber: any, lowAddress: any, highAddress: any): Promise; getGlobalAccountCopies(cycleNumber: any): Promise; getOldAccountCopiesByCycleAndRange(cycleNumber: any, lowAddress: any, highAddress: any): Promise; getOldGlobalAccountCopies(cycleNumber: any): Promise; } export default Storage;