logo

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 length arguments which specify the start position and the length of bytes to be read. Passing 0 to position reads the data from the beginning, and the length is just an upper limit.

Examples

TODO: update once data types are crdt compliant

Tries to chunk the bytes, returning an address and chunks, without storing anything to network.

Directly writes Bytes to the network in the form of immutable chunks, without any batching.

Directly writes a [Blob] to the network in the form of immutable self encrypted chunks, without any batching. It also attempts to verify the Blob was uploaded to the network before returning.

Calculates a Blob’s/Spot’s address from self encrypted chunks, without storing them onto the 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.

Send a Query to the network and await a response. Queries are automatically retried using exponential backoff if the timeout is hit.

Send a Query to the network and await a response. Queries are not retried if the timeout is hit.

Send a Query to the network and await a response. This is part of a public API, for the user to provide the serialised and already signed query.

Publish all register mutation operations in a WAL to the network Incrementing the WAL index as successful writes are sent out. Stops at the first error. Starts publishing from the index when called again with the same WAL.

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.

Returns a write ahead log (WAL) of register operations, note that the changes are not uploaded to the network until the WAL is published with publish_register_ops

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.

Returns a write ahead log (WAL) of register operations, note that the changes are not uploaded to the network until the WAL is published with publish_register_ops

A tag must be supplied. A xorname must be supplied, this can be random or deterministic as per your apps needs.

Delete Register

Returns a write ahead log (WAL) of register operations, note that the changes are not uploaded to the network until the WAL is published with publish_register_ops

You’re only able to delete a PrivateRegister. Public data can not be removed from the network.

Write to Register

Returns a write ahead log (WAL) of register operations, note that the changes are not uploaded to the network until the WAL is published with publish_register_ops

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.

pub async fn get_register_entry(
    &self,
    address: Address,
    hash: EntryHash
) -> Result<Entry, Error>

Get an entry from a Register on the Network by its hash

Get the owner of a Register.

Get the set of Permissions in a Register for a specific user.

Get the Policy of a Register.

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

Return the client’s PublicKey.

Examples

TODO: update once data types are crdt compliant

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

Set the foreground color generically Read more

Set the background color generically. Read more

Change the foreground color to black

Change the foreground color to black

Change the foreground color to red

Change the foreground color to red

Change the foreground color to green

Change the foreground color to green

Change the foreground color to yellow

Change the foreground color to yellow

Change the foreground color to blue

Change the foreground color to blue

Change the foreground color to magenta

Change the foreground color to magenta

Change the foreground color to purple

Change the foreground color to purple

Change the foreground color to cyan

Change the foreground color to cyan

Change the foreground color to white

Change the foreground color to white

Change the foreground color to bright black

Change the foreground color to bright black

Change the foreground color to bright red

Change the foreground color to bright red

Change the foreground color to bright green

Change the foreground color to bright green

Change the foreground color to bright yellow

Change the foreground color to bright yellow

Change the foreground color to bright blue

Change the foreground color to bright blue

Change the foreground color to bright magenta

Change the foreground color to bright magenta

Change the foreground color to bright purple

Change the foreground color to bright purple

Change the foreground color to bright cyan

Change the foreground color to bright cyan

Change the foreground color to bright white

Change the foreground color to bright white

Make the text bold

Make the text dim

Make the text italicized

Make the text italicized

Make the text blink

Make the text blink (but fast!)

Swap the foreground and background colors

Hide the text

Cross out the text

Set the foreground color at runtime. Only use if you do not know which color will be used at compile-time. If the color is constant, use either OwoColorize::fg or a color-specific method, such as OwoColorize::green, Read more

Set the background color at runtime. Only use if you do not know what color to use at compile-time. If the color is constant, use either OwoColorize::bg or a color-specific method, such as OwoColorize::on_yellow, Read more

Sets the foreground color to an RGB value.

Sets the background color to an RGB value.

Apply a runtime-determined style

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

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