AutoPush Class
Beta
Use AutoPush to automatically push local changes to a specified IModel. To do this, create an AutoPush object, specifying the IModelDb that should be monitored. The instance registers itself to react to events and timers. Often, backend will start auto-pushing when an IModelDb is opened for read-write.
Example:
A service or agent would normally get its AutoPushParams parameters from data provided at deployment time. For example, a service might read configuration data from a .json file that is deployed with the service.
Note that the values of some of the configuration
property values are defined by placeholders denoted by ${some-macro-name}
. These placeholders
are to be replaced by EnvMacroSubst.replaceInProperties with the values of environment
values of the same names. These environment variables would typically be set by the deployment
mechanism from deployment parameters.
The service would read the configuration like this:
Methods
Name | Description | |
---|---|---|
constructor(iModel: IModelDb, params: AutoPushParams, activityMonitor?: AppActivityMonitor): AutoPush | Construct an AutoPushManager. | |
cancel(): void | Cancel the next auto-push. | |
reserveCodes(): Promise<void> | ||
scheduleNextAutoPushIfNecessary(): void | ||
scheduleNextPush(intervalSeconds?: number): void | Schedules an auto-push. | |
validateAutoPushParams(params: any): void Static | Check that 'params' is a valid AutoPushParams object. |
Properties
Name | Type | Description | |
---|---|---|---|
autoSchedule Accessor | boolean | The autoSchedule property | |
durationOfLastPushMillis Accessor ReadOnly | number | The length of time in milliseconds that the last push required to finish. | |
endOfLastPushMillis Accessor ReadOnly | number | The time that the last push finished in unix milliseconds. | |
event | BeEvent<AutoPushEventHandler> | Events raised by AutoPush. | |
iModel Accessor ReadOnly | IModelDb | The IModelDb that this is auto-pushing. | |
lastError Accessor ReadOnly | any | undefined | The last push error, if any. | |
state Accessor ReadOnly | AutoPushState | Check the current state of this AutoPush. |
Defined in
- core/backend/src/AutoPush.ts Line 113
Last Updated: 13 June, 2024