[−][src]Enum exonum::runtime::Caller
The authorization information for a service call.
Caller
provides authorization details about the call. The called service may use Caller
to decide whether to proceed with the processing, or to return an error because the caller
has insufficient privileges. In some other cases (e.g., crypto-tokens), Caller
may be used
to get or modify information about the caller in the blockchain state (e.g., the current token
balance).
Authorization info is not purely determined by the call stack. While outermost
transactions calls always have Transaction
auth, services may make internal
calls, which either inherit the parent authorization or authorize a child call in their
name (Service
auth). This is decided by the service; both kinds of auth may make sense
depending on the use case. Inherited auth makes sense for "middleware" (e.g.,
batched calls), while service auth makes sense for stateful authorization (e.g.,
multi-signatures).
Note that Caller
has a forward-compatible uniform representation obtained via
address()
method. Services may use this representation to compare
or index callers without the necessity to care about all possible kinds of authorization
supported by the framework.
Variants (Non-exhaustive)
A usual transaction from the Exonum client authorized by its key pair.
Fields of Transaction
Public key of the user who signed this transaction.
The call is invoked with the authority of a blockchain service.
Fields of Service
instance_id: InstanceId
Identifier of the service instance which invoked the call.
The call is invoked by one of the blockchain lifecycle events.
This kind of authorization is used for before_transactions
/ after_transactions
calls to the service instances, and for initialization of the built-in services.
Methods
impl Caller
[src]
pub fn author(&self) -> Option<PublicKey>
[src]
Returns the author's public key, if it exists.
pub fn as_service(&self) -> Option<InstanceId>
[src]
Tries to reinterpret the caller as a service.
pub fn as_supervisor(&self) -> Option<()>
[src]
Verifies that the caller of this method is a supervisor service.
pub fn address(&self) -> CallerAddress
[src]
Returns a uniform, forward-compatible presentation of the Caller
that can be used
as the account address. Different addresses are guaranteed to correspond to
different Caller
s.
Trait Implementations
impl BinaryValue for Caller
[src]
fn to_bytes(&self) -> Vec<u8>
[src]
fn from_bytes(value: Cow<[u8]>) -> Result<Self, Error>
[src]
fn into_bytes(self) -> Vec<u8>
[src]
impl Clone for Caller
[src]
impl Debug for Caller
[src]
impl ObjectHash for Caller
[src]
fn object_hash(&self) -> Hash
[src]
impl PartialEq<Caller> for Caller
[src]
impl ProtobufConvert for Caller
[src]
type ProtoStruct = Caller
Type generated from the Protobuf definition.
fn to_pb(&self) -> Self::ProtoStruct
[src]
fn from_pb(pb: Self::ProtoStruct) -> Result<Self>
[src]
impl StructuralPartialEq for Caller
[src]
Auto Trait Implementations
impl RefUnwindSafe for Caller
impl Send for Caller
impl Sync for Caller
impl Unpin for Caller
impl UnwindSafe for Caller
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,