Skip to main content

CreateAuthorization

Struct CreateAuthorization 

Source
pub struct CreateAuthorization {
    pub format_version: u16,
    pub id: String,
    pub owner: String,
    pub workspace: String,
    pub base_revision: ContentHash,
    pub idempotency_key: String,
    pub cone: Vec<String>,
}
Expand description

Owner-signed authorization carried into a node-authored physical workspace creation operation.

This is separate from ViewOp: submitting the authorization to the raw operation endpoint cannot create a directory or a change. The workspace endpoint first verifies and materializes the exact binding, then the node wraps it in OpKind::CreateChange under its own key.

Fields§

§format_version: u16

Wire-format version; see FORMAT_VERSION.

§id: String

Stable logical contribution id.

§owner: String

Owner channel that must match the signature attribution.

§workspace: String

Workspace being created.

§base_revision: ContentHash

Exact immutable starting revision.

§idempotency_key: String

Owner-scoped retry identity.

§cone: Vec<String>

Directory prefixes the owner declares this change works within; empty means the whole tree.

Covered by the owner’s signature on purpose. The cone lands in the log as part of an op the node authors, so if it were not signed here the node could attach a scope its owner never declared — and a declaration nobody signed is worth no more than the node-side config this was meant to replace. Additive under invariant 1: an empty cone is not serialized, so every authorization signed before this field existed still verifies byte-for-byte.

Implementations§

Source§

impl CreateAuthorization

Source

pub fn new( id: String, owner: String, workspace: String, base_revision: ContentHash, idempotency_key: String, ) -> Self

Creates an authorization at the current wire-format version.

Source

pub fn with_cone(self, cone: Vec<String>) -> Self

The same authorization, scoped to cone.

A builder rather than a sixth parameter on Self::new, so the unscoped call sites – which are most of them, and every one written before cones existed – keep reading as the plain thing they are.

Source

pub fn to_payload(&self) -> Vec<u8>

Canonical bytes covered by the owner’s submission signature.

Source

pub fn from_payload(payload: &[u8]) -> Result<Self, ViewError>

Decodes signed authorization bytes.

Trait Implementations§

Source§

impl Clone for CreateAuthorization

Source§

fn clone(&self) -> CreateAuthorization

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 CreateAuthorization

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for CreateAuthorization

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for CreateAuthorization

Source§

fn eq(&self, other: &CreateAuthorization) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for CreateAuthorization

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for CreateAuthorization

Source§

impl StructuralPartialEq for CreateAuthorization

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> 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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,