MCPcopy Create free account
hub / github.com/Dstack-TEE/dstack / instance_port_policy

Method instance_port_policy

gateway/src/main_service.rs:957–962  ·  view source on GitHub ↗

Lookup the effective port_policy for an instance: admin override wins, otherwise fall back to the instance-reported policy. `None` means neither is set — caller fails closed and may schedule a lazy fetch.

(&self, instance_id: &str)

Source from the content-addressed store, hash-verified

955 /// otherwise fall back to the instance-reported policy. `None` means
956 /// neither is set — caller fails closed and may schedule a lazy fetch.
957 pub(crate) fn instance_port_policy(&self, instance_id: &str) -> Option<&PortPolicy> {
958 let info = self.state.instances.get(instance_id)?;
959 info.admin_port_policy
960 .as_ref()
961 .or(info.port_policy.as_ref())
962 }
963
964 /// Update an instance's port_policy (used after a lazy fetch via Info()).
965 /// Persists to the WaveKV store so other gateway nodes pick it up.

Callers 2

is_port_allowedFunction · 0.80
should_send_ppFunction · 0.80

Calls 2

getMethod · 0.45
as_refMethod · 0.45

Tested by

no test coverage detected