Skip to main content

CertsDir

Struct CertsDir 

Source
pub struct CertsDir { /* private fields */ }
Expand description

ノードの証明書のフォルダー。

Implementations§

Source§

impl CertsDir

Source

pub fn new(path: impl Into<PathBuf>, layout: Layout) -> Self

Source

pub fn ca_certificate(&self) -> Result<Certificate, CertsDirError>

Source

pub fn node_certificate(&self) -> Result<Certificate, CertsDirError>

Source

pub fn ca_certificate_path(&self) -> PathBuf

CA の証明書のファイル。

Source

pub fn node_certificate_path(&self) -> PathBuf

ノードの証明書のファイル。

Source

pub fn default_backup_dir(&self, now: SystemTime) -> Result<PathBuf>

置き換える前のファイルをコピーしておく既定の場所。 フォルダーの隣の <フォルダーの名前>.<UTC の日時>.bak。

shoestring はフォルダーの中に決まったファイルしかないことを確かめるので、中には置かない。

Source

pub fn replace_node_certificate( &self, certificate: &Certificate, backup_dir: &Path, ) -> Result<(), CertsDirError>

node.crt.pem と node.full.crt.pem を certificate に置き換える。

置き換える前に、certificate とフォルダーの CA の証明書が catapult の条件を満たすことを確かめ、 元の2つのファイルを同じ名前のまま backup_dir にコピーする。backup_dir にすでに同じ名前のファイルがあれば何もしない。 新しいファイルは同じフォルダーの一時ファイルに書いてから名前を変えるので、途中で失敗しても書きかけのファイルは残らない。 権限は元のファイルに合わせる。

Trait Implementations§

Source§

impl Clone for CertsDir

Source§

fn clone(&self) -> CertsDir

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CertsDir

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.