Constructs and prepares an instance of this scheduler.
The arguments passed to the command. Typically, this holds required parameters of commands.
The internal dApp configuration object. This object is used to configure key functionalities such as the name of a dApp and the enabled scopes of the backend runtime.
The internal dApp network configuration object. This object is used to configure the access to the underlying blockchain network.
The period format i.e. "D"
, "W"
or "M"
.
This field will be overriden by sub-classes during initialization.
The command scope. This is the scope that must be enabled
through the configuration files for this command to be
available.
This property is required through the extension of
BaseCommand.
Requires state information of the module. This object is typically populated upon first execution and updated any time later.
This method must return a command name. Note that
it should use only characters of: A-Za-z0-9:-_.
e.g. "scope:name"
This property is required through the extension of
StatisticsCommand.
Method to get the score scheduler config values for this leaderboard aggregation's period format.
This method must return a command signature that
contains hints on the command name and its required
and optional arguments.
e.g. "command
This property is required through the extension of
StatisticsCommand.
Getter for the discovery state identifier, e.g.
"discovery.accounts", "discovery.transactions",
"payout.outputs" etc.
This method is an implementation necessary because
of the extensions of StatefulModule.
This method implements the statistics logic for this command
that will aggregate relevant subjects. Subjects in this command
are provided in config as collection and ** fields** that are
included in transfer transactions on dHealth Network.
As of the time of writing, this scheduler currently supports the
following collections:
assets
: The asset that an account has received as rewards.
amount
: The amount of an asset that an account received as rewards,
Method to create query dates that span across the daily time range.
The current {@link Date} instance that is passed from LeaderboardAggregation.
The result object, consists of the start date and end date instances.
This method uses the logger to print debug messages.
This method uses the logger to print error messages.
Optionally, a stack
can be passed to print a stack trace.
Method to generate period string representation of today's search range.
The result string is in format: {year}{month}{day}
.
The current {@link Date} instance that is passed from LeaderboardAggregation.
The period string representation of today's search range.
Method to generate the previous period string representation given a
data. The result string is in format: {year}{month}{day}
.
The current {@link Date} instance that is passed from LeaderboardAggregation.
The period string representation of dateNow - 1day
search range.
Creates a state query for this discovery service. Each discovery service shall set its own stateIdentifier which is considered the identifier of the discovery module's state document.
This method uses the logger to print info messages.
This helper method serves as a parser for the -c
or --collection
option of this command.
The statistics collection can contain a mongo collection
name that must exist in the database.
The --collection
argument as passed in the terminal.
A validated mongo database collection name.
This method is the entry point of any command line
executed command. nest-commander
implements a flow
where this method is called with parameters that are
respectively the raw arguments and the parsed arguments
to this command call.
This method uses the stateService to fetch the
current execution and also uses it to update the state.
Note that the runWithOptions method is called inside
a try-catch block to force the error handling process.
This method is the entry point of this scheduler. Due to
the usage of the Cron
decorator, and the implementation
the nest backend runtime is able to discover this when the
statistics
scope is enabled.
This method is necessary to make sure this command is run
with the correct --collection
option.
This cron method runs every 1 hour (24 times per day).
This method is the second entry point of this scheduler. Due to
the usage of the Cron
decorator, and the implementation
the nest backend runtime is able to discover this when the
statistics
scope is enabled.
This method is necessary to make sure this command is run
with the correct --collection
option.
This method implements the execution logic for
statistics commands that extend this class. Child
classes must implement a aggregate method
that is called in here.
Note that this method is called by BaseCommand
under the hood, which permits to execute and track
failures more consistently at a higher level.
The parsed runtime arguments passed to the command.
This method prints usage information to the command line
and is used by nest-commander
to print a correctly formatted
help message.
Note that usage methods can be overwritten but must always
print a standard command line signature.
Generated using TypeDoc
The implementation for the daily score aggregation scheduler. Contains source code for the execution logic of a command with name:
Statistics:LeaderboardAggregation
.v0.3.2