pub struct Servers {
pub runs: Runs,
/* private fields */
}Expand description
The control plane’s servers: their records, placement, CA, health, and the threads that watch them.
Fields§
§runs: RunsServers being added, and recently added or failed.
Implementations§
Source§impl Servers
impl Servers
Sourcepub fn open(state_dir: &Path) -> Result<Arc<Servers>>
pub fn open(state_dir: &Path) -> Result<Arc<Servers>>
<state>/servers/: the CA under pki/, the records, the placement.
pub fn record(&self, name: &str) -> Result<ServerRecord>
pub fn records(&self) -> Vec<ServerRecord>
pub fn client(&self, name: &str) -> Result<AgentClient>
Sourcepub fn placement(&self, org: &OrgId) -> Option<String>
pub fn placement(&self, org: &OrgId) -> Option<String>
The server org is placed on; None is this daemon.
pub fn placements(&self) -> BTreeMap<OrgId, String>
pub fn orgs_on(&self, server: &str) -> Vec<OrgId>
pub fn health(&self, name: &str) -> Health
Sourcepub fn view(&self, r: &ServerRecord) -> Value
pub fn view(&self, r: &ServerRecord) -> Value
A server as server_list and server_show answer it.
Sourcepub fn check_protocol(&self, server: &str, need: u64) -> Result<()>
pub fn check_protocol(&self, server: &str, need: u64) -> Result<()>
Refuse to forward to server when its agent speaks a protocol this
control plane cannot (need: the oldest that will do).
Sourcepub fn place(&self, org: &OrgId, server: Option<&str>) -> Result<()>
pub fn place(&self, org: &OrgId, server: Option<&str>) -> Result<()>
Place org on server (the agent is told first, so it accepts
calls for it), or take it off (None).
Sourcepub fn call(
&self,
server: &str,
tool: &str,
args: &Value,
caller: &Caller,
org: Option<&OrgId>,
request_id: Option<&str>,
) -> Result<Value>
pub fn call( &self, server: &str, tool: &str, args: &Value, caller: &Caller, org: Option<&OrgId>, request_id: Option<&str>, ) -> Result<Value>
Forward a tool call for org (or an unscoped cross-org read) to
server as caller.
Sourcepub fn check_add(&self, o: &AddOptions) -> Result<String>
pub fn check_add(&self, o: &AddOptions) -> Result<String>
What add would refuse before it starts: a bad name, target or
address, or a server of that name already.
Sourcepub fn add(
self: &Arc<Self>,
o: &AddOptions,
ctl: Option<&Controller>,
p: &Provision,
) -> Result<ServerRecord>
pub fn add( self: &Arc<Self>, o: &AddOptions, ctl: Option<&Controller>, p: &Provision, ) -> Result<ServerRecord>
Bootstrap a new server over SSH and record it, reporting to p.
Sourcepub fn add_vm(
self: &Arc<Self>,
client: &Client,
org: &OrgId,
size: &VmSize,
ctl: Option<&Controller>,
p: &Provision,
) -> Result<ServerRecord>
pub fn add_vm( self: &Arc<Self>, client: &Client, org: &OrgId, size: &VmSize, ctl: Option<&Controller>, p: &Provision, ) -> Result<ServerRecord>
Make a dedicated VM for org on this host and record it as server
vm-<org> (docs/guides/servers.md#dedicated-vms). Idempotent: a VM or a
record left by an earlier attempt is reused.
Sourcepub fn remove(&self, name: &str) -> Result<ServerRecord>
pub fn remove(&self, name: &str) -> Result<ServerRecord>
Forget a server. Refused while orgs are placed on it; the agent itself keeps running until it is stopped on the box.
Sourcepub fn rotate_cert(&self, name: &str) -> Result<ServerRecord>
pub fn rotate_cert(&self, name: &str) -> Result<ServerRecord>
Issue the agent a new certificate over the current mTLS connection and check it answers with it.
Sourcepub fn start(self: &Arc<Self>, ctl: Controller)
pub fn start(self: &Arc<Self>, ctl: Controller)
Heartbeats for every server, and a mirror of each one’s events into
ctl’s feed.