-
Notifications
You must be signed in to change notification settings - Fork 507
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add consumer storage to spu (#3915)
* feat: add consumer storage to spu * rename consumer to consumer offset * fix review comments * fix review comments * removed ttl from consumer offset requests * removed ttl from consumer offsets * fix after rebase from master
- Loading branch information
Showing
27 changed files
with
1,451 additions
and
28 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
use fluvio_protocol::api::Request; | ||
use fluvio_protocol::record::{Offset, ReplicaKey}; | ||
use fluvio_protocol::{Encoder, Decoder}; | ||
use fluvio_types::PartitionId; | ||
|
||
use crate::COMMON_VERSION; | ||
use crate::errors::ErrorCode; | ||
use super::SpuServerApiKey; | ||
|
||
#[derive(Decoder, Encoder, Default, Debug)] | ||
pub struct UpdateConsumerOffsetRequest { | ||
pub offset: Offset, | ||
pub session_id: u32, | ||
} | ||
|
||
impl Request for UpdateConsumerOffsetRequest { | ||
const API_KEY: u16 = SpuServerApiKey::UpdateConsumerOffset as u16; | ||
const DEFAULT_API_VERSION: i16 = COMMON_VERSION; | ||
type Response = UpdateConsumerOffsetResponse; | ||
} | ||
|
||
impl UpdateConsumerOffsetRequest { | ||
pub fn new(offset: Offset, session_id: u32) -> Self { | ||
Self { offset, session_id } | ||
} | ||
} | ||
|
||
#[derive(Encoder, Decoder, Default, Debug)] | ||
pub struct UpdateConsumerOffsetResponse { | ||
pub offset: Offset, | ||
pub error_code: ErrorCode, | ||
} | ||
|
||
#[derive(Decoder, Encoder, Default, Debug)] | ||
pub struct DeleteConsumerOffsetRequest { | ||
pub replica_id: ReplicaKey, | ||
pub consumer_id: String, | ||
} | ||
|
||
impl DeleteConsumerOffsetRequest { | ||
pub fn new( | ||
topic: impl Into<String>, | ||
partition: PartitionId, | ||
consumer_id: impl Into<String>, | ||
) -> Self { | ||
let replica_id = ReplicaKey::new(topic, partition); | ||
Self { | ||
replica_id, | ||
consumer_id: consumer_id.into(), | ||
} | ||
} | ||
} | ||
|
||
impl Request for DeleteConsumerOffsetRequest { | ||
const API_KEY: u16 = SpuServerApiKey::DeleteConsumerOffset as u16; | ||
const DEFAULT_API_VERSION: i16 = COMMON_VERSION; | ||
type Response = DeleteConsumerOffsetResponse; | ||
} | ||
|
||
#[derive(Encoder, Decoder, Default, Debug)] | ||
pub struct DeleteConsumerOffsetResponse { | ||
pub error_code: ErrorCode, | ||
} | ||
|
||
#[derive(Decoder, Encoder, Default, Debug)] | ||
pub struct FetchConsumerOffsetsRequest; | ||
|
||
impl Request for FetchConsumerOffsetsRequest { | ||
const API_KEY: u16 = SpuServerApiKey::FetchConsumerOffsets as u16; | ||
const DEFAULT_API_VERSION: i16 = COMMON_VERSION; | ||
type Response = FetchConsumerOffsetsResponse; | ||
} | ||
|
||
#[derive(Encoder, Decoder, Default, Debug)] | ||
pub struct FetchConsumerOffsetsResponse { | ||
pub error_code: ErrorCode, | ||
pub consumers: Vec<ConsumerOffset>, | ||
} | ||
|
||
#[derive(Encoder, Decoder, Default, Debug)] | ||
pub struct ConsumerOffset { | ||
pub id: String, | ||
pub offset: Offset, | ||
pub modified_time: u64, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.