MCPcopy Create free account
hub / github.com/consensus-shipyard/ipc / new

Method new

fendermint/testing/materializer/src/docker/mod.rs:182–208  ·  view source on GitHub ↗

Create a materializer with a directory where all the testnets can live next to each other.

(dir: &Path, seed: u64)

Source from the content-addressed store, hash-verified

180 /// Create a materializer with a directory where all the
181 /// testnets can live next to each other.
182 pub fn new(dir: &Path, seed: u64) -> anyhow::Result<Self> {
183 let docker =
184 Docker::connect_with_local_defaults().context("failed to connect to Docker")?;
185
186 // Create a runtime for the execution of drop tasks.
187 let (drop_handle, drop_chute) = dropper::start(docker.clone());
188
189 // Read in the state if it exists, otherwise create a default one.
190 let state = import_json(dir.join(STATE_JSON_FILE_NAME))
191 .context("failed to read state")?
192 .unwrap_or_default();
193
194 let m = Self {
195 dir: dir.into(),
196 rng: StdRng::seed_from_u64(seed),
197 docker,
198 drop_handle,
199 drop_chute,
200 state,
201 drop_policy: DropPolicy::default(),
202 };
203
204 m.save_state().context("failed to save state")?;
205 m.export_scripts().context("failed to export scripts")?;
206
207 Ok(m)
208 }
209
210 pub fn with_policy(mut self, policy: DropPolicy) -> Self {
211 self.drop_policy = policy;

Callers

nothing calls this directly

Calls 7

import_jsonFunction · 0.85
contextMethod · 0.80
save_stateMethod · 0.80
export_scriptsMethod · 0.80
startFunction · 0.70
joinMethod · 0.45
intoMethod · 0.45

Tested by

no test coverage detected