pub struct RuntimeView {
pub root: String,
pub served_head: String,
pub served_branch: String,
pub served_working_tree: String,
pub repository_head: String,
pub repository_branch: String,
pub repository_working_tree: String,
pub agree: bool,
pub objects: usize,
pub index_state: String,
pub note: String,
}Expand description
The commit this process answers about, against the commit the repository is on.
Both halves are read here and neither is assumed. served is what the index this
process is holding was built from; repository is what git says now, on this call. A
server that follows the repository reports them equal and pays one git invocation for
the proof; a server that froze its index at start-up reports them different, which is
the only way a reader could ever have found that out.
agree is the field with the operational meaning, and what it says is not “the
repository is fine” but “the answers you are reading are about the tree you are looking
at”. When it is false every other capability this process serves is answering about a
commit that is no longer checked out, and nothing else in the API would tell you.
use majordomus_cli::capability::builtin::lifecycle::RuntimeView;
use serde_json::json;
let view = |served: &str, repo: &str, agree: bool| -> RuntimeView {
serde_json::from_value(json!({
"root": "example/repo",
"served_head": served, "served_branch": "master", "served_working_tree": "clean",
"repository_head": repo, "repository_branch": "master",
"repository_working_tree": "clean",
"agree": agree, "objects": 1319, "index_state": "ok",
"note": "as measured on this call",
})).unwrap()
};
// a server following the repository: one `git` invocation buys the proof
let current = view("a1b2c3d", "a1b2c3d", true);
assert!(current.agree);
assert_eq!(current.served_head, current.repository_head);
assert_eq!(current.index_state, "ok");
// and one that froze its index at start-up: every answer it serves is about the old commit
let frozen = view("a1b2c3d", "9f8e7d6", false);
assert!(!frozen.agree);
assert_ne!(frozen.served_head, frozen.repository_head);Fields§
§root: StringThe repository root this process is serving.
served_head: StringThe commit the served index was built at.
served_branch: StringIts branch, or DETACHED.
served_working_tree: StringWhether the working tree was clean when the index was built.
repository_head: StringThe commit the repository is on, read on this call.
repository_branch: StringIts branch now.
repository_working_tree: StringThe working tree now.
agree: boolWhether the two agree on the commit and the branch.
objects: usizeHow many objects the served index holds, and whether it was degraded.
index_state: Stringok or degraded.
note: StringWhat the comparison means, and what to do when it disagrees.
Trait Implementations§
Source§impl Clone for RuntimeView
impl Clone for RuntimeView
Source§fn clone(&self) -> RuntimeView
fn clone(&self) -> RuntimeView
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 RuntimeView
impl Debug for RuntimeView
Source§impl<'de> Deserialize<'de> for RuntimeView
impl<'de> Deserialize<'de> for RuntimeView
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 RuntimeView
Source§impl JsonSchema for RuntimeView
impl JsonSchema for RuntimeView
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 RuntimeView
impl PartialEq for RuntimeView
Source§fn eq(&self, other: &RuntimeView) -> bool
fn eq(&self, other: &RuntimeView) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for RuntimeView
impl Serialize for RuntimeView
impl StructuralPartialEq for RuntimeView
Auto Trait Implementations§
impl Freeze for RuntimeView
impl RefUnwindSafe for RuntimeView
impl Send for RuntimeView
impl Sync for RuntimeView
impl Unpin for RuntimeView
impl UnsafeUnpin for RuntimeView
impl UnwindSafe for RuntimeView
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.