Skip to content

Commit

Permalink
Rename size bytes to size in returned models (#968)
Browse files Browse the repository at this point in the history
  • Loading branch information
spetz authored May 28, 2024
1 parent c0bf739 commit 53bda3a
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 26 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions integration/tests/cli/stream/test_stream_purge_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ impl IggyCmdTestCase for TestStreamPurgeCmd {
let stream_state = client.get_stream(&self.stream_id.try_into().unwrap()).await;
assert!(stream_state.is_ok());
let stream_state = stream_state.unwrap();
assert!(stream_state.size_bytes > 0);
assert!(stream_state.size > 0);
}

fn get_command(&self) -> IggyCmdCommand {
Expand Down Expand Up @@ -107,7 +107,7 @@ impl IggyCmdTestCase for TestStreamPurgeCmd {
let stream_state = client.get_stream(&self.stream_id.try_into().unwrap()).await;
assert!(stream_state.is_ok());
let stream_state = stream_state.unwrap();
assert_eq!(stream_state.size_bytes, 0);
assert_eq!(stream_state.size, 0);

let stream_delete = client
.delete_stream(&self.stream_id.try_into().unwrap())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ async fn validate_stream(
.unwrap();

// 2. Validate stream size and number of messages
assert_eq!(stream.size_bytes, expected_size);
assert_eq!(stream.size, expected_size);
assert_eq!(stream.messages_count, expected_messages_count);
}

Expand Down
8 changes: 4 additions & 4 deletions integration/tests/server/scenarios/system_scenario.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ pub async fn run(client_factory: &dyn ClientFactory) {
assert_eq!(stream.id, STREAM_ID);
assert_eq!(stream.name, STREAM_NAME);
assert_eq!(stream.topics_count, 0);
assert_eq!(stream.size_bytes, 0);
assert_eq!(stream.size, 0);
assert_eq!(stream.messages_count, 0);

// 5. Get stream details by ID
Expand All @@ -75,7 +75,7 @@ pub async fn run(client_factory: &dyn ClientFactory) {
assert_eq!(stream.name, STREAM_NAME);
assert_eq!(stream.topics_count, 0);
assert!(stream.topics.is_empty());
assert_eq!(stream.size_bytes, 0);
assert_eq!(stream.size, 0);
assert_eq!(stream.messages_count, 0);

// 6. Get stream details by name
Expand Down Expand Up @@ -146,7 +146,7 @@ pub async fn run(client_factory: &dyn ClientFactory) {
for topic_partition in topic.partitions {
assert_eq!(topic_partition.id, id);
assert_eq!(topic_partition.segments_count, 1);
assert_eq!(topic_partition.size_bytes, 0);
assert_eq!(topic_partition.size, 0);
assert_eq!(topic_partition.current_offset, 0);
assert_eq!(topic_partition.messages_count, 0);
id += 1;
Expand Down Expand Up @@ -284,7 +284,7 @@ pub async fn run(client_factory: &dyn ClientFactory) {
let topic_partition = topic.partitions.get((PARTITION_ID - 1) as usize).unwrap();
assert_eq!(topic_partition.id, PARTITION_ID);
assert_eq!(topic_partition.segments_count, 1);
assert!(topic_partition.size_bytes > 0);
assert!(topic_partition.size > 0);
assert_eq!(topic_partition.current_offset, (MESSAGES_COUNT - 1) as u64);
assert_eq!(topic_partition.messages_count, MESSAGES_COUNT as u64);

Expand Down
2 changes: 1 addition & 1 deletion sdk/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "iggy"
version = "0.4.1"
version = "0.4.2"
description = "Iggy is the persistent message streaming platform written in Rust, supporting QUIC, TCP and HTTP transport protocols, capable of processing millions of messages per second."
edition = "2021"
license = "MIT"
Expand Down
6 changes: 3 additions & 3 deletions sdk/src/binary/mapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ pub fn map_stream(payload: Bytes) -> Result<StreamDetails, IggyError> {
id: stream.id,
created_at: stream.created_at,
topics_count: stream.topics_count,
size_bytes: stream.size_bytes,
size: stream.size,
messages_count: stream.messages_count,
name: stream.name,
topics,
Expand All @@ -346,7 +346,7 @@ fn map_to_stream(payload: Bytes, position: usize) -> Result<(Stream, usize), Igg
id,
created_at,
name,
size_bytes,
size: size_bytes,
messages_count,
topics_count,
},
Expand Down Expand Up @@ -454,7 +454,7 @@ fn map_to_partition(payload: Bytes, position: usize) -> Result<(Partition, usize
created_at,
segments_count,
current_offset,
size_bytes,
size: size_bytes,
messages_count,
},
read_bytes,
Expand Down
5 changes: 1 addition & 4 deletions sdk/src/cli/streams/get_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,7 @@ impl CliCommand for GetStreamCmd {
table.add_row(vec!["Stream ID", format!("{}", stream.id).as_str()]);
table.add_row(vec!["Created", format!("{}", stream.created_at).as_str()]);
table.add_row(vec!["Stream name", stream.name.as_str()]);
table.add_row(vec![
"Stream size",
format!("{}", stream.size_bytes).as_str(),
]);
table.add_row(vec!["Stream size", format!("{}", stream.size).as_str()]);
table.add_row(vec![
"Stream message count",
format!("{}", stream.messages_count).as_str(),
Expand Down
4 changes: 2 additions & 2 deletions sdk/src/cli/streams/get_streams.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ impl CliCommand for GetStreamsCmd {
format!("{}", stream.id),
format!("{}", stream.created_at),
stream.name.clone(),
format!("{}", stream.size_bytes),
format!("{}", stream.size),
format!("{}", stream.messages_count),
format!("{}", stream.topics_count),
]);
Expand All @@ -83,7 +83,7 @@ impl CliCommand for GetStreamsCmd {
stream.id,
stream.created_at,
stream.name,
stream.size_bytes,
stream.size,
stream.messages_count,
stream.topics_count
);
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/models/partition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub struct Partition {
/// The current offset of the partition.
pub current_offset: u64,
/// The size of the partition in bytes.
pub size_bytes: IggyByteSize,
pub size: IggyByteSize,
/// The number of messages in the partition.
pub messages_count: u64,
}
4 changes: 2 additions & 2 deletions sdk/src/models/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub struct Stream {
/// The unique name of the stream.
pub name: String,
/// The total size of the stream in bytes.
pub size_bytes: IggyByteSize,
pub size: IggyByteSize,
/// The total number of messages in the stream.
pub messages_count: u64,
/// The total number of topics in the stream.
Expand All @@ -44,7 +44,7 @@ pub struct StreamDetails {
/// The unique name of the stream.
pub name: String,
/// The total size of the stream in bytes.
pub size_bytes: IggyByteSize,
pub size: IggyByteSize,
/// The total number of messages in the stream.
pub messages_count: u64,
/// The total number of topics in the stream.
Expand Down
2 changes: 1 addition & 1 deletion server/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "server"
version = "0.2.22"
version = "0.2.23"
edition = "2021"
build = "src/build.rs"

Expand Down
6 changes: 3 additions & 3 deletions server/src/http/mapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub async fn map_stream(stream: &Stream) -> StreamDetails {
created_at: stream.created_at,
name: stream.name.clone(),
topics_count: topics.len() as u32,
size_bytes: stream.get_size(),
size: stream.get_size(),
messages_count: stream.get_messages_count(),
topics,
};
Expand All @@ -38,7 +38,7 @@ pub async fn map_streams(streams: &[&Stream]) -> Vec<iggy::models::stream::Strea
id: stream.stream_id,
created_at: stream.created_at,
name: stream.name.clone(),
size_bytes: stream.get_size(),
size: stream.get_size(),
topics_count: stream.get_topics().len() as u32,
messages_count: stream.get_messages_count(),
};
Expand Down Expand Up @@ -93,7 +93,7 @@ pub async fn map_topic(topic: &Topic) -> TopicDetails {
created_at: partition.created_at,
segments_count: partition.get_segments().len() as u32,
current_offset: partition.current_offset,
size_bytes: partition.get_size_bytes().into(),
size: partition.get_size_bytes().into(),
messages_count: partition.get_messages_count(),
});
}
Expand Down

0 comments on commit 53bda3a

Please sign in to comment.