pub trait NoxCCPApi: Send {
type Error: Send;
type CommitmentError;
type CommitmentReadiness: IntoFuture<Output = Result<(), Self::CommitmentError>>;
// Required methods
fn on_active_commitment(
&mut self,
epoch_parameters: EpochParameters,
cu_allocation: CUAllocation,
) -> impl Future<Output = Result<Self::CommitmentReadiness, Self::Error>> + Send;
fn on_no_active_commitment(
&mut self,
) -> impl Future<Output = Result<(), Self::Error>> + Send;
fn get_proofs_after(
&self,
last_known_proofs: HashMap<CUID, ProofIdx>,
limit: usize,
) -> impl Future<Output = Result<Vec<BatchResponse>, Self::Error>> + Send;
fn get_batch_proofs_after(
&self,
reqs: HashMap<CUID, BatchRequest>,
min_batch_count: usize,
max_batch_count: usize,
) -> impl Future<Output = Result<Vec<BatchResponse>, Self::Error>> + Send;
fn realloc_utility_cores(
&self,
utility_core_ids: Vec<LogicalCoreId>,
) -> impl Future<Output = ()> + Send;
}Required Associated Types§
type Error: Send
type CommitmentError
type CommitmentReadiness: IntoFuture<Output = Result<(), Self::CommitmentError>>
Required Methods§
Sourcefn on_active_commitment(
&mut self,
epoch_parameters: EpochParameters,
cu_allocation: CUAllocation,
) -> impl Future<Output = Result<Self::CommitmentReadiness, Self::Error>> + Send
fn on_active_commitment( &mut self, epoch_parameters: EpochParameters, cu_allocation: CUAllocation, ) -> impl Future<Output = Result<Self::CommitmentReadiness, Self::Error>> + Send
Aims to apply a (new) allocation of CC compute jobs (which are threads with particular global_nonce_cu + difficulty) per physical_core_id.
It checks if a job already exists, in this case it doesn’t recreate it, but probably pin to another physical core according to the supplied allocation map. If there is no such job, it creates, if jobs are outdated (global_nonce_cu + difficulty aren’t the same as supplied), then it restart them all with the provided parameters.
All other cores which aren’t defined in the supplied map is supposed to manage “useful” job in workers and existing jobs for them will be released.
This function is supposed to be called on any of the following situations:
- new global nonce or difficulty (== new epoch)
- CU allocation is changed (e.g. a core is assigned or released to CC) after event from the on-chain part
- Nox (re)started
Sourcefn on_no_active_commitment(
&mut self,
) -> impl Future<Output = Result<(), Self::Error>> + Send
fn on_no_active_commitment( &mut self, ) -> impl Future<Output = Result<(), Self::Error>> + Send
Stops all active jobs.
Sourcefn get_proofs_after(
&self,
last_known_proofs: HashMap<CUID, ProofIdx>,
limit: usize,
) -> impl Future<Output = Result<Vec<BatchResponse>, Self::Error>> + Send
fn get_proofs_after( &self, last_known_proofs: HashMap<CUID, ProofIdx>, limit: usize, ) -> impl Future<Output = Result<Vec<BatchResponse>, Self::Error>> + Send
Returns proofs after the provided last known proof indexes for current epoch.
Sourcefn get_batch_proofs_after(
&self,
reqs: HashMap<CUID, BatchRequest>,
min_batch_count: usize,
max_batch_count: usize,
) -> impl Future<Output = Result<Vec<BatchResponse>, Self::Error>> + Send
fn get_batch_proofs_after( &self, reqs: HashMap<CUID, BatchRequest>, min_batch_count: usize, max_batch_count: usize, ) -> impl Future<Output = Result<Vec<BatchResponse>, Self::Error>> + Send
Returns proof batch after the last provided proof idx for current epoch.
Sourcefn realloc_utility_cores(
&self,
utility_core_ids: Vec<LogicalCoreId>,
) -> impl Future<Output = ()> + Send
fn realloc_utility_cores( &self, utility_core_ids: Vec<LogicalCoreId>, ) -> impl Future<Output = ()> + Send
Set utility
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.