pub struct PeerCheckout {
pub id: String,
pub worktree: PathBuf,
pub branch: Option<String>,
pub this_checkout: bool,
}Expand description
Which checkout of the repository a peer is attached to.
A board is one process’s memory and a server serves one checkout, so a peer read from
a sibling checkout’s server and a peer of this one are otherwise indistinguishable —
and worse than indistinguishable, because the ids collide: p1 is the first session
of every board, so a repository-wide listing without this field would hold several
peers called p1 and no way to tell them apart. This is the qualification. The
worktree path is the durable half of a worker’s identity: the peer id is a position on
one board and is handed out again after a reconnect (p3 this morning, p1 after the
bridge re-attached), while the checkout a worker is working in outlives its connection.
Absent on a peer a server reports about its own board without being asked which
checkout that is — peers.announce answers about the announcing session and the
answer is this server’s by construction. The repository-wide listing stamps every
peer it gathers, its own included, so that no entry of that answer is unqualified.
use majordomus_cli::peers::PeerCheckout;
let c = PeerCheckout {
id: "b8293f11".into(),
worktree: "/repo-wt/feature/x".into(),
branch: Some("feature/x".into()),
this_checkout: false,
};
let v = serde_json::to_value(&c).unwrap();
assert_eq!(v["branch"], "feature/x");
assert_eq!(v["this_checkout"], false);Fields§
§id: StringThe checkout’s identity digest, the same value server.status reports as
checkout_id. One per checkout, never a path, and stable across a restart.
worktree: PathBufWhere the checkout is. The one thing on this board that a human can act on directly, and the one thing that survives a reconnect.
branch: Option<String>The branch checked out there, when it could be read.
this_checkout: boolWhether this is the checkout of the server answering the call.
Trait Implementations§
Source§impl Clone for PeerCheckout
impl Clone for PeerCheckout
Source§fn clone(&self) -> PeerCheckout
fn clone(&self) -> PeerCheckout
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PeerCheckout
impl Debug for PeerCheckout
Source§impl<'de> Deserialize<'de> for PeerCheckout
impl<'de> Deserialize<'de> for PeerCheckout
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for PeerCheckout
Source§impl JsonSchema for PeerCheckout
impl JsonSchema for PeerCheckout
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl PartialEq for PeerCheckout
impl PartialEq for PeerCheckout
Source§fn eq(&self, other: &PeerCheckout) -> bool
fn eq(&self, other: &PeerCheckout) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for PeerCheckout
impl Serialize for PeerCheckout
impl StructuralPartialEq for PeerCheckout
Auto Trait Implementations§
impl Freeze for PeerCheckout
impl RefUnwindSafe for PeerCheckout
impl Send for PeerCheckout
impl Sync for PeerCheckout
impl Unpin for PeerCheckout
impl UnsafeUnpin for PeerCheckout
impl UnwindSafe for PeerCheckout
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.