Add local document JSON state commands
This commit is contained in:
parent
b102e07204
commit
e039a4f81f
11 changed files with 153 additions and 10 deletions
|
|
@ -256,6 +256,8 @@ pub enum DbCommand {
|
|||
pub enum DocumentCommand {
|
||||
Create { name: String },
|
||||
Status { name: String },
|
||||
Set { name: String, state_json: String },
|
||||
Get { name: String },
|
||||
}
|
||||
|
||||
#[derive(Debug, Subcommand)]
|
||||
|
|
@ -471,6 +473,10 @@ fn request_for_command(command: Command) -> Result<ControlRequest> {
|
|||
Command::Document { command } => match command {
|
||||
DocumentCommand::Create { name } => ControlRequest::DocumentCreate { name },
|
||||
DocumentCommand::Status { name } => ControlRequest::DocumentStatus { name },
|
||||
DocumentCommand::Set { name, state_json } => {
|
||||
ControlRequest::DocumentSet { name, state_json }
|
||||
}
|
||||
DocumentCommand::Get { name } => ControlRequest::DocumentGet { name },
|
||||
},
|
||||
Command::Ssh { command } => match command {
|
||||
SshCommand::Proxy { node } => ControlRequest::ModuleStub {
|
||||
|
|
@ -904,6 +910,14 @@ fn print_response(response: ControlResponse, json: bool) -> Result<()> {
|
|||
println!("sync_status: {}", document.sync_status);
|
||||
println!("state_bytes: {}", document.state_bytes);
|
||||
}
|
||||
ControlResponse::DocumentSet { state } => {
|
||||
println!("updated document: {}", state.document.name);
|
||||
println!("state_bytes: {}", state.document.state_bytes);
|
||||
println!("updated_at_ms: {}", state.updated_at.0);
|
||||
}
|
||||
ControlResponse::DocumentGet { state } => {
|
||||
println!("{}", state.state_json);
|
||||
}
|
||||
ControlResponse::PubsubPublished { message } => {
|
||||
println!("published: {}", message.topic);
|
||||
println!("published_at_ms: {}", message.published_at.0);
|
||||
|
|
|
|||
Loading…
Reference in a new issue