[][src]Trait safe_app::Client

pub trait Client: 'static + Clone {
    type Context;
    fn full_id(&self) -> SafeKey;
fn owner_key(&self) -> PublicKey;
fn config(&self) -> Option<HashSet<SocketAddr, RandomState>>;
fn inner(&self) -> Rc<RefCell<Inner<Self, Self::Context>>>;
fn public_encryption_key(&self) -> PublicKey;
fn secret_encryption_key(&self) -> SecretKey;
fn secret_symmetric_key(&self) -> Key; fn public_id(&self) -> PublicId { ... }
fn public_key(&self) -> PublicKey { ... }
fn encryption_keypair(&self) -> (PublicKey, SecretKey) { ... }
fn compose_message(&self, request: Request, sign: bool) -> Message { ... }
fn set_timeout(&self, duration: Duration) { ... }
fn restart_network(&self) -> Result<(), CoreError> { ... }
fn put_unseq_mutable_data(
        &self,
        data: UnseqData
    ) -> Box<dyn Future<Error = CoreError, Item = ()> + 'static> { ... }
fn transfer_coins(
        &self,
        client_id: Option<&FullId>,
        destination: XorName,
        amount: Coins,
        transaction_id: Option<u64>
    ) -> Box<dyn Future<Error = CoreError, Item = Transaction> + 'static> { ... }
fn create_balance(
        &self,
        client_id: Option<&FullId>,
        new_balance_owner: PublicKey,
        amount: Coins,
        transaction_id: Option<u64>
    ) -> Box<dyn Future<Error = CoreError, Item = Transaction> + 'static> { ... }
fn insert_login_packet_for(
        &self,
        client_id: Option<&FullId>,
        new_owner: PublicKey,
        amount: Coins,
        transaction_id: Option<u64>,
        new_login_packet: LoginPacket
    ) -> Box<dyn Future<Error = CoreError, Item = Transaction> + 'static> { ... }
fn get_balance(
        &self,
        client_id: Option<&FullId>
    ) -> Box<dyn Future<Error = CoreError, Item = Coins> + 'static> { ... }
fn put_idata(
        &self,
        data: impl Into<Data>
    ) -> Box<dyn Future<Error = CoreError, Item = ()> + 'static> { ... }
fn get_idata(
        &self,
        address: Address
    ) -> Box<dyn Future<Error = CoreError, Item = Data> + 'static> { ... }
fn del_unpub_idata(
        &self,
        name: XorName
    ) -> Box<dyn Future<Error = CoreError, Item = ()> + 'static> { ... }
fn put_seq_mutable_data(
        &self,
        data: SeqData
    ) -> Box<dyn Future<Error = CoreError, Item = ()> + 'static> { ... }
fn get_unseq_mdata(
        &self,
        name: XorName,
        tag: u64
    ) -> Box<dyn Future<Error = CoreError, Item = UnseqData> + 'static> { ... }
fn get_seq_mdata_value(
        &self,
        name: XorName,
        tag: u64,
        key: Vec<u8>
    ) -> Box<dyn Future<Error = CoreError, Item = SeqValue> + 'static> { ... }
fn get_unseq_mdata_value(
        &self,
        name: XorName,
        tag: u64,
        key: Vec<u8>
    ) -> Box<dyn Future<Error = CoreError, Item = Vec<u8>> + 'static> { ... }
fn get_seq_mdata(
        &self,
        name: XorName,
        tag: u64
    ) -> Box<dyn Future<Error = CoreError, Item = SeqData> + 'static> { ... }
fn mutate_seq_mdata_entries(
        &self,
        name: XorName,
        tag: u64,
        actions: SeqEntryActions
    ) -> Box<dyn Future<Error = CoreError, Item = ()> + 'static> { ... }
fn mutate_unseq_mdata_entries(
        &self,
        name: XorName,
        tag: u64,
        actions: UnseqEntryActions
    ) -> Box<dyn Future<Error = CoreError, Item = ()> + 'static> { ... }
fn get_seq_mdata_shell(
        &self,
        name: XorName,
        tag: u64
    ) -> Box<dyn Future<Error = CoreError, Item = SeqData> + 'static> { ... }
fn get_unseq_mdata_shell(
        &self,
        name: XorName,
        tag: u64
    ) -> Box<dyn Future<Error = CoreError, Item = UnseqData> + 'static> { ... }
fn get_mdata_version(
        &self,
        address: Address
    ) -> Box<dyn Future<Error = CoreError, Item = u64> + 'static> { ... }
fn list_unseq_mdata_entries(
        &self,
        name: XorName,
        tag: u64
    ) -> Box<dyn Future<Error = CoreError, Item = BTreeMap<Vec<u8>, Vec<u8>>> + 'static> { ... }
fn list_seq_mdata_entries(
        &self,
        name: XorName,
        tag: u64
    ) -> Box<dyn Future<Error = CoreError, Item = BTreeMap<Vec<u8>, SeqValue>> + 'static> { ... }
fn list_mdata_keys(
        &self,
        address: Address
    ) -> Box<dyn Future<Error = CoreError, Item = BTreeSet<Vec<u8>>> + 'static> { ... }
fn list_seq_mdata_values(
        &self,
        name: XorName,
        tag: u64
    ) -> Box<dyn Future<Error = CoreError, Item = Vec<SeqValue>> + 'static> { ... }
fn list_mdata_user_permissions(
        &self,
        address: Address,
        user: PublicKey
    ) -> Box<dyn Future<Error = CoreError, Item = PermissionSet> + 'static> { ... }
fn list_unseq_mdata_values(
        &self,
        name: XorName,
        tag: u64
    ) -> Box<dyn Future<Error = CoreError, Item = Vec<Vec<u8>>> + 'static> { ... }
fn put_adata(
        &self,
        data: Data
    ) -> Box<dyn Future<Error = CoreError, Item = ()> + 'static> { ... }
fn get_adata(
        &self,
        address: Address
    ) -> Box<dyn Future<Error = CoreError, Item = Data> + 'static> { ... }
fn get_adata_shell(
        &self,
        data_index: Index,
        address: Address
    ) -> Box<dyn Future<Error = CoreError, Item = Data> + 'static> { ... }
fn get_adata_value(
        &self,
        address: Address,
        key: Vec<u8>
    ) -> Box<dyn Future<Error = CoreError, Item = Vec<u8>> + 'static> { ... }
fn get_adata_range(
        &self,
        address: Address,
        range: (Index, Index)
    ) -> Box<dyn Future<Error = CoreError, Item = Vec<Entry>> + 'static> { ... }
fn get_adata_indices(
        &self,
        address: Address
    ) -> Box<dyn Future<Error = CoreError, Item = Indices> + 'static> { ... }
fn get_adata_last_entry(
        &self,
        address: Address
    ) -> Box<dyn Future<Error = CoreError, Item = Entry> + 'static> { ... }
fn get_unpub_adata_permissions_at_index(
        &self,
        address: Address,
        permissions_index: Index
    ) -> Box<dyn Future<Error = CoreError, Item = UnpubPermissions> + 'static> { ... }
fn get_pub_adata_permissions_at_index(
        &self,
        address: Address,
        permissions_index: Index
    ) -> Box<dyn Future<Error = CoreError, Item = PubPermissions> + 'static> { ... }
fn get_pub_adata_user_permissions(
        &self,
        address: Address,
        permissions_index: Index,
        user: User
    ) -> Box<dyn Future<Error = CoreError, Item = PubPermissionSet> + 'static> { ... }
fn get_unpub_adata_user_permissions(
        &self,
        address: Address,
        permissions_index: Index,
        public_key: PublicKey
    ) -> Box<dyn Future<Error = CoreError, Item = UnpubPermissionSet> + 'static> { ... }
fn add_unpub_adata_permissions(
        &self,
        address: Address,
        permissions: UnpubPermissions,
        permissions_index: u64
    ) -> Box<dyn Future<Error = CoreError, Item = ()> + 'static> { ... }
fn add_pub_adata_permissions(
        &self,
        address: Address,
        permissions: PubPermissions,
        permissions_index: u64
    ) -> Box<dyn Future<Error = CoreError, Item = ()> + 'static> { ... }
fn set_adata_owners(
        &self,
        address: Address,
        owner: Owner,
        owners_index: u64
    ) -> Box<dyn Future<Error = CoreError, Item = ()> + 'static> { ... }
fn get_adata_owners(
        &self,
        address: Address,
        owners_index: Index
    ) -> Box<dyn Future<Error = CoreError, Item = Owner> + 'static> { ... }
fn append_seq_adata(
        &self,
        append: AppendOperation,
        index: u64
    ) -> Box<dyn Future<Error = CoreError, Item = ()> + 'static> { ... }
fn append_unseq_adata(
        &self,
        append: AppendOperation
    ) -> Box<dyn Future<Error = CoreError, Item = ()> + 'static> { ... }
fn list_mdata_permissions(
        &self,
        address: Address
    ) -> Box<dyn Future<Error = CoreError, Item = BTreeMap<PublicKey, PermissionSet>> + 'static> { ... }
fn set_mdata_user_permissions(
        &self,
        address: Address,
        user: PublicKey,
        permissions: PermissionSet,
        version: u64
    ) -> Box<dyn Future<Error = CoreError, Item = ()> + 'static> { ... }
fn del_mdata_user_permissions(
        &self,
        address: Address,
        user: PublicKey,
        version: u64
    ) -> Box<dyn Future<Error = CoreError, Item = ()> + 'static> { ... }
fn change_mdata_owner(
        &self,
        name: XorName,
        tag: u64,
        new_owner: PublicKey,
        version: u64
    ) -> Box<dyn Future<Error = CoreError, Item = ()> + 'static> { ... }
fn test_set_balance(
        &self,
        client_id: Option<&FullId>,
        amount: Coins
    ) -> Box<dyn Future<Error = CoreError, Item = Transaction> + 'static> { ... } }

Trait providing an interface for self-authentication client implementations, so they can interface all requests from high-level APIs to the actual routing layer and manage all interactions with it. Clients are non-blocking, with an asynchronous API using the futures abstraction from the futures-rs crate.

Associated Types

type Context

Associated message type.

Loading content...

Required methods

fn full_id(&self) -> SafeKey

Return the client's ID.

fn owner_key(&self) -> PublicKey

Returns the client's owner key.

fn config(&self) -> Option<HashSet<SocketAddr, RandomState>>

Return a crust::Config if the Client was initialized with one.

fn inner(&self) -> Rc<RefCell<Inner<Self, Self::Context>>>

Return an associated ClientInner type which is expected to contain fields associated with the implementing type.

fn public_encryption_key(&self) -> PublicKey

Return the public encryption key.

fn secret_encryption_key(&self) -> SecretKey

Return the secret encryption key.

fn secret_symmetric_key(&self) -> Key

Return the symmetric encryption key.

Loading content...

Provided methods

fn public_id(&self) -> PublicId

Return the client's public ID.

fn public_key(&self) -> PublicKey

Returns the client's public key.

fn encryption_keypair(&self) -> (PublicKey, SecretKey)

Return the public and secret encryption keys.

fn compose_message(&self, request: Request, sign: bool) -> Message

Create a Message from the given request. This function adds the requester signature and message ID.

fn set_timeout(&self, duration: Duration)

Set request timeout.

fn restart_network(&self) -> Result<(), CoreError>

Restart the client and reconnect to the network.

fn put_unseq_mutable_data(
    &self,
    data: UnseqData
) -> Box<dyn Future<Error = CoreError, Item = ()> + 'static>

Put unsequenced mutable data to the network

fn transfer_coins(
    &self,
    client_id: Option<&FullId>,
    destination: XorName,
    amount: Coins,
    transaction_id: Option<u64>
) -> Box<dyn Future<Error = CoreError, Item = Transaction> + 'static>

Transfer coin balance

fn create_balance(
    &self,
    client_id: Option<&FullId>,
    new_balance_owner: PublicKey,
    amount: Coins,
    transaction_id: Option<u64>
) -> Box<dyn Future<Error = CoreError, Item = Transaction> + 'static>

Creates a new balance on the network.

fn insert_login_packet_for(
    &self,
    client_id: Option<&FullId>,
    new_owner: PublicKey,
    amount: Coins,
    transaction_id: Option<u64>,
    new_login_packet: LoginPacket
) -> Box<dyn Future<Error = CoreError, Item = Transaction> + 'static>

Insert a given login packet at the specified destination

fn get_balance(
    &self,
    client_id: Option<&FullId>
) -> Box<dyn Future<Error = CoreError, Item = Coins> + 'static>

Get the current coin balance.

fn put_idata(
    &self,
    data: impl Into<Data>
) -> Box<dyn Future<Error = CoreError, Item = ()> + 'static>

Put immutable data to the network.

fn get_idata(
    &self,
    address: Address
) -> Box<dyn Future<Error = CoreError, Item = Data> + 'static>

Get immutable data from the network. If the data exists locally in the cache then it will be immediately returned without making an actual network request.

fn del_unpub_idata(
    &self,
    name: XorName
) -> Box<dyn Future<Error = CoreError, Item = ()> + 'static>

Delete unpublished immutable data from the network.

fn put_seq_mutable_data(
    &self,
    data: SeqData
) -> Box<dyn Future<Error = CoreError, Item = ()> + 'static>

Put sequenced mutable data to the network

fn get_unseq_mdata(
    &self,
    name: XorName,
    tag: u64
) -> Box<dyn Future<Error = CoreError, Item = UnseqData> + 'static>

Fetch unpublished mutable data from the network

fn get_seq_mdata_value(
    &self,
    name: XorName,
    tag: u64,
    key: Vec<u8>
) -> Box<dyn Future<Error = CoreError, Item = SeqValue> + 'static>

Fetch the value for a given key in a sequenced mutable data

fn get_unseq_mdata_value(
    &self,
    name: XorName,
    tag: u64,
    key: Vec<u8>
) -> Box<dyn Future<Error = CoreError, Item = Vec<u8>> + 'static>

Fetch the value for a given key in a sequenced mutable data

fn get_seq_mdata(
    &self,
    name: XorName,
    tag: u64
) -> Box<dyn Future<Error = CoreError, Item = SeqData> + 'static>

Fetch sequenced mutable data from the network

fn mutate_seq_mdata_entries(
    &self,
    name: XorName,
    tag: u64,
    actions: SeqEntryActions
) -> Box<dyn Future<Error = CoreError, Item = ()> + 'static>

Mutates sequenced MutableData entries in bulk

fn mutate_unseq_mdata_entries(
    &self,
    name: XorName,
    tag: u64,
    actions: UnseqEntryActions
) -> Box<dyn Future<Error = CoreError, Item = ()> + 'static>

Mutates unsequenced MutableData entries in bulk

fn get_seq_mdata_shell(
    &self,
    name: XorName,
    tag: u64
) -> Box<dyn Future<Error = CoreError, Item = SeqData> + 'static>

Get a shell (bare bones) version of MutableData from the network.

fn get_unseq_mdata_shell(
    &self,
    name: XorName,
    tag: u64
) -> Box<dyn Future<Error = CoreError, Item = UnseqData> + 'static>

Get a shell (bare bones) version of MutableData from the network.

fn get_mdata_version(
    &self,
    address: Address
) -> Box<dyn Future<Error = CoreError, Item = u64> + 'static>

Get a current version of MutableData from the network.

fn list_unseq_mdata_entries(
    &self,
    name: XorName,
    tag: u64
) -> Box<dyn Future<Error = CoreError, Item = BTreeMap<Vec<u8>, Vec<u8>>> + 'static>

Return a complete list of entries in MutableData.

fn list_seq_mdata_entries(
    &self,
    name: XorName,
    tag: u64
) -> Box<dyn Future<Error = CoreError, Item = BTreeMap<Vec<u8>, SeqValue>> + 'static>

Return a complete list of entries in MutableData.

fn list_mdata_keys(
    &self,
    address: Address
) -> Box<dyn Future<Error = CoreError, Item = BTreeSet<Vec<u8>>> + 'static>

Return a list of keys in MutableData stored on the network.

fn list_seq_mdata_values(
    &self,
    name: XorName,
    tag: u64
) -> Box<dyn Future<Error = CoreError, Item = Vec<SeqValue>> + 'static>

Return a list of values in a Sequenced Mutable Data

fn list_mdata_user_permissions(
    &self,
    address: Address,
    user: PublicKey
) -> Box<dyn Future<Error = CoreError, Item = PermissionSet> + 'static>

Return the permissions set for a particular user

fn list_unseq_mdata_values(
    &self,
    name: XorName,
    tag: u64
) -> Box<dyn Future<Error = CoreError, Item = Vec<Vec<u8>>> + 'static>

Returns a list of values in an Unsequenced Mutable Data

fn put_adata(
    &self,
    data: Data
) -> Box<dyn Future<Error = CoreError, Item = ()> + 'static>

Put AppendOnly Data into the Network

fn get_adata(
    &self,
    address: Address
) -> Box<dyn Future<Error = CoreError, Item = Data> + 'static>

Get AppendOnly Data from the Network

fn get_adata_shell(
    &self,
    data_index: Index,
    address: Address
) -> Box<dyn Future<Error = CoreError, Item = Data> + 'static>

Get AppendOnly Data Shell from the Network

fn get_adata_value(
    &self,
    address: Address,
    key: Vec<u8>
) -> Box<dyn Future<Error = CoreError, Item = Vec<u8>> + 'static>

Fetch Value for the provided key from AppendOnly Data at {:?}

fn get_adata_range(
    &self,
    address: Address,
    range: (Index, Index)
) -> Box<dyn Future<Error = CoreError, Item = Vec<Entry>> + 'static>

Get a Set of Entries for the requested range from an AData.

fn get_adata_indices(
    &self,
    address: Address
) -> Box<dyn Future<Error = CoreError, Item = Indices> + 'static>

Get latest indices from an AppendOnly Data.

fn get_adata_last_entry(
    &self,
    address: Address
) -> Box<dyn Future<Error = CoreError, Item = Entry> + 'static>

Get the last data entry from an AppendOnly Data.

fn get_unpub_adata_permissions_at_index(
    &self,
    address: Address,
    permissions_index: Index
) -> Box<dyn Future<Error = CoreError, Item = UnpubPermissions> + 'static>

Get permissions at the provided index.

fn get_pub_adata_permissions_at_index(
    &self,
    address: Address,
    permissions_index: Index
) -> Box<dyn Future<Error = CoreError, Item = PubPermissions> + 'static>

Get permissions at the provided index.

fn get_pub_adata_user_permissions(
    &self,
    address: Address,
    permissions_index: Index,
    user: User
) -> Box<dyn Future<Error = CoreError, Item = PubPermissionSet> + 'static>

Get permissions for a specified user(s).

fn get_unpub_adata_user_permissions(
    &self,
    address: Address,
    permissions_index: Index,
    public_key: PublicKey
) -> Box<dyn Future<Error = CoreError, Item = UnpubPermissionSet> + 'static>

Get permissions for a specified user(s).

fn add_unpub_adata_permissions(
    &self,
    address: Address,
    permissions: UnpubPermissions,
    permissions_index: u64
) -> Box<dyn Future<Error = CoreError, Item = ()> + 'static>

Add AData Permissions

fn add_pub_adata_permissions(
    &self,
    address: Address,
    permissions: PubPermissions,
    permissions_index: u64
) -> Box<dyn Future<Error = CoreError, Item = ()> + 'static>

Add Pub AData Permissions

fn set_adata_owners(
    &self,
    address: Address,
    owner: Owner,
    owners_index: u64
) -> Box<dyn Future<Error = CoreError, Item = ()> + 'static>

Set new Owners to AData

fn get_adata_owners(
    &self,
    address: Address,
    owners_index: Index
) -> Box<dyn Future<Error = CoreError, Item = Owner> + 'static>

Set new Owners to AData

fn append_seq_adata(
    &self,
    append: AppendOperation,
    index: u64
) -> Box<dyn Future<Error = CoreError, Item = ()> + 'static>

Append to Published Seq AppendOnly Data

fn append_unseq_adata(
    &self,
    append: AppendOperation
) -> Box<dyn Future<Error = CoreError, Item = ()> + 'static>

Append to Unpublished Unseq AppendOnly Data

fn list_mdata_permissions(
    &self,
    address: Address
) -> Box<dyn Future<Error = CoreError, Item = BTreeMap<PublicKey, PermissionSet>> + 'static>

Return a list of permissions in MutableData stored on the network.

fn set_mdata_user_permissions(
    &self,
    address: Address,
    user: PublicKey,
    permissions: PermissionSet,
    version: u64
) -> Box<dyn Future<Error = CoreError, Item = ()> + 'static>

Updates or inserts a permissions set for a user

fn del_mdata_user_permissions(
    &self,
    address: Address,
    user: PublicKey,
    version: u64
) -> Box<dyn Future<Error = CoreError, Item = ()> + 'static>

Updates or inserts a permissions set for a user

fn change_mdata_owner(
    &self,
    name: XorName,
    tag: u64,
    new_owner: PublicKey,
    version: u64
) -> Box<dyn Future<Error = CoreError, Item = ()> + 'static>

Sends an ownership transfer request.

fn test_set_balance(
    &self,
    client_id: Option<&FullId>,
    amount: Coins
) -> Box<dyn Future<Error = CoreError, Item = Transaction> + 'static>

Set the coin balance to a specific value for testing

Loading content...

Implementations on Foreign Types

impl Client for CoreClient[src]

Loading content...

Implementors

Loading content...