Skip to main content

Plan

Struct Plan 

Source
pub struct Plan {
    pub state: PathBuf,
    pub repos: PathBuf,
    pub auth: PathBuf,
    pub key: PathBuf,
    pub trusted: PathBuf,
    pub config: PathBuf,
    pub port: u16,
}
Expand description

Where everything choir init writes is going.

Built before anything is created so the refusal can name every conflict at once. A tool that fails on the first collision, is fixed, and then fails on the second is a tool that gets run four times.

Fields§

§state: PathBuf

~/.choir, or the directory given.

§repos: PathBuf

Where bare repositories live; the node’s positional root.

§auth: PathBuf

user:token, mode 0600.

§key: PathBuf

This actor’s 32 secret bytes, mode 0600.

§trusted: PathBuf

The public keys the node will accept ops from.

§config: PathBuf

.choir/config in the working directory, not in state: it is found the way git finds a repository, by walking up from wherever you are, so a checkout can name a different node than the one your home directory happens to point at.

§port: u16

The port the node will bind.

Implementations§

Source§

impl Plan

Source

pub fn new(state: &Path, port: u16) -> Plan

The default layout under state.

Source

pub fn node_url(&self) -> String

The URL the other commands will use.

Loopback, and not configurable here on purpose: Node refuses a non-loopback bind without TLS, which is the privacy rule expressed as code rather than a doc note. Offering --bind on the command that runs first would put a certificate between a reader and their first push.

Source

pub fn files(&self) -> Vec<&Path>

Every file this plan would write, in the order it writes them.

Source

pub fn conflicts(&self) -> Vec<&Path>

Which of them are already there.

Auto Trait Implementations§

§

impl Freeze for Plan

§

impl RefUnwindSafe for Plan

§

impl Send for Plan

§

impl Sync for Plan

§

impl Unpin for Plan

§

impl UnsafeUnpin for Plan

§

impl UnwindSafe for Plan

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.