You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iggy.apache.org by "krishvishal (via GitHub)" <gi...@apache.org> on 2026/02/24 12:37:21 UTC
[PR] feat(shard): create `shard` crate and generic `IggyShard` [iggy]
krishvishal opened a new pull request, #2811:
URL: https://github.com/apache/iggy/pull/2811
- Created `shard` crate and generic `IggyShard`
- `IggyShard::dispatch()` routes incoming network messages to the correct consensus plane via `PlaneIdentity`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(shard): create `shard` crate and generic `IggyShard` [iggy]
Posted by "krishvishal (via GitHub)" <gi...@apache.org>.
krishvishal commented on code in PR #2811:
URL: https://github.com/apache/iggy/pull/2811#discussion_r2852140349
##########
core/shard/src/lib.rs:
##########
@@ -0,0 +1,159 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use consensus::{LocalPipeline, MuxPlane, NamespacedPipeline, Plane, PlaneIdentity, VsrConsensus};
+use iggy_common::header::{GenericHeader, PrepareHeader};
+use iggy_common::message::{Message, MessageBag};
+use iggy_common::sharding::{IggyNamespace, ShardId};
+use iggy_common::variadic;
+use journal::{Journal, JournalHandle};
+use message_bus::MessageBus;
+use metadata::IggyMetadata;
+use metadata::stm::StateMachine;
+use partitions::{IggyPartitions, PartitionsConfig};
+
+// variadic!(Metadata, Partitions) = (Metadata, (Partitions, ()))
+type PlaneInner<B, J, S, M> = (
+ IggyMetadata<VsrConsensus<B>, J, S, M>,
+ (IggyPartitions<VsrConsensus<B, NamespacedPipeline>>, ()),
+);
+
+pub type ShardPlane<B, J, S, M> = MuxPlane<PlaneInner<B, J, S, M>>;
+
+pub struct IggyShard<B, J, S, M>
+where
+ B: MessageBus,
+{
+ pub id: u8,
+ pub name: String,
+ pub replica_count: u8,
+ pub plane: ShardPlane<B, J, S, M>,
+}
+
+impl<B, J, S, M> IggyShard<B, J, S, M>
+where
+ B: MessageBus + Clone,
+{
+ #[allow(clippy::too_many_arguments)]
+ pub fn new(
Review Comment:
Yes, I've realized my mistake and refactored the code. I've pushed the refactor, please take a look now.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(shard): create `shard` crate and generic `IggyShard` [iggy]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #2811:
URL: https://github.com/apache/iggy/pull/2811#issuecomment-3951506578
## [Codecov](https://app.codecov.io/gh/apache/iggy/pull/2811?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 64.19%. Comparing base ([`28e7c04`](https://app.codecov.io/gh/apache/iggy/commit/28e7c04c96dee9a8a3b7a3975797a9156b6a8ac5?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`d094b3f`](https://app.codecov.io/gh/apache/iggy/commit/d094b3f8d7e1f91a22028385995c28d9c26b93f0?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## master #2811 +/- ##
============================================
- Coverage 68.44% 64.19% -4.25%
Complexity 656 656
============================================
Files 852 851 -1
Lines 68196 68134 -62
Branches 59657 59605 -52
============================================
- Hits 46679 43741 -2938
- Misses 19187 22267 +3080
+ Partials 2330 2126 -204
```
| [Flag](https://app.codecov.io/gh/apache/iggy/pull/2811/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [csharp](https://app.codecov.io/gh/apache/iggy/pull/2811/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `12.62% <ø> (-54.65%)` | :arrow_down: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Files with missing lines](https://app.codecov.io/gh/apache/iggy/pull/2811?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [core/simulator/src/deps.rs](https://app.codecov.io/gh/apache/iggy/pull/2811?src=pr&el=tree&filepath=core%2Fsimulator%2Fsrc%2Fdeps.rs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Y29yZS9zaW11bGF0b3Ivc3JjL2RlcHMucnM=) | `0.00% <ø> (ø)` | |
| [core/simulator/src/lib.rs](https://app.codecov.io/gh/apache/iggy/pull/2811?src=pr&el=tree&filepath=core%2Fsimulator%2Fsrc%2Flib.rs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Y29yZS9zaW11bGF0b3Ivc3JjL2xpYi5ycw==) | `0.00% <ø> (ø)` | |
... and [82 files with indirect coverage changes](https://app.codecov.io/gh/apache/iggy/pull/2811/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
</details>
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(shard): create `shard` crate and generic `IggyShard` [iggy]
Posted by "numinnex (via GitHub)" <gi...@apache.org>.
numinnex commented on code in PR #2811:
URL: https://github.com/apache/iggy/pull/2811#discussion_r2852113514
##########
core/shard/src/lib.rs:
##########
@@ -0,0 +1,159 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use consensus::{LocalPipeline, MuxPlane, NamespacedPipeline, Plane, PlaneIdentity, VsrConsensus};
+use iggy_common::header::{GenericHeader, PrepareHeader};
+use iggy_common::message::{Message, MessageBag};
+use iggy_common::sharding::{IggyNamespace, ShardId};
+use iggy_common::variadic;
+use journal::{Journal, JournalHandle};
+use message_bus::MessageBus;
+use metadata::IggyMetadata;
+use metadata::stm::StateMachine;
+use partitions::{IggyPartitions, PartitionsConfig};
+
+// variadic!(Metadata, Partitions) = (Metadata, (Partitions, ()))
+type PlaneInner<B, J, S, M> = (
+ IggyMetadata<VsrConsensus<B>, J, S, M>,
+ (IggyPartitions<VsrConsensus<B, NamespacedPipeline>>, ()),
+);
+
+pub type ShardPlane<B, J, S, M> = MuxPlane<PlaneInner<B, J, S, M>>;
+
+pub struct IggyShard<B, J, S, M>
+where
+ B: MessageBus,
+{
+ pub id: u8,
+ pub name: String,
+ pub replica_count: u8,
+ pub plane: ShardPlane<B, J, S, M>,
+}
+
+impl<B, J, S, M> IggyShard<B, J, S, M>
+where
+ B: MessageBus + Clone,
+{
+ #[allow(clippy::too_many_arguments)]
+ pub fn new(
Review Comment:
Lets pass in already constructed consensus, metadata instances in the constructor
##########
core/shard/src/lib.rs:
##########
@@ -0,0 +1,159 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use consensus::{LocalPipeline, MuxPlane, NamespacedPipeline, Plane, PlaneIdentity, VsrConsensus};
+use iggy_common::header::{GenericHeader, PrepareHeader};
+use iggy_common::message::{Message, MessageBag};
+use iggy_common::sharding::{IggyNamespace, ShardId};
+use iggy_common::variadic;
+use journal::{Journal, JournalHandle};
+use message_bus::MessageBus;
+use metadata::IggyMetadata;
+use metadata::stm::StateMachine;
+use partitions::{IggyPartitions, PartitionsConfig};
+
+// variadic!(Metadata, Partitions) = (Metadata, (Partitions, ()))
+type PlaneInner<B, J, S, M> = (
Review Comment:
I think you could import the `variadic!` macro in there and use it ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org