Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rel 0.5.0 #3

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
75b440f
Init Databroker API V2
rafaeling May 16, 2024
2e103a6
Added oneof to Datapoint and some changes
rafaeling May 21, 2024
c01314a
Rename oneof Datapoint
rafaeling May 28, 2024
50ca9a4
Add oneof for Stream Provider response
rafaeling May 28, 2024
ce13516
Update provide stream response and add files to the build project
rafaeling May 29, 2024
32c79d8
Update ProvideStream and Actuate calls
rafaeling May 31, 2024
761d9c0
Add Start/Stop Signal
rafaeling Jun 3, 2024
ce7cfc1
Remove Start/Stop Signal and add batch methods
rafaeling Jun 4, 2024
3221203
Use correct numeration
rafaeling Jun 4, 2024
5afc533
Clean up and rename messages
rafaeling Jun 4, 2024
233138e
Move ValueFailure to bottom
rafaeling Jun 4, 2024
48a603f
Add proposed API
argerus Jun 7, 2024
982968d
Updates after review session
rafaeling Jun 20, 2024
6f12990
format
rafaeling Jun 20, 2024
70c41c4
pre commit
rafaeling Jun 20, 2024
5ce44ce
Improve documentation
rafaeling Jun 24, 2024
49f2a8f
Avoid reusing messages among calls
rafaeling Jun 24, 2024
077d488
Add signal i32 id to metadata
rafaeling Jul 15, 2024
d11f942
Fix year comment
rafaeling Jul 15, 2024
440b82a
Introduce subscribe i32 parameter due to performance reasons
rafaeling Aug 15, 2024
84477a2
Correct parameter name
rafaeling Aug 15, 2024
cf8fe5c
Kuksa val v2 skeleton
rafaeling Jul 15, 2024
b5a83fa
Initial publish request values implementation for OpenProviderStream
rafaeling Jul 15, 2024
5aa94c6
Initial implementation for ListMetadata
rafaeling Jul 30, 2024
6b092a2
Extend unit test
rafaeling Aug 6, 2024
7ad3ed5
Subscribe & publish_value
lukasmittag Aug 2, 2024
29f9d58
Formatting & clippy findings
lukasmittag Aug 2, 2024
d2e6a69
Fix test for subscribe
lukasmittag Aug 7, 2024
9f15761
Formatting
lukasmittag Aug 8, 2024
c5d08d4
Test for get_signal_id and HashMap:with_capacity adaption
lukasmittag Aug 13, 2024
c8a2aba
check without if else publish value succeeds
lukasmittag Aug 14, 2024
97f123e
Adapt to changes of API v2 that came recently in
lukasmittag Sep 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions databroker-proto/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
"proto/sdv/databroker/v1/collector.proto",
"proto/kuksa/val/v1/val.proto",
"proto/kuksa/val/v1/types.proto",
"proto/kuksa/val/v2/val.proto",
"proto/kuksa/val/v2/types.proto",
],
&["proto"],
)?;
Expand Down
3 changes: 3 additions & 0 deletions databroker-proto/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,5 +143,8 @@ pub mod kuksa {
}
}
}
pub mod v2 {
tonic::include_proto!("kuksa.val.v2");
}
}
}
33 changes: 32 additions & 1 deletion databroker/src/broker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use crate::permissions::{PermissionError, Permissions};
pub use crate::types;

use crate::query;
pub use crate::types::{ChangeType, DataType, DataValue, EntryType};
pub use crate::types::{ChangeType, DataType, DataValue, EntryType, ValueFailure};

use tokio::sync::{broadcast, mpsc, RwLock};
use tokio_stream::wrappers::ReceiverStream;
Expand Down Expand Up @@ -43,6 +43,37 @@ pub enum UpdateError {
PermissionExpired,
}

impl UpdateError {
pub fn to_status_with_code(&self, id: &i32) -> tonic::Status {
match self {
UpdateError::NotFound => tonic::Status::new(
tonic::Code::NotFound,
format!("Signal not found (id: {})", id),
),
UpdateError::WrongType => tonic::Status::new(
tonic::Code::InvalidArgument,
format!("Wrong type provided (id: {})", id),
),
UpdateError::OutOfBounds => tonic::Status::new(
tonic::Code::OutOfRange,
format!("Index out of bounds (id: {})", id),
),
UpdateError::UnsupportedType => tonic::Status::new(
tonic::Code::Unimplemented,
format!("Unsupported type (id: {})", id),
),
UpdateError::PermissionDenied => tonic::Status::new(
tonic::Code::PermissionDenied,
format!("Permission denied (id: {})", id),
),
UpdateError::PermissionExpired => tonic::Status::new(
tonic::Code::Unauthenticated,
format!("Permission expired (id: {})", id),
),
}
}
}

#[derive(Debug, Clone)]
pub enum ReadError {
NotFound,
Expand Down
2 changes: 2 additions & 0 deletions databroker/src/grpc/kuksa_val_v1/conversions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ impl From<broker::Datapoint> for Option<proto::Datapoint> {
})),
timestamp: Some(from.ts.into()),
}),
broker::DataValue::ValueFailure(_) => None,
}
}
}
Expand Down Expand Up @@ -231,6 +232,7 @@ impl From<broker::DataValue> for Option<proto::Datapoint> {
})),
timestamp: None,
}),
broker::DataValue::ValueFailure(_) => None,
}
}
}
Expand Down
Loading