import { OnApplicationShutdown } from '@nestjs/common'; import { Transaction, Sequelize } from '@subql/x-sequelize'; import { IBlockchainService } from '../blockchain.service'; import { NodeConfig } from '../configure'; import { MultiChainRewindStatus } from './entities'; import { StoreService } from './store.service'; import { PlainGlobalModel } from './storeModelProvider/global/global'; import { Header } from './types'; /** * Working principle: * multiChainRewindService is primarily responsible for coordinating multi-chain projects. * When global.rewindLock changes, a PG trigger sends a notification, and all subscribed chain projects will receive the rollback notification. * This triggers a rollback process, where the fetch service handles the message by clearing the queue. * During the next fillNextBlockBuffer loop, if it detects the rewinding state, it will execute the rollback. */ export declare class MultiChainRewindService implements OnApplicationShutdown { private nodeConfig; private sequelize; private storeService; private readonly blockchainService; private _shutdown; private _status; private _chainId?; private dbSchema; private rewindTriggerName; private startHeight; private pgListener?; private _globalModel?; private processingPromise; waitRewindHeader?: Header; constructor(nodeConfig: NodeConfig, sequelize: Sequelize, storeService: StoreService, blockchainService: IBlockchainService); get chainId(): string; get disableRewindLock(): boolean; private set status(value); get status(): MultiChainRewindStatus; get globalModel(): PlainGlobalModel; onApplicationShutdown(): Promise; init(chainId: string, reindex?: (targetHeader: Header) => Promise): Promise
; private registerPgListener; private notifyHandle; private searchWaitRewindHeader; /** * If the set rewindTimestamp is greater than or equal to the current blockHeight, we do nothing because we will roll back to an earlier time. * If the set rewindTimestamp is less than the current blockHeight, we should roll back to the earlier rewindTimestamp. * @param rewindTimestamp rewindTimestamp in milliseconds */ acquireGlobalRewindLock(rewindTimestamp: Date): Promise; releaseChainRewindLock(tx: Transaction, rewindTimestamp: Date, allowRewindTimestamp?: Date): Promise; private setStatus; /** * Get the block header closest to the given timestamp * @param timestamp To find the block closest to a given timestamp * @returns */ private getHeaderByBinarySearch; }