pub struct ReviewView {
pub key: String,
pub session: String,
pub subject: String,
pub scope: Vec<String>,
pub issue: Option<String>,
pub reviewer: Option<String>,
pub body: Option<String>,
pub state: ReviewState,
pub answers: Vec<ReviewAnswer>,
pub result: Option<String>,
}Expand description
One review request anywhere in the mesh, with every answer it has drawn. A request with
no reviewer is an offer to the whole mesh rather than to nobody, which is why the
answers are a list: any linked runtime carrying the reviews feature may add one, and
they are kept in Lamport order so that every runtime reads them in the same sequence.
use std::sync::Arc;
use majordomus_cli::mesh::identity::NodeIdentity;
use majordomus_cli::mesh::journal::{EventBody, Journal, StreamLiveness};
use majordomus_cli::mesh::state::{fold, ReviewView};
let j = Journal::open(Arc::new(NodeIdentity::ephemeral().unwrap()), "0000000000000001",
"repo".into(), None).unwrap();
j.append_own(EventBody::ReviewRequested { review: "r1".into(), session: "s1".into(),
subject: "feature/mesh-cooperation".into(), scope: vec!["src/mesh".into()],
issue: Some("#184".into()), reviewer: None, body: None }).unwrap();
let request = fold(&j.events(), &|_| StreamLiveness::Own).reviews[0].key.clone();
j.append_own(EventBody::ReviewAnswered { request, session: "s2".into(),
verdict: "approved".into(), note: Some("reads well".into()) }).unwrap();
let state = fold(&j.events(), &|_| StreamLiveness::Own);
let review: &ReviewView = &state.reviews[0];
assert_eq!(review.subject, "feature/mesh-cooperation");
assert_eq!(review.reviewer, None, "offered to the mesh, not addressed");
assert_eq!(review.answers[0].verdict, "approved");Fields§
§key: String<stream>/<review>.
session: StringThe requesting session’s key.
subject: StringWhat is to be reviewed.
scope: Vec<String>Paths it covers.
issue: Option<String>The issue.
reviewer: Option<String>The runtime asked, when one was.
body: Option<String>What the reviewer needs beyond the subject, when the requester wrote it.
state: ReviewStateIts standing.
answers: Vec<ReviewAnswer>The answers, in Lamport order.
result: Option<String>The requester’s own result or reason, written when it withdrew the request. Never an answer: a review is another session’s verdict.
Trait Implementations§
Source§impl Clone for ReviewView
impl Clone for ReviewView
Source§fn clone(&self) -> ReviewView
fn clone(&self) -> ReviewView
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ReviewView
impl Debug for ReviewView
Source§impl<'de> Deserialize<'de> for ReviewView
impl<'de> Deserialize<'de> for ReviewView
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>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for ReviewView
Source§impl JsonSchema for ReviewView
impl JsonSchema for ReviewView
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreSource§impl PartialEq for ReviewView
impl PartialEq for ReviewView
Source§fn eq(&self, other: &ReviewView) -> bool
fn eq(&self, other: &ReviewView) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for ReviewView
impl Serialize for ReviewView
impl StructuralPartialEq for ReviewView
Auto Trait Implementations§
impl Freeze for ReviewView
impl RefUnwindSafe for ReviewView
impl Send for ReviewView
impl Sync for ReviewView
impl Unpin for ReviewView
impl UnsafeUnpin for ReviewView
impl UnwindSafe for ReviewView
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
Mutably borrows from an owned value. Read more
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
Compare self to
key and return true if they are equal.