[][src]Trait safe_core::client::Client

pub trait Client: Clone + 'static {
    type Context;
    fn full_id(&self) -> SafeKey;
fn owner_key(&self) -> PublicKey;
fn config(&self) -> Option<BootstrapConfig>;
fn inner(&self) -> Rc<RefCell<ClientInner<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: UnseqMutableData
    ) -> Box<CoreFuture<()>> { ... }
fn transfer_coins(
        &self,
        client_id: Option<&ClientFullId>,
        destination: XorName,
        amount: Coins,
        transaction_id: Option<u64>
    ) -> Box<CoreFuture<Transaction>> { ... }
fn create_balance(
        &self,
        client_id: Option<&ClientFullId>,
        new_balance_owner: PublicKey,
        amount: Coins,
        transaction_id: Option<u64>
    ) -> Box<CoreFuture<Transaction>> { ... }
fn insert_login_packet_for(
        &self,
        client_id: Option<&ClientFullId>,
        new_owner: PublicKey,
        amount: Coins,
        transaction_id: Option<u64>,
        new_login_packet: LoginPacket
    ) -> Box<CoreFuture<Transaction>> { ... }
fn get_balance(
        &self,
        client_id: Option<&ClientFullId>
    ) -> Box<CoreFuture<Coins>> { ... }
fn put_idata(&self, data: impl Into<IData>) -> Box<CoreFuture<()>> { ... }
fn get_idata(&self, address: IDataAddress) -> Box<CoreFuture<IData>> { ... }
fn del_unpub_idata(&self, name: XorName) -> Box<CoreFuture<()>> { ... }
fn put_seq_mutable_data(&self, data: SeqMutableData) -> Box<CoreFuture<()>> { ... }
fn get_unseq_mdata(
        &self,
        name: XorName,
        tag: u64
    ) -> Box<CoreFuture<UnseqMutableData>> { ... }
fn get_seq_mdata_value(
        &self,
        name: XorName,
        tag: u64,
        key: Vec<u8>
    ) -> Box<CoreFuture<MDataSeqValue>> { ... }
fn get_unseq_mdata_value(
        &self,
        name: XorName,
        tag: u64,
        key: Vec<u8>
    ) -> Box<CoreFuture<Vec<u8>>> { ... }
fn get_seq_mdata(
        &self,
        name: XorName,
        tag: u64
    ) -> Box<CoreFuture<SeqMutableData>> { ... }
fn mutate_seq_mdata_entries(
        &self,
        name: XorName,
        tag: u64,
        actions: MDataSeqEntryActions
    ) -> Box<CoreFuture<()>> { ... }
fn mutate_unseq_mdata_entries(
        &self,
        name: XorName,
        tag: u64,
        actions: MDataUnseqEntryActions
    ) -> Box<CoreFuture<()>> { ... }
fn get_seq_mdata_shell(
        &self,
        name: XorName,
        tag: u64
    ) -> Box<CoreFuture<SeqMutableData>> { ... }
fn get_unseq_mdata_shell(
        &self,
        name: XorName,
        tag: u64
    ) -> Box<CoreFuture<UnseqMutableData>> { ... }
fn get_mdata_version(&self, address: MDataAddress) -> Box<CoreFuture<u64>> { ... }
fn list_unseq_mdata_entries(
        &self,
        name: XorName,
        tag: u64
    ) -> Box<CoreFuture<BTreeMap<Vec<u8>, Vec<u8>>>> { ... }
fn list_seq_mdata_entries(
        &self,
        name: XorName,
        tag: u64
    ) -> Box<CoreFuture<MDataSeqEntries>> { ... }
fn list_mdata_keys(
        &self,
        address: MDataAddress
    ) -> Box<CoreFuture<BTreeSet<Vec<u8>>>> { ... }
fn list_seq_mdata_values(
        &self,
        name: XorName,
        tag: u64
    ) -> Box<CoreFuture<Vec<MDataSeqValue>>> { ... }
fn list_mdata_user_permissions(
        &self,
        address: MDataAddress,
        user: PublicKey
    ) -> Box<CoreFuture<MDataPermissionSet>> { ... }
fn list_unseq_mdata_values(
        &self,
        name: XorName,
        tag: u64
    ) -> Box<CoreFuture<Vec<Vec<u8>>>> { ... }
fn put_adata(&self, data: AData) -> Box<CoreFuture<()>> { ... }
fn get_adata(&self, address: ADataAddress) -> Box<CoreFuture<AData>> { ... }
fn get_adata_shell(
        &self,
        data_index: ADataIndex,
        address: ADataAddress
    ) -> Box<CoreFuture<AData>> { ... }
fn get_adata_value(
        &self,
        address: ADataAddress,
        key: Vec<u8>
    ) -> Box<CoreFuture<Vec<u8>>> { ... }
fn get_adata_range(
        &self,
        address: ADataAddress,
        range: (ADataIndex, ADataIndex)
    ) -> Box<CoreFuture<ADataEntries>> { ... }
fn get_adata_indices(
        &self,
        address: ADataAddress
    ) -> Box<CoreFuture<ADataIndices>> { ... }
fn get_adata_last_entry(
        &self,
        address: ADataAddress
    ) -> Box<CoreFuture<ADataEntry>> { ... }
fn get_unpub_adata_permissions_at_index(
        &self,
        address: ADataAddress,
        permissions_index: ADataIndex
    ) -> Box<CoreFuture<ADataUnpubPermissions>> { ... }
fn get_pub_adata_permissions_at_index(
        &self,
        address: ADataAddress,
        permissions_index: ADataIndex
    ) -> Box<CoreFuture<ADataPubPermissions>> { ... }
fn get_pub_adata_user_permissions(
        &self,
        address: ADataAddress,
        permissions_index: ADataIndex,
        user: ADataUser
    ) -> Box<CoreFuture<ADataPubPermissionSet>> { ... }
fn get_unpub_adata_user_permissions(
        &self,
        address: ADataAddress,
        permissions_index: ADataIndex,
        public_key: PublicKey
    ) -> Box<CoreFuture<ADataUnpubPermissionSet>> { ... }
fn add_unpub_adata_permissions(
        &self,
        address: ADataAddress,
        permissions: ADataUnpubPermissions,
        permissions_index: u64
    ) -> Box<CoreFuture<()>> { ... }
fn add_pub_adata_permissions(
        &self,
        address: ADataAddress,
        permissions: ADataPubPermissions,
        permissions_index: u64
    ) -> Box<CoreFuture<()>> { ... }
fn set_adata_owners(
        &self,
        address: ADataAddress,
        owner: ADataOwner,
        owners_index: u64
    ) -> Box<CoreFuture<()>> { ... }
fn get_adata_owners(
        &self,
        address: ADataAddress,
        owners_index: ADataIndex
    ) -> Box<CoreFuture<ADataOwner>> { ... }
fn append_seq_adata(
        &self,
        append: ADataAppendOperation,
        index: u64
    ) -> Box<CoreFuture<()>> { ... }
fn append_unseq_adata(
        &self,
        append: ADataAppendOperation
    ) -> Box<CoreFuture<()>> { ... }
fn list_mdata_permissions(
        &self,
        address: MDataAddress
    ) -> Box<CoreFuture<BTreeMap<PublicKey, MDataPermissionSet>>> { ... }
fn set_mdata_user_permissions(
        &self,
        address: MDataAddress,
        user: PublicKey,
        permissions: MDataPermissionSet,
        version: u64
    ) -> Box<CoreFuture<()>> { ... }
fn del_mdata_user_permissions(
        &self,
        address: MDataAddress,
        user: PublicKey,
        version: u64
    ) -> Box<CoreFuture<()>> { ... }
fn change_mdata_owner(
        &self,
        name: XorName,
        tag: u64,
        new_owner: PublicKey,
        version: u64
    ) -> Box<CoreFuture<()>> { ... } }

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<BootstrapConfig>

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

fn inner(&self) -> Rc<RefCell<ClientInner<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: UnseqMutableData) -> Box<CoreFuture<()>>

Put unsequenced mutable data to the network

fn transfer_coins(
    &self,
    client_id: Option<&ClientFullId>,
    destination: XorName,
    amount: Coins,
    transaction_id: Option<u64>
) -> Box<CoreFuture<Transaction>>

Transfer coin balance

fn create_balance(
    &self,
    client_id: Option<&ClientFullId>,
    new_balance_owner: PublicKey,
    amount: Coins,
    transaction_id: Option<u64>
) -> Box<CoreFuture<Transaction>>

Creates a new balance on the network.

fn insert_login_packet_for(
    &self,
    client_id: Option<&ClientFullId>,
    new_owner: PublicKey,
    amount: Coins,
    transaction_id: Option<u64>,
    new_login_packet: LoginPacket
) -> Box<CoreFuture<Transaction>>

Insert a given login packet at the specified destination

fn get_balance(
    &self,
    client_id: Option<&ClientFullId>
) -> Box<CoreFuture<Coins>>

Get the current coin balance.

fn put_idata(&self, data: impl Into<IData>) -> Box<CoreFuture<()>>

Put immutable data to the network.

fn get_idata(&self, address: IDataAddress) -> Box<CoreFuture<IData>>

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<CoreFuture<()>>

Delete unpublished immutable data from the network.

fn put_seq_mutable_data(&self, data: SeqMutableData) -> Box<CoreFuture<()>>

Put sequenced mutable data to the network

fn get_unseq_mdata(
    &self,
    name: XorName,
    tag: u64
) -> Box<CoreFuture<UnseqMutableData>>

Fetch unpublished mutable data from the network

fn get_seq_mdata_value(
    &self,
    name: XorName,
    tag: u64,
    key: Vec<u8>
) -> Box<CoreFuture<MDataSeqValue>>

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<CoreFuture<Vec<u8>>>

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

fn get_seq_mdata(
    &self,
    name: XorName,
    tag: u64
) -> Box<CoreFuture<SeqMutableData>>

Fetch sequenced mutable data from the network

fn mutate_seq_mdata_entries(
    &self,
    name: XorName,
    tag: u64,
    actions: MDataSeqEntryActions
) -> Box<CoreFuture<()>>

Mutates sequenced MutableData entries in bulk

fn mutate_unseq_mdata_entries(
    &self,
    name: XorName,
    tag: u64,
    actions: MDataUnseqEntryActions
) -> Box<CoreFuture<()>>

Mutates unsequenced MutableData entries in bulk

fn get_seq_mdata_shell(
    &self,
    name: XorName,
    tag: u64
) -> Box<CoreFuture<SeqMutableData>>

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

fn get_unseq_mdata_shell(
    &self,
    name: XorName,
    tag: u64
) -> Box<CoreFuture<UnseqMutableData>>

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

fn get_mdata_version(&self, address: MDataAddress) -> Box<CoreFuture<u64>>

Get a current version of MutableData from the network.

fn list_unseq_mdata_entries(
    &self,
    name: XorName,
    tag: u64
) -> Box<CoreFuture<BTreeMap<Vec<u8>, Vec<u8>>>>

Return a complete list of entries in MutableData.

fn list_seq_mdata_entries(
    &self,
    name: XorName,
    tag: u64
) -> Box<CoreFuture<MDataSeqEntries>>

Return a complete list of entries in MutableData.

fn list_mdata_keys(
    &self,
    address: MDataAddress
) -> Box<CoreFuture<BTreeSet<Vec<u8>>>>

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

fn list_seq_mdata_values(
    &self,
    name: XorName,
    tag: u64
) -> Box<CoreFuture<Vec<MDataSeqValue>>>

Return a list of values in a Sequenced Mutable Data

fn list_mdata_user_permissions(
    &self,
    address: MDataAddress,
    user: PublicKey
) -> Box<CoreFuture<MDataPermissionSet>>

Return the permissions set for a particular user

fn list_unseq_mdata_values(
    &self,
    name: XorName,
    tag: u64
) -> Box<CoreFuture<Vec<Vec<u8>>>>

Returns a list of values in an Unsequenced Mutable Data

fn put_adata(&self, data: AData) -> Box<CoreFuture<()>>

Put AppendOnly Data into the Network

fn get_adata(&self, address: ADataAddress) -> Box<CoreFuture<AData>>

Get AppendOnly Data from the Network

fn get_adata_shell(
    &self,
    data_index: ADataIndex,
    address: ADataAddress
) -> Box<CoreFuture<AData>>

Get AppendOnly Data Shell from the Network

fn get_adata_value(
    &self,
    address: ADataAddress,
    key: Vec<u8>
) -> Box<CoreFuture<Vec<u8>>>

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

fn get_adata_range(
    &self,
    address: ADataAddress,
    range: (ADataIndex, ADataIndex)
) -> Box<CoreFuture<ADataEntries>>

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

fn get_adata_indices(
    &self,
    address: ADataAddress
) -> Box<CoreFuture<ADataIndices>>

Get latest indices from an AppendOnly Data.

fn get_adata_last_entry(
    &self,
    address: ADataAddress
) -> Box<CoreFuture<ADataEntry>>

Get the last data entry from an AppendOnly Data.

fn get_unpub_adata_permissions_at_index(
    &self,
    address: ADataAddress,
    permissions_index: ADataIndex
) -> Box<CoreFuture<ADataUnpubPermissions>>

Get permissions at the provided index.

fn get_pub_adata_permissions_at_index(
    &self,
    address: ADataAddress,
    permissions_index: ADataIndex
) -> Box<CoreFuture<ADataPubPermissions>>

Get permissions at the provided index.

fn get_pub_adata_user_permissions(
    &self,
    address: ADataAddress,
    permissions_index: ADataIndex,
    user: ADataUser
) -> Box<CoreFuture<ADataPubPermissionSet>>

Get permissions for a specified user(s).

fn get_unpub_adata_user_permissions(
    &self,
    address: ADataAddress,
    permissions_index: ADataIndex,
    public_key: PublicKey
) -> Box<CoreFuture<ADataUnpubPermissionSet>>

Get permissions for a specified user(s).

fn add_unpub_adata_permissions(
    &self,
    address: ADataAddress,
    permissions: ADataUnpubPermissions,
    permissions_index: u64
) -> Box<CoreFuture<()>>

Add AData Permissions

fn add_pub_adata_permissions(
    &self,
    address: ADataAddress,
    permissions: ADataPubPermissions,
    permissions_index: u64
) -> Box<CoreFuture<()>>

Add Pub AData Permissions

fn set_adata_owners(
    &self,
    address: ADataAddress,
    owner: ADataOwner,
    owners_index: u64
) -> Box<CoreFuture<()>>

Set new Owners to AData

fn get_adata_owners(
    &self,
    address: ADataAddress,
    owners_index: ADataIndex
) -> Box<CoreFuture<ADataOwner>>

Set new Owners to AData

fn append_seq_adata(
    &self,
    append: ADataAppendOperation,
    index: u64
) -> Box<CoreFuture<()>>

Append to Published Seq AppendOnly Data

fn append_unseq_adata(
    &self,
    append: ADataAppendOperation
) -> Box<CoreFuture<()>>

Append to Unpublished Unseq AppendOnly Data

fn list_mdata_permissions(
    &self,
    address: MDataAddress
) -> Box<CoreFuture<BTreeMap<PublicKey, MDataPermissionSet>>>

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

fn set_mdata_user_permissions(
    &self,
    address: MDataAddress,
    user: PublicKey,
    permissions: MDataPermissionSet,
    version: u64
) -> Box<CoreFuture<()>>

Updates or inserts a permissions set for a user

fn del_mdata_user_permissions(
    &self,
    address: MDataAddress,
    user: PublicKey,
    version: u64
) -> Box<CoreFuture<()>>

Updates or inserts a permissions set for a user

fn change_mdata_owner(
    &self,
    name: XorName,
    tag: u64,
    new_owner: PublicKey,
    version: u64
) -> Box<CoreFuture<()>>

Sends an ownership transfer request.

Loading content...

Implementors

Loading content...