Struct safe_network::client::client_api::Client [−][src]
pub struct Client { /* fields omitted */ }
Expand description
Client object
Implementations
Reads Bytes
from the network, whose contents are contained within on or more chunks.
Read bytes from the network. The contents are spread across multiple chunks in the network. This function invokes the self-encryptor and returns the data that was initially stored.
Takes position
and len
arguments which specify the start position
and the length of bytes to be read. Passing 0
to position reads the data from the beginning.
Passing None
to length reads the full length of the data.
Examples
TODO: update once data types are crdt compliant
Tries to chunk the bytes, returning an address and chunks, without storing anything to network.
Send a signed DataCmd to the network. This is to be part of a public API, for the user to provide the serialised and already signed command.
Create a Private Register onto the Network
Creates a private Register on the network which can then be written to. Private data can be removed from the network at a later date.
A tag must be supplied. A xorname must be supplied, this can be random or deterministic as per your apps needs.
Create a Public Register onto the Network
Creates a public Register on the network which can then be written to. Public data can not be removed from the network at a later date.
A tag must be supplied. A xorname must be supplied, this can be random or deterministic as per your apps needs.
Delete Register
You’re only able to delete a PrivateRegister. Public data can no be removed from the network.
Write to Register
Public or private isn’t important for writing, though the data you write will be Public or Private according to the type of the targeted Register.
Get a Register from the Network
Get the last data entry from a Register data.
Get an entry from a Register on the Network by its hash
Get the owner of a Register.
pub async fn get_register_permissions_for_user(
&self,
address: Address,
user: PublicKey
) -> Result<Permissions, Error>
pub async fn get_register_permissions_for_user(
&self,
address: Address,
user: PublicKey
) -> Result<Permissions, Error>
Get the set of Permissions in a Register for a specific user.
Easily manage connections to/from The Safe Network with the client and its APIs. Use a random client for read-only or one-time operations. Supply an existing, SecretKey which holds a SafeCoin balance to be able to perform write operations.
Create a Safe Network client instance. Either for an existing SecretKey (in which case) the client will attempt to retrieve the history of the key’s balance in order to be ready for any token operations. Or if no SecreteKey is passed, a random keypair will be used, which provides a client that can only perform Read operations (at least until the client’s SecretKey receives some token).
Examples
TODO: update once data types are crdt compliant
Return the client’s keypair.
Useful for retrieving the PublicKey or KeyPair in the event you need to sign something
Examples
TODO: update once data types are crdt compliant
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Client
impl !UnwindSafe for Client
Blanket Implementations
Mutably borrows from an owned value. Read more
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more