pub struct Function {
pub name: String,
pub owner: Owner,
pub versions: Vec<FunctionVersion>,
pub active: String,
pub aliases: BTreeMap<String, String>,
pub config: FunctionConfig,
}Expand description
A stored, content-addressed function resource (the FA-1/FA-2 keyspace form).
Fields§
§name: StringThe function name (unique within its owner).
owner: OwnerWho owns it (drives binding prefix + RBAC).
versions: Vec<FunctionVersion>Immutable versions, newest last.
active: StringThe active version’s id.
aliases: BTreeMap<String, String>Named aliases → version id (staging/previews; mirrors deploy aliases).
config: FunctionConfigBinding/capability config.
Implementations§
Source§impl Function
impl Function
Sourcepub fn new(
name: impl Into<String>,
owner: Owner,
component_hash: impl Into<String>,
config: FunctionConfig,
lifecycle: Lifecycle,
created: u64,
) -> Function
pub fn new( name: impl Into<String>, owner: Owner, component_hash: impl Into<String>, config: FunctionConfig, lifecycle: Lifecycle, created: u64, ) -> Function
A new top-level function with a single active version (the component blob). The version id is the component’s content hash (content-addressed).
Sourcepub fn upsert_version(
&mut self,
component_hash: impl Into<String>,
lifecycle: Lifecycle,
created: u64,
) -> String
pub fn upsert_version( &mut self, component_hash: impl Into<String>, lifecycle: Lifecycle, created: u64, ) -> String
Add a version for component_hash (id = the hash) and make it active. If a
version with that hash already exists it is just re-activated (idempotent).
Returns the (active) version id.
Sourcepub fn rollback(&mut self, to: &str) -> Result<(), UnknownVersion>
pub fn rollback(&mut self, to: &str) -> Result<(), UnknownVersion>
Point active at an existing version id. Err if the version is unknown.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Function
impl<'de> Deserialize<'de> for Function
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Function, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Function, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Function
Source§impl Serialize for Function
impl Serialize for Function
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for Function
Auto Trait Implementations§
impl Freeze for Function
impl RefUnwindSafe for Function
impl Send for Function
impl Sync for Function
impl Unpin for Function
impl UnsafeUnpin for Function
impl UnwindSafe for Function
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
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>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.