faction 0.3.3

A no_std + alloc, protocol-independent cluster readiness state machine for startup coordination and readiness quorum tracking.
Documentation
// Copyright 2025 Umberto Gotti <umberto.gotti@umbertogotti.dev>
// Licensed under the Apache License, Version 2.0
// http://www.apache.org/licenses/LICENSE-2.0

extern crate alloc;

use alloc::vec::Vec;

use crate::cluster_view::ClusterView;
use crate::outcome::Outcome;

#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Transition {
    previous_view: ClusterView,
    outputs: Vec<Outcome>,
    new_view: ClusterView,
}

impl Transition {
    #[must_use]
    pub fn new(previous_view: ClusterView, outputs: Vec<Outcome>, new_view: ClusterView) -> Self {
        Self {
            previous_view,
            outputs,
            new_view,
        }
    }

    #[must_use]
    pub fn previous_view(&self) -> ClusterView {
        self.previous_view.clone()
    }

    #[must_use]
    pub fn outputs(&self) -> &[Outcome] {
        &self.outputs
    }

    #[must_use]
    pub fn new_view(&self) -> ClusterView {
        self.new_view.clone()
    }
}