@@ -32,8 +32,8 @@ pub struct DropQueueRequest {
3232pub struct IngestRequest {
3333 #[ prost( message, repeated, tag = "1" ) ]
3434 pub doc_batches : :: prost:: alloc:: vec:: Vec < DocBatch > ,
35- #[ prost( uint32 , tag = "2" ) ]
36- pub commit : u32 ,
35+ #[ prost( enumeration = "CommitType" , tag = "2" ) ]
36+ pub commit : i32 ,
3737}
3838#[ derive( serde:: Serialize , serde:: Deserialize , utoipa:: ToSchema ) ]
3939#[ allow( clippy:: derive_partial_eq_without_eq) ]
@@ -74,19 +74,19 @@ pub struct DocBatch {
7474 #[ prost( uint32, repeated, tag = "3" ) ]
7575 pub doc_lengths : :: prost:: alloc:: vec:: Vec < u32 > ,
7676}
77- /// / Suggest to truncate the queue.
78- /// /
79- /// / This function allows the queue to remove all records up to and
80- /// / including `up_to_offset_included`.
81- /// /
82- /// / The role of this truncation is to release memory and disk space.
83- /// /
84- /// / There are no guarantees that the record will effectively be removed.
85- /// / Nothing might happen, or the truncation might be partial.
86- /// /
87- /// / In other words, truncating from a position, and fetching records starting
88- /// / earlier than this position can yield undefined result:
89- /// / the truncated records may or may not be returned.
77+ /// Suggest to truncate the queue.
78+ ///
79+ /// This function allows the queue to remove all records up to and
80+ /// including `up_to_offset_included`.
81+ ///
82+ /// The role of this truncation is to release memory and disk space.
83+ ///
84+ /// There are no guarantees that the record will effectively be removed.
85+ /// Nothing might happen, or the truncation might be partial.
86+ ///
87+ /// In other words, truncating from a position, and fetching records starting
88+ /// earlier than this position can yield undefined result:
89+ /// the truncated records may or may not be returned.
9090#[ derive( serde:: Serialize , serde:: Deserialize , utoipa:: ToSchema ) ]
9191#[ allow( clippy:: derive_partial_eq_without_eq) ]
9292#[ derive( Clone , PartialEq , :: prost:: Message ) ]
@@ -114,6 +114,42 @@ pub struct ListQueuesResponse {
114114 #[ prost( string, repeated, tag = "1" ) ]
115115 pub queues : :: prost:: alloc:: vec:: Vec < :: prost:: alloc:: string:: String > ,
116116}
117+ /// Specifies if the ingest request should block waiting for the records to be committed.
118+ #[ derive( serde:: Serialize , serde:: Deserialize , utoipa:: ToSchema ) ]
119+ #[ serde( rename_all = "snake_case" ) ]
120+ #[ derive( Clone , Copy , Debug , PartialEq , Eq , Hash , PartialOrd , Ord , :: prost:: Enumeration ) ]
121+ #[ repr( i32 ) ]
122+ pub enum CommitType {
123+ /// The request doesn't wait for commit
124+ Auto = 0 ,
125+ /// The request waits for the next scheduled commit to finish.
126+ WaitFor = 1 ,
127+ /// The request forces an immediate commit after the last document in the batch and waits for
128+ /// it to finish.
129+ Force = 2 ,
130+ }
131+ impl CommitType {
132+ /// String value of the enum field names used in the ProtoBuf definition.
133+ ///
134+ /// The values are not transformed in any way and thus are considered stable
135+ /// (if the ProtoBuf definition does not change) and safe for programmatic use.
136+ pub fn as_str_name ( & self ) -> & ' static str {
137+ match self {
138+ CommitType :: Auto => "Auto" ,
139+ CommitType :: WaitFor => "WaitFor" ,
140+ CommitType :: Force => "Force" ,
141+ }
142+ }
143+ /// Creates an enum from field names used in the ProtoBuf definition.
144+ pub fn from_str_name ( value : & str ) -> :: core:: option:: Option < Self > {
145+ match value {
146+ "Auto" => Some ( Self :: Auto ) ,
147+ "WaitFor" => Some ( Self :: WaitFor ) ,
148+ "Force" => Some ( Self :: Force ) ,
149+ _ => None ,
150+ }
151+ }
152+ }
117153/// BEGIN quickwit-codegen
118154use tower:: { Layer , Service , ServiceExt } ;
119155#[ cfg_attr( any( test, feature = "testsuite" ) , mockall:: automock) ]
@@ -751,13 +787,13 @@ pub mod ingest_service_grpc_client {
751787 self . inner = self . inner . max_encoding_message_size ( limit) ;
752788 self
753789 }
754- /// / Ingests document in a given queue.
755- /// /
756- /// / Upon any kind of error, the client should
757- /// / - retry to get at least once delivery.
758- /// / - not retry to get at most once delivery.
759- /// /
760- /// / Exactly once delivery is not supported yet.
790+ /// Ingests document in a given queue.
791+ ///
792+ /// Upon any kind of error, the client should
793+ /// - retry to get at least once delivery.
794+ /// - not retry to get at most once delivery.
795+ ///
796+ /// Exactly once delivery is not supported yet.
761797 pub async fn ingest (
762798 & mut self ,
763799 request : impl tonic:: IntoRequest < super :: IngestRequest > ,
@@ -780,16 +816,16 @@ pub mod ingest_service_grpc_client {
780816 . insert ( GrpcMethod :: new ( "ingest_service.IngestService" , "Ingest" ) ) ;
781817 self . inner . unary ( req, path, codec) . await
782818 }
783- /// / Fetches record from a given queue.
784- /// /
785- /// / Records are returned in order.
786- /// /
787- /// / The returned `FetchResponse` object is meant to be read with the
788- /// / `crate::iter_records` function.
789- /// /
790- /// / Fetching does not necessarily return all of the available records.
791- /// / If returning all records would exceed `FETCH_PAYLOAD_LIMIT` (2MB),
792- /// / the response will be partial.
819+ /// Fetches record from a given queue.
820+ ///
821+ /// Records are returned in order.
822+ ///
823+ /// The returned `FetchResponse` object is meant to be read with the
824+ /// `crate::iter_records` function.
825+ ///
826+ /// Fetching does not necessarily return all of the available records.
827+ /// If returning all records would exceed `FETCH_PAYLOAD_LIMIT` (2MB),
828+ /// the response will be partial.
793829 pub async fn fetch (
794830 & mut self ,
795831 request : impl tonic:: IntoRequest < super :: FetchRequest > ,
@@ -812,11 +848,11 @@ pub mod ingest_service_grpc_client {
812848 . insert ( GrpcMethod :: new ( "ingest_service.IngestService" , "Fetch" ) ) ;
813849 self . inner . unary ( req, path, codec) . await
814850 }
815- /// / Returns a batch containing the last records.
816- /// /
817- /// / It returns the last documents, from the newest
818- /// / to the oldest, and stops as soon as `FETCH_PAYLOAD_LIMIT` (2MB)
819- /// / is exceeded.
851+ /// Returns a batch containing the last records.
852+ ///
853+ /// It returns the last documents, from the newest
854+ /// to the oldest, and stops as soon as `FETCH_PAYLOAD_LIMIT` (2MB)
855+ /// is exceeded.
820856 pub async fn tail (
821857 & mut self ,
822858 request : impl tonic:: IntoRequest < super :: TailRequest > ,
@@ -848,36 +884,36 @@ pub mod ingest_service_grpc_server {
848884 /// Generated trait containing gRPC methods that should be implemented for use with IngestServiceGrpcServer.
849885 #[ async_trait]
850886 pub trait IngestServiceGrpc : Send + Sync + ' static {
851- /// / Ingests document in a given queue.
852- /// /
853- /// / Upon any kind of error, the client should
854- /// / - retry to get at least once delivery.
855- /// / - not retry to get at most once delivery.
856- /// /
857- /// / Exactly once delivery is not supported yet.
887+ /// Ingests document in a given queue.
888+ ///
889+ /// Upon any kind of error, the client should
890+ /// - retry to get at least once delivery.
891+ /// - not retry to get at most once delivery.
892+ ///
893+ /// Exactly once delivery is not supported yet.
858894 async fn ingest (
859895 & self ,
860896 request : tonic:: Request < super :: IngestRequest > ,
861897 ) -> std:: result:: Result < tonic:: Response < super :: IngestResponse > , tonic:: Status > ;
862- /// / Fetches record from a given queue.
863- /// /
864- /// / Records are returned in order.
865- /// /
866- /// / The returned `FetchResponse` object is meant to be read with the
867- /// / `crate::iter_records` function.
868- /// /
869- /// / Fetching does not necessarily return all of the available records.
870- /// / If returning all records would exceed `FETCH_PAYLOAD_LIMIT` (2MB),
871- /// / the response will be partial.
898+ /// Fetches record from a given queue.
899+ ///
900+ /// Records are returned in order.
901+ ///
902+ /// The returned `FetchResponse` object is meant to be read with the
903+ /// `crate::iter_records` function.
904+ ///
905+ /// Fetching does not necessarily return all of the available records.
906+ /// If returning all records would exceed `FETCH_PAYLOAD_LIMIT` (2MB),
907+ /// the response will be partial.
872908 async fn fetch (
873909 & self ,
874910 request : tonic:: Request < super :: FetchRequest > ,
875911 ) -> std:: result:: Result < tonic:: Response < super :: FetchResponse > , tonic:: Status > ;
876- /// / Returns a batch containing the last records.
877- /// /
878- /// / It returns the last documents, from the newest
879- /// / to the oldest, and stops as soon as `FETCH_PAYLOAD_LIMIT` (2MB)
880- /// / is exceeded.
912+ /// Returns a batch containing the last records.
913+ ///
914+ /// It returns the last documents, from the newest
915+ /// to the oldest, and stops as soon as `FETCH_PAYLOAD_LIMIT` (2MB)
916+ /// is exceeded.
881917 async fn tail (
882918 & self ,
883919 request : tonic:: Request < super :: TailRequest > ,
0 commit comments