Follow some guidelines for proto notation
This commit is contained in:
parent
81229ce757
commit
b6bbd540dd
|
|
@ -0,0 +1,16 @@
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 4
|
||||||
|
insert_final_newline = true
|
||||||
|
charset = utf-8
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
end_of_line = lf
|
||||||
|
|
||||||
|
[*.{proto}]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
|
||||||
|
[*.{md,markdown}]
|
||||||
|
trim_trailing_whitespace = false
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
version: v1
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
tonic_build::compile_protos("proto/crabidy.proto")?;
|
tonic_build::compile_protos("crabidy/v1/crabidy.proto")?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,13 @@
|
||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
package crabidy;
|
package crabidy.v1;
|
||||||
|
|
||||||
service Library {
|
service LibraryService {
|
||||||
rpc GetLibraryNode (LibraryNodeRequest) returns (LibraryNodeResponse);
|
rpc GetLibraryNode(GetLibraryNodeRequest) returns (GetLibraryNodeResponse);
|
||||||
|
rpc GetTrack(GetTrackRequest) returns (GetTrackResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
// To signal whether it's loading data (for frontend only probably -
|
// To signal whether it's loading data (for frontend only probably -
|
||||||
// could also be used for clients?)
|
// could also be used for fetching from providers?)
|
||||||
enum LibraryNodeState {
|
enum LibraryNodeState {
|
||||||
LIBRARY_NODE_STATE_UNSPECIFIED = 0;
|
LIBRARY_NODE_STATE_UNSPECIFIED = 0;
|
||||||
LIBRARY_NODE_STATE_PENDING = 1;
|
LIBRARY_NODE_STATE_PENDING = 1;
|
||||||
|
|
@ -41,10 +42,18 @@ message LibraryNode {
|
||||||
bool is_queable = 7;
|
bool is_queable = 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
message LibraryNodeRequest {
|
message GetLibraryNodeRequest {
|
||||||
string uuid = 1;
|
string uuid = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
message LibraryNodeResponse {
|
message GetLibraryNodeResponse {
|
||||||
LibraryNode node = 1;
|
LibraryNode node = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message GetTrackRequest {
|
||||||
|
string uuid = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetTrackResponse {
|
||||||
|
Track track = 1;
|
||||||
|
}
|
||||||
|
|
@ -2,7 +2,7 @@ pub mod proto;
|
||||||
|
|
||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
|
|
||||||
use proto::crabidy::LibraryNode;
|
|
||||||
|
|
||||||
#[async_trait]
|
#[async_trait]
|
||||||
pub trait ProviderClient: std::fmt::Debug + Send + Sync {
|
pub trait ProviderClient: std::fmt::Debug + Send + Sync {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
pub mod crabidy {
|
pub mod crabidy {
|
||||||
// The string specified here must match the proto package name
|
// The string specified here must match the proto package name
|
||||||
tonic::include_proto!("crabidy");
|
tonic::include_proto!("crabidy.v1");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue