Struct pallet_broker::pallet::Pallet
source · pub struct Pallet<T>(_);
Expand description
The Pallet
struct, the main type that implements traits and standalone
functions within the pallet.
Implementations§
source§impl<T: Config> Pallet<T>
impl<T: Config> Pallet<T>
pub fn current_timeslice() -> Timeslice
pub fn latest_timeslice_ready_to_commit(config: &ConfigRecordOf<T>) -> Timeslice
pub fn next_timeslice_to_commit( config: &ConfigRecordOf<T>, status: &StatusRecord ) -> Option<Timeslice>
pub fn account_id() -> T::AccountId
pub fn sale_price( sale: &SaleInfoRecordOf<T>, now: BlockNumberFor<T> ) -> BalanceOf<T>
source§impl<T: Config> Pallet<T>
impl<T: Config> Pallet<T>
sourcepub fn configure(
origin: OriginFor<T>,
config: ConfigRecordOf<T>
) -> DispatchResultWithPostInfo
pub fn configure( origin: OriginFor<T>, config: ConfigRecordOf<T> ) -> DispatchResultWithPostInfo
Configure the pallet.
origin
: Must be Root or passAdminOrigin
.config
: The configuration for this pallet.
sourcepub fn reserve(
origin: OriginFor<T>,
workload: Schedule
) -> DispatchResultWithPostInfo
pub fn reserve( origin: OriginFor<T>, workload: Schedule ) -> DispatchResultWithPostInfo
Reserve a core for a workload.
origin
: Must be Root or passAdminOrigin
.workload
: The workload which should be permanently placed on a core.
sourcepub fn unreserve(
origin: OriginFor<T>,
item_index: u32
) -> DispatchResultWithPostInfo
pub fn unreserve( origin: OriginFor<T>, item_index: u32 ) -> DispatchResultWithPostInfo
Cancel a reservation for a workload.
origin
: Must be Root or passAdminOrigin
.item_index
: The index of the reservation. Usually this will also be the index of the core on which the reservation has been scheduled. However, it is possible that if other cores are reserved or unreserved in the same sale rotation that they won’t correspond, so it’s better to look up the core properly in theReservations
storage.
sourcepub fn set_lease(
origin: OriginFor<T>,
task: TaskId,
until: Timeslice
) -> DispatchResultWithPostInfo
pub fn set_lease( origin: OriginFor<T>, task: TaskId, until: Timeslice ) -> DispatchResultWithPostInfo
Reserve a core for a single task workload for a limited period.
In the interlude and sale period where Bulk Coretime is sold for the period immediately
after until
, then the same workload may be renewed.
origin
: Must be Root or passAdminOrigin
.task
: The workload which should be placed on a core.until
: The timeslice now earlier than whichtask
should be placed as a workload on a core.
sourcepub fn start_sales(
origin: OriginFor<T>,
initial_price: BalanceOf<T>,
core_count: CoreIndex
) -> DispatchResultWithPostInfo
pub fn start_sales( origin: OriginFor<T>, initial_price: BalanceOf<T>, core_count: CoreIndex ) -> DispatchResultWithPostInfo
Begin the Bulk Coretime sales rotation.
origin
: Must be Root or passAdminOrigin
.initial_price
: The price of Bulk Coretime in the first sale.core_count
: The number of cores which can be allocated.
sourcepub fn purchase(
origin: OriginFor<T>,
price_limit: BalanceOf<T>
) -> DispatchResultWithPostInfo
pub fn purchase( origin: OriginFor<T>, price_limit: BalanceOf<T> ) -> DispatchResultWithPostInfo
Purchase Bulk Coretime in the ongoing Sale.
origin
: Must be a Signed origin with at least enough funds to pay the current price of Bulk Coretime.price_limit
: An amount no more than which should be paid.
sourcepub fn renew(
origin: OriginFor<T>,
core: CoreIndex
) -> DispatchResultWithPostInfo
pub fn renew( origin: OriginFor<T>, core: CoreIndex ) -> DispatchResultWithPostInfo
Renew Bulk Coretime in the ongoing Sale or its prior Interlude Period.
origin
: Must be a Signed origin with at least enough funds to pay the renewal price of the core.core
: The core which should be renewed.
sourcepub fn transfer(
origin: OriginFor<T>,
region_id: RegionId,
new_owner: T::AccountId
) -> DispatchResult
pub fn transfer( origin: OriginFor<T>, region_id: RegionId, new_owner: T::AccountId ) -> DispatchResult
Transfer a Bulk Coretime Region to a new owner.
origin
: Must be a Signed origin of the account which owns the Regionregion_id
.region_id
: The Region whose ownership should change.new_owner
: The new owner for the Region.
sourcepub fn partition(
origin: OriginFor<T>,
region_id: RegionId,
pivot: Timeslice
) -> DispatchResult
pub fn partition( origin: OriginFor<T>, region_id: RegionId, pivot: Timeslice ) -> DispatchResult
Split a Bulk Coretime Region into two non-overlapping Regions at a particular time into the region.
origin
: Must be a Signed origin of the account which owns the Regionregion_id
.region_id
: The Region which should be partitioned into two non-overlapping Regions.pivot
: The offset in time into the Region at which to make the split.
sourcepub fn interlace(
origin: OriginFor<T>,
region_id: RegionId,
pivot: CoreMask
) -> DispatchResult
pub fn interlace( origin: OriginFor<T>, region_id: RegionId, pivot: CoreMask ) -> DispatchResult
Split a Bulk Coretime Region into two wholly-overlapping Regions with complementary interlace masks which together make up the original Region’s interlace mask.
origin
: Must be a Signed origin of the account which owns the Regionregion_id
.region_id
: The Region which should become two interlaced Regions of incomplete regularity.pivot
: The interlace mask of on of the two new regions (the other it its partial complement).
sourcepub fn assign(
origin: OriginFor<T>,
region_id: RegionId,
task: TaskId,
finality: Finality
) -> DispatchResultWithPostInfo
pub fn assign( origin: OriginFor<T>, region_id: RegionId, task: TaskId, finality: Finality ) -> DispatchResultWithPostInfo
Assign a Bulk Coretime Region to a task.
origin
: Must be a Signed origin of the account which owns the Regionregion_id
.region_id
: The Region which should be assigned to the task.task
: The task to assign.finality
: Indication of whether this assignment is final (in which case it may be eligible for renewal) or provisional (in which case it may be manipulated and/or reassigned at a later stage).
sourcepub fn pool(
origin: OriginFor<T>,
region_id: RegionId,
payee: T::AccountId,
finality: Finality
) -> DispatchResultWithPostInfo
pub fn pool( origin: OriginFor<T>, region_id: RegionId, payee: T::AccountId, finality: Finality ) -> DispatchResultWithPostInfo
Place a Bulk Coretime Region into the Instantaneous Coretime Pool.
origin
: Must be a Signed origin of the account which owns the Regionregion_id
.region_id
: The Region which should be assigned to the Pool.payee
: The account which is able to collect any revenue due for the usage of this Coretime.
sourcepub fn claim_revenue(
origin: OriginFor<T>,
region_id: RegionId,
max_timeslices: Timeslice
) -> DispatchResultWithPostInfo
pub fn claim_revenue( origin: OriginFor<T>, region_id: RegionId, max_timeslices: Timeslice ) -> DispatchResultWithPostInfo
Claim the revenue owed from inclusion in the Instantaneous Coretime Pool.
origin
: Must be a Signed origin of the account which owns the Regionregion_id
.region_id
: The Region which was assigned to the Pool.max_timeslices
: The maximum number of timeslices which should be processed. This may effect the weight of the call but should be ideally made equivalant to the length of the Regionregion_id
. If it is less than this, then further dispatches will be required with theregion_id
which makes up any remainders of the region to be collected.
sourcepub fn purchase_credit(
origin: OriginFor<T>,
amount: BalanceOf<T>,
beneficiary: RelayAccountIdOf<T>
) -> DispatchResult
pub fn purchase_credit( origin: OriginFor<T>, amount: BalanceOf<T>, beneficiary: RelayAccountIdOf<T> ) -> DispatchResult
Purchase credit for use in the Instantaneous Coretime Pool.
origin
: Must be a Signed origin able to pay at leastamount
.amount
: The amount of credit to purchase.beneficiary
: The account on the Relay-chain which controls the credit (generally this will be the collator’s hot wallet).
sourcepub fn drop_region(
origin: OriginFor<T>,
region_id: RegionId
) -> DispatchResultWithPostInfo
pub fn drop_region( origin: OriginFor<T>, region_id: RegionId ) -> DispatchResultWithPostInfo
Drop an expired Region from the chain.
origin
: Must be a Signed origin.region_id
: The Region which has expired.
sourcepub fn drop_contribution(
origin: OriginFor<T>,
region_id: RegionId
) -> DispatchResultWithPostInfo
pub fn drop_contribution( origin: OriginFor<T>, region_id: RegionId ) -> DispatchResultWithPostInfo
Drop an expired Instantaneous Pool Contribution record from the chain.
origin
: Must be a Signed origin.region_id
: The Region identifying the Pool Contribution which has expired.
sourcepub fn drop_history(
origin: OriginFor<T>,
when: Timeslice
) -> DispatchResultWithPostInfo
pub fn drop_history( origin: OriginFor<T>, when: Timeslice ) -> DispatchResultWithPostInfo
Drop an expired Instantaneous Pool History record from the chain.
origin
: Must be a Signed origin.region_id
: The time of the Pool History record which has expired.
sourcepub fn drop_renewal(
origin: OriginFor<T>,
core: CoreIndex,
when: Timeslice
) -> DispatchResultWithPostInfo
pub fn drop_renewal( origin: OriginFor<T>, core: CoreIndex, when: Timeslice ) -> DispatchResultWithPostInfo
Drop an expired Allowed Renewal record from the chain.
origin
: Must be a Signed origin of the account which owns the Regionregion_id
.core
: The core to which the expired renewal refers.when
: The timeslice to which the expired renewal refers. This must have passed.
sourcepub fn request_core_count(
origin: OriginFor<T>,
core_count: CoreIndex
) -> DispatchResult
pub fn request_core_count( origin: OriginFor<T>, core_count: CoreIndex ) -> DispatchResult
Request a change to the number of cores available for scheduling work.
origin
: Must be Root or passAdminOrigin
.core_count
: The desired number of cores to be made available.
Trait Implementations§
source§impl<T> Benchmarking for Pallet<T>where
T: Config + Config,
impl<T> Benchmarking for Pallet<T>where T: Config + Config,
source§fn benchmarks(extra: bool) -> Vec<BenchmarkMetadata>
fn benchmarks(extra: bool) -> Vec<BenchmarkMetadata>
source§fn run_benchmark(
extrinsic: &[u8],
c: &[(BenchmarkParameter, u32)],
whitelist: &[TrackedStorageKey],
verify: bool,
internal_repeats: u32
) -> Result<Vec<BenchmarkResult>, BenchmarkError>
fn run_benchmark( extrinsic: &[u8], c: &[(BenchmarkParameter, u32)], whitelist: &[TrackedStorageKey], verify: bool, internal_repeats: u32 ) -> Result<Vec<BenchmarkResult>, BenchmarkError>
source§impl<T: Config> GetStorageVersion for Pallet<T>
impl<T: Config> GetStorageVersion for Pallet<T>
source§fn current_storage_version() -> Self::CurrentStorageVersion
fn current_storage_version() -> Self::CurrentStorageVersion
source§fn on_chain_storage_version() -> StorageVersion
fn on_chain_storage_version() -> StorageVersion
source§impl<T: Config> Hooks<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
impl<T: Config> Hooks<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
source§fn on_initialize(_now: BlockNumberFor<T>) -> Weight
fn on_initialize(_now: BlockNumberFor<T>) -> Weight
source§fn on_finalize(_n: BlockNumber)
fn on_finalize(_n: BlockNumber)
source§fn on_idle(_n: BlockNumber, _remaining_weight: Weight) -> Weight
fn on_idle(_n: BlockNumber, _remaining_weight: Weight) -> Weight
Hooks::on_finalize
). Read moresource§fn on_runtime_upgrade() -> Weight
fn on_runtime_upgrade() -> Weight
source§fn try_state(_n: BlockNumber) -> Result<(), DispatchError>
fn try_state(_n: BlockNumber) -> Result<(), DispatchError>
source§fn pre_upgrade() -> Result<Vec<u8, Global>, DispatchError>
fn pre_upgrade() -> Result<Vec<u8, Global>, DispatchError>
source§fn post_upgrade(_state: Vec<u8, Global>) -> Result<(), DispatchError>
fn post_upgrade(_state: Vec<u8, Global>) -> Result<(), DispatchError>
source§fn offchain_worker(_n: BlockNumber)
fn offchain_worker(_n: BlockNumber)
source§fn integrity_test()
fn integrity_test()
source§impl<T: Config> Inspect<<T as Config>::AccountId> for Pallet<T>
impl<T: Config> Inspect<<T as Config>::AccountId> for Pallet<T>
source§fn owner(index: &Self::ItemId) -> Option<T::AccountId>
fn owner(index: &Self::ItemId) -> Option<T::AccountId>
item
, or None
if the item doesn’t exist or has no
owner.source§impl<T: Config> IntegrityTest for Pallet<T>
impl<T: Config> IntegrityTest for Pallet<T>
source§impl<T: Config> OffchainWorker<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
impl<T: Config> OffchainWorker<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
source§fn offchain_worker(n: BlockNumberFor<T>)
fn offchain_worker(n: BlockNumberFor<T>)
source§impl<T: Config> OnFinalize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
impl<T: Config> OnFinalize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
source§fn on_finalize(n: BlockNumberFor<T>)
fn on_finalize(n: BlockNumberFor<T>)
Hooks::on_finalize
.source§impl<T: Config> OnGenesis for Pallet<T>
impl<T: Config> OnGenesis for Pallet<T>
source§fn on_genesis()
fn on_genesis()
source§impl<T: Config> OnIdle<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
impl<T: Config> OnIdle<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
source§fn on_idle(n: BlockNumberFor<T>, remaining_weight: Weight) -> Weight
fn on_idle(n: BlockNumberFor<T>, remaining_weight: Weight) -> Weight
Hooks::on_idle
.source§impl<T: Config> OnInitialize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
impl<T: Config> OnInitialize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
source§fn on_initialize(n: BlockNumberFor<T>) -> Weight
fn on_initialize(n: BlockNumberFor<T>) -> Weight
Hooks::on_initialize
.source§impl<T: Config> OnRuntimeUpgrade for Pallet<T>
impl<T: Config> OnRuntimeUpgrade for Pallet<T>
source§fn on_runtime_upgrade() -> Weight
fn on_runtime_upgrade() -> Weight
source§fn pre_upgrade() -> Result<Vec<u8>, TryRuntimeError>
fn pre_upgrade() -> Result<Vec<u8>, TryRuntimeError>
Hooks::pre_upgrade
.source§fn post_upgrade(state: Vec<u8>) -> Result<(), TryRuntimeError>
fn post_upgrade(state: Vec<u8>) -> Result<(), TryRuntimeError>
Hooks::post_upgrade
.source§fn try_on_runtime_upgrade(checks: bool) -> Result<Weight, DispatchError>
fn try_on_runtime_upgrade(checks: bool) -> Result<Weight, DispatchError>
pre_upgrade
->
on_runtime_upgrade
-> post_upgrade
hooks for a migration. Read moresource§impl<T: Config> PalletInfoAccess for Pallet<T>
impl<T: Config> PalletInfoAccess for Pallet<T>
source§fn module_name() -> &'static str
fn module_name() -> &'static str
source§fn crate_version() -> CrateVersion
fn crate_version() -> CrateVersion
source§impl<T: Config> PalletsInfoAccess for Pallet<T>
impl<T: Config> PalletsInfoAccess for Pallet<T>
source§impl<T> PartialEq<Pallet<T>> for Pallet<T>
impl<T> PartialEq<Pallet<T>> for Pallet<T>
source§impl<T: Config> StorageInfoTrait for Pallet<T>
impl<T: Config> StorageInfoTrait for Pallet<T>
fn storage_info() -> Vec<StorageInfo>
source§impl<T: Config> TryState<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
impl<T: Config> TryState<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
source§fn try_state(
n: BlockNumberFor<T>,
_s: TryStateSelect
) -> Result<(), TryRuntimeError>
fn try_state( n: BlockNumberFor<T>, _s: TryStateSelect ) -> Result<(), TryRuntimeError>
source§impl<T: Config> WhitelistedStorageKeys for Pallet<T>
impl<T: Config> WhitelistedStorageKeys for Pallet<T>
source§fn whitelisted_storage_keys() -> Vec<TrackedStorageKey>
fn whitelisted_storage_keys() -> Vec<TrackedStorageKey>
Vec<TrackedStorageKey>
indicating the storage keys that
should be whitelisted during benchmarking. This means that those keys
will be excluded from the benchmarking performance calculation.impl<T> Eq for Pallet<T>
Auto Trait Implementations§
impl<T> RefUnwindSafe for Pallet<T>where T: RefUnwindSafe,
impl<T> Send for Pallet<T>where T: Send,
impl<T> Sync for Pallet<T>where T: Sync,
impl<T> Unpin for Pallet<T>where T: Unpin,
impl<T> UnwindSafe for Pallet<T>where T: UnwindSafe,
Blanket Implementations§
source§impl<T> CheckedConversion for T
impl<T> CheckedConversion for T
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T, Outer> IsWrappedBy<Outer> for Twhere
Outer: AsRef<T> + AsMut<T> + From<T>,
T: From<Outer>,
impl<T, Outer> IsWrappedBy<Outer> for Twhere Outer: AsRef<T> + AsMut<T> + From<T>, T: From<Outer>,
§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<T> SaturatedConversion for T
impl<T> SaturatedConversion for T
source§fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Selfwhere Self: UniqueSaturatedFrom<T>,
source§fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> Twhere Self: UniqueSaturatedInto<T>,
T
. Read more§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.source§impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for Swhere T: UncheckedFrom<S>,
source§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
unchecked_from
.source§impl<T, S> UniqueSaturatedInto<T> for Swhere
T: Bounded,
S: TryInto<T>,
impl<T, S> UniqueSaturatedInto<T> for Swhere T: Bounded, S: TryInto<T>,
source§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
T
.