Trait pallet_broker::CoretimeInterface
source · pub trait CoretimeInterface {
type AccountId: Parameter;
type Balance: AtLeast32BitUnsigned + Encode + Decode + MaxEncodedLen + TypeInfo + Debug;
type RelayChainBlockNumberProvider: BlockNumberProvider;
// Required methods
fn request_core_count(count: CoreIndex);
fn request_revenue_info_at(when: RCBlockNumberOf<Self>);
fn credit_account(who: Self::AccountId, amount: Self::Balance);
fn assign_core(
core: CoreIndex,
begin: RCBlockNumberOf<Self>,
assignment: Vec<(CoreAssignment, PartsOf57600)>,
end_hint: Option<RCBlockNumberOf<Self>>,
);
// Provided method
fn on_new_timeslice(_timeslice: Timeslice) { ... }
}
Expand description
Type able to accept Coretime scheduling instructions and provide certain usage information. Generally implemented by the Relay-chain or some means of communicating with it.
The trait representation of RFC#5 <https://github.com/polkadot-fellows/RFCs/pull/5>
.
Required Associated Types§
sourcetype Balance: AtLeast32BitUnsigned + Encode + Decode + MaxEncodedLen + TypeInfo + Debug
type Balance: AtLeast32BitUnsigned + Encode + Decode + MaxEncodedLen + TypeInfo + Debug
A (Relay-chain-side) balance.
sourcetype RelayChainBlockNumberProvider: BlockNumberProvider
type RelayChainBlockNumberProvider: BlockNumberProvider
A provider for the relay chain block number.
Required Methods§
sourcefn request_core_count(count: CoreIndex)
fn request_core_count(count: CoreIndex)
Requests the Relay-chain to alter the number of schedulable cores to count
. Under normal
operation, the Relay-chain SHOULD send a notify_core_count(count)
message back.
sourcefn request_revenue_info_at(when: RCBlockNumberOf<Self>)
fn request_revenue_info_at(when: RCBlockNumberOf<Self>)
Requests that the Relay-chain send a notify_revenue
message back at or soon after
Relay-chain block number when
whose until
parameter is equal to when
.
when
may never be greater than the result of Self::latest()
.
The period in to the past which when
is allowed to be may be limited; if so the limit
should be understood on a channel outside of this proposal. In the case that the request
cannot be serviced because when
is too old a block then a notify_revenue
message must
still be returned, but its revenue
field may be None
.
sourcefn credit_account(who: Self::AccountId, amount: Self::Balance)
fn credit_account(who: Self::AccountId, amount: Self::Balance)
Instructs the Relay-chain to add the amount
of DOT to the Instantaneous Coretime Market
Credit account of who
.
It is expected that Instantaneous Coretime Market Credit on the Relay-chain is NOT transferrable and only redeemable when used to assign cores in the Instantaneous Coretime Pool.
sourcefn assign_core(
core: CoreIndex,
begin: RCBlockNumberOf<Self>,
assignment: Vec<(CoreAssignment, PartsOf57600)>,
end_hint: Option<RCBlockNumberOf<Self>>,
)
fn assign_core( core: CoreIndex, begin: RCBlockNumberOf<Self>, assignment: Vec<(CoreAssignment, PartsOf57600)>, end_hint: Option<RCBlockNumberOf<Self>>, )
Instructs the Relay-chain to ensure that the core indexed as core
is utilised for a number
of assignments in specific ratios given by assignment
starting as soon after begin
as
possible. Core assignments take the form of a CoreAssignment
value which can either task
the core to a ParaId
value or indicate that the core should be used in the Instantaneous
Pool. Each assignment comes with a ratio value, represented as the numerator of the fraction
with a denominator of 57,600.
If end_hint
is Some
and the inner is greater than the current block number, then the
Relay-chain should optimize in the expectation of receiving a new assign_core(core, ...)
message at or prior to the block number of the inner value. Specific functionality should
remain unchanged regardless of the end_hint
value.
Provided Methods§
sourcefn on_new_timeslice(_timeslice: Timeslice)
fn on_new_timeslice(_timeslice: Timeslice)
A hook supposed to be called right after a new timeslice has begun. Likely to be used for batching different matters happened during the timeslice that may benifit from batched processing.