pub struct ControlChannel(_);
Expand description

The Sonic Channel Control mode is used for administration purposes. Once in this mode, you cannot switch to other modes or gain access to commands from other modes.

Available commands

In this mode you can use consolidate, backup, restore, ping and quit commands.

Note: This mode requires enabling the control feature.

Implementations

Stop connection.

let channel = ControlChannel::start(
    "localhost:1491",
    "SecretPassword",
)?;

channel.quit()?;

Ping server.

let channel = ControlChannel::start(
    "localhost:1491",
    "SecretPassword",
)?;

channel.ping()?;

Trigger control action.

Note: This method requires enabling the control feature and start connection in Control mode

let control_channel = ControlChannel::start(
    "localhost:1491",
    "SecretPassword",
)?;

control_channel.trigger(TriggerRequest::Consolidate)?;

Consolidate indexed search data instead of waiting for the next automated consolidation tick.

Note: This method requires enabling the control feature and start connection in Control mode.

let control_channel = ControlChannel::start(
    "localhost:1491",
    "SecretPassword",
)?;

control_channel.consolidate()?;

Backup KV + FST to /<BACKUP_{KV/FST}_PATH> See sonic backend source code for more information.

Note: This method requires enabling the control feature and start connection in Control mode.

let control_channel = ControlChannel::start(
    "localhost:1491",
    "SecretPassword",
)?;

control_channel.backup("2020-08-07T23-48")?;

Restore KV + FST from if you already have backup with the same name.

Note: This method requires enabling the control feature and start connection in Control mode.

let control_channel = ControlChannel::start(
    "localhost:1491",
    "SecretPassword",
)?;

let result = control_channel.restore("2020-08-07T23-48")?;
assert_eq!(result, ());

Trait Implementations

Formats the value using the given formatter. Read more
Sonic channel struct
Returns reference for sonic stream of connection
Connects to sonic backend and run start command. 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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

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.