feat!(avm-server): Per-call current_peer_id (#381)

The current peer ID is passed as a new field of `TestRunParameters` named
`current_peer_id: String`, instead of creating an AVM with peer ID.

This is a breaking API change of `avm-interface` and `avm-server`.
This commit is contained in:
Ivan Boldyrev
2022-11-25 10:59:09 +03:00
committed by GitHub
parent 4e86da7eda
commit becdedc364
22 changed files with 206 additions and 85 deletions

View File

@ -20,25 +20,28 @@ use std::borrow::Cow;
/// Represents parameters obtained from a particle.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ParticleParameters<'init_peer_id, 'particle_id> {
pub init_peer_id: Cow<'init_peer_id, str>,
pub particle_id: Cow<'particle_id, str>,
pub struct ParticleParameters<'ctx> {
pub init_peer_id: Cow<'ctx, str>,
pub particle_id: Cow<'ctx, str>,
pub timestamp: u64,
pub ttl: u32,
pub current_peer_id: Cow<'ctx, str>,
}
impl<'init_peer_id, 'particle_id> ParticleParameters<'init_peer_id, 'particle_id> {
impl<'ctx> ParticleParameters<'ctx> {
pub fn new(
init_peer_id: Cow<'init_peer_id, str>,
particle_id: Cow<'particle_id, str>,
init_peer_id: Cow<'ctx, str>,
particle_id: Cow<'ctx, str>,
timestamp: u64,
ttl: u32,
current_peer_id: Cow<'ctx, str>,
) -> Self {
Self {
init_peer_id,
particle_id,
timestamp,
ttl,
current_peer_id,
}
}
}