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

Method get

fendermint/testing/materializer/src/docker/container.rs:43–80  ·  view source on GitHub ↗

Get a container by name, if it exists.

(
        docker: Docker,
        dropper: DropChute,
        drop_policy: &DropPolicy,
        name: String,
    )

Source from the content-addressed store, hash-verified

41
42 /// Get a container by name, if it exists.
43 pub async fn get(
44 docker: Docker,
45 dropper: DropChute,
46 drop_policy: &DropPolicy,
47 name: String,
48 ) -> anyhow::Result<Option<Self>> {
49 let mut filters = HashMap::new();
50 filters.insert("name".to_string(), vec![name.clone()]);
51
52 let containers: Vec<ContainerSummary> = docker
53 .list_containers(Some(ListContainersOptions {
54 all: true,
55 filters,
56 ..Default::default()
57 }))
58 .await
59 .context("failed to list docker containers")?;
60
61 match containers.first() {
62 None => Ok(None),
63 Some(container) => {
64 let id = container
65 .id
66 .clone()
67 .ok_or_else(|| anyhow!("docker container {name} has no id"))?;
68
69 Ok(Some(Self::new(
70 docker,
71 dropper,
72 DockerConstruct {
73 id,
74 name,
75 keep: drop_policy.keep(false),
76 },
77 )))
78 }
79 }
80 }
81
82 /// Start the container, unless it's already running.
83 pub async fn start(&self) -> anyhow::Result<()> {

Callers 11

ensure_balanceMethod · 0.45
accountMethod · 0.45
nodeMethod · 0.45
subnetMethod · 0.45
genesisMethod · 0.45
deploymentMethod · 0.45
port_rangeMethod · 0.45
get_and_incrementMethod · 0.45
fmtMethod · 0.45
test_contract_callFunction · 0.45

Calls 4

to_stringMethod · 0.80
contextMethod · 0.80
keepMethod · 0.80
insertMethod · 0.45

Tested by 7

accountMethod · 0.36
nodeMethod · 0.36
subnetMethod · 0.36
genesisMethod · 0.36
deploymentMethod · 0.36
test_contract_callFunction · 0.36