This is an automated email from the ASF dual-hosted git repository.
gkoszyk pushed a commit to branch io_uring_tpc
in repository https://gitbox.apache.org/repos/asf/iggy.git
The following commit(s) were added to refs/heads/io_uring_tpc by this push:
new 5e9f109c feat(io_uring): remove duplicated code and add annotations
for backlog tasks (#2195)
5e9f109c is described below
commit 5e9f109c9aa60d9d0ab88d61b40cdf9bebfe8730
Author: Grzegorz Koszyk <[email protected]>
AuthorDate: Tue Sep 23 18:51:45 2025 +0200
feat(io_uring): remove duplicated code and add annotations for backlog
tasks (#2195)
---
core/server/src/main.rs | 26 +-------------------------
core/server/src/shard/mod.rs | 2 +-
core/server/src/slab/traits_ext.rs | 10 ++++++++--
3 files changed, 10 insertions(+), 28 deletions(-)
diff --git a/core/server/src/main.rs b/core/server/src/main.rs
index ab098418..05e4ecc8 100644
--- a/core/server/src/main.rs
+++ b/core/server/src/main.rs
@@ -154,31 +154,6 @@ async fn main() -> Result<(), ServerError> {
}
}
- if args.with_default_root_credentials {
- let username_set = std::env::var("IGGY_ROOT_USERNAME").is_ok();
- let password_set = std::env::var("IGGY_ROOT_PASSWORD").is_ok();
-
- if !username_set || !password_set {
- if !username_set {
- unsafe {
- std::env::set_var("IGGY_ROOT_USERNAME", "iggy");
- }
- }
- if !password_set {
- unsafe {
- std::env::set_var("IGGY_ROOT_PASSWORD", "iggy");
- }
- }
- info!(
- "Using default root credentials (username: iggy, password:
iggy) - FOR DEVELOPMENT ONLY!"
- );
- } else {
- warn!(
- "--with-default-root-credentials flag is ignored because root
credentials are already set via environment variables"
- );
- }
- }
-
// FOURTH DISCRETE LOADING STEP.
MemoryPool::init_pool(config.system.clone());
@@ -321,6 +296,7 @@ async fn main() -> Result<(), ServerError> {
encryptor.clone(),
));
+ // TODO: Explore decoupling the `Log` from `Partition` entity.
// Ergh... I knew this will backfire to include `Log` as part of the
`Partition` entity,
// We have to initialize with a default log for every partition, once
we `Clone` the Streams / Topics / Partitions,
// because `Clone` impl for `Partition` does not clone the actual log,
just creates an empty one.
diff --git a/core/server/src/shard/mod.rs b/core/server/src/shard/mod.rs
index 84b038ca..4771d238 100644
--- a/core/server/src/shard/mod.rs
+++ b/core/server/src/shard/mod.rs
@@ -471,7 +471,7 @@ impl IggyShard {
PollingKind::Offset => {
let offset = value;
// We have to remember to keep the invariant from the
if that is on line 496.
- // Alternatively a better design would be to get rid
of that if and move the validations here.
+ // Alternatively a better design would be to move the
validations here, while keeping the validations in the original place.
let batches = self
.streams2
.get_messages_by_offset(
diff --git a/core/server/src/slab/traits_ext.rs
b/core/server/src/slab/traits_ext.rs
index 6e5f0dc7..0db207cf 100644
--- a/core/server/src/slab/traits_ext.rs
+++ b/core/server/src/slab/traits_ext.rs
@@ -64,6 +64,7 @@ pub trait ComponentsByIdMapping<T>: private::Sealed {
type RefMut<'a>;
}
+// TODO: This should be a proc macro.
macro_rules! impl_components_mapping_for_slab {
($T:ident) => {
impl<$T> private::Sealed for ($T,) {}
@@ -157,7 +158,7 @@ type MappingByIdMut<'a, E, T> =
pub type Components<T> = <T as IntoComponents>::Components;
pub type ComponentsById<'a, T> = <T as IntoComponentsById>::Output;
-// TODO: Not all hope is lost, don't get discouraged by the comment from above
+// TODO:
// I've figured there is actually and ergonomic improvement that can be made
here.
// Observe that the chain of constraints put on the `EntityRef` type is
actually wrong.
// We constraint the `EntityRef` to be IntoComponents + IntoComponentsById,
@@ -167,8 +168,13 @@ pub type ComponentsById<'a, T> = <T as
IntoComponentsById>::Output;
// in the `stream.rs` `topic.rs` `partitions.rs` files, we need to implement
the `IntoComponentsById` trait for the output type of `IntoComponents`
implementation, for `EntityRef`.
// to make our life easier, we can create a type alias for those tuples and
maybe even create a macro, to not repeat the type 3 times per entity
(TupleEntityType, TupleEntityTypeRef, TupleEntityTypeRefByid).
-// TODO: Since those traits at impl site all they do is call `f(self.into())`
+// TODO: Since those traits at impl site, all they do is call `f(self.into())`
// we can blanket implement those for all types that implement `From` trait.
+
+// Maybe lets not go this way with the tuple mapping madness, it already is
pretty difficult to distinguish between all of the different components,
+// and everytime we add a new component to an entity, we need to update the
tuple type everywhere.
+// Better idea would be to use the `EntityRef` type directly inside of the
`with_components_by_id` closure
+// -- f(components.into_components_by_id(id)) ->
components.into_components_by_id(id) would return `EntityRef`, rather than the
tuple.
pub trait EntityComponentSystem<T>
where
<Self::Entity as IntoComponents>::Components: ComponentsMapping<T> +
ComponentsByIdMapping<T>,