refactor(dds): Rcl.Context / Rcl.Node 分離 (DomainParticipant を [Obsolete] 委譲ラッパに)#105
Merged
Conversation
…[Obsolete] 付与) DomainParticipant は 518 行の monolithic な実装から約 90 行の thin wrapper に置き換え。 すべての実装は Rcl.Context + Rcl.Node に委譲し、DomainParticipant には [Obsolete] 属性を付与。 後方互換性のために公開 API (CreatePublisher/CreateSubscription/CreateServiceClient 等) は維持。 テスト側の GetSedpPublicationsWriter も DomainParticipant._context.Context._sedpPublicationsWriter への二段階リフレクションに更新。
- UserEntityIdAllocator を Context に移動 (複数 Node での GUID 衝突防止) - Node.Dispose() で DiscoveryDb イベント購読を解除 - NodeOptions.Logger を実際に wiring (fallback: Context.Logger) - Context.BuildParticipantData() を internal に変更 - Context の未使用 _sedpAdvertiser を削除 - XML doc typo 修正 (生らす → 生やす) - テスト追加: 同一 Context 上の 2 Node で EntityId 重複なし
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
ROSettaDDS.Dds.DomainParticipantを rcl 風の 2 層 API に分離し、ROS 2 のrcl_context_t/rcl_node_tに対応する公開 API を提供。ROSettaDDS.Rcl.Context(新規): ドメイン共通 DDS 資源 (transport 4 種 / DiscoveryDb / SPDP / SEDP / LeaseExpiryMonitor / ParticipantRtpsReceiver) を所有ROSettaDDS.Rcl.Node(新規): Context を参照し、Publisher / Subscription / ServiceClient のみを生やすROSettaDDS.Dds.DomainParticipant(既存):[Obsolete]化 +Rcl.Context+Rcl.Nodeへの薄い委譲ラッパにROSettaDDS.Rcl.ContextOptions(新規):DomainParticipantOptionsからinternal FromLegacyで変換可能な canonical optionsROSettaDDS.Rcl.NodeOptions(新規): Node 用 (Logger override のみ、初回リリース)動機
DomainParticipantは ROS 2 でいうrcl_node_t(= ユーザー操作対象) とrcl_context_t(= ドメイン共通 DDS 資源) を 1 クラスに押し込めていた。DomainParticipant/DomainParticipantOptions)GuidPrefix/DiscoveryDb/UserMulticastTransportなどの DDS 詳細がpublicで露出変更内容
新規ファイル
src/rosettadds/Rcl/Context.cs(Context 本体)src/rosettadds/Rcl/ContextOptions.cs(canonical options)src/rosettadds/Rcl/Node.cs(ユーザー操作対象)src/rosettadds/Rcl/NodeOptions.cs(Node 用 options).meta(Unity)tests/rosettadds.Tests/Rcl/ContextTests.cs(9 tests)tests/rosettadds.Tests/Rcl/ContextOptionsTests.cs(2 tests)tests/rosettadds.Tests/Rcl/NodeTests.cs(6 tests)tests/rosettadds.Tests/Rcl/NodeOptionsTests.cs(3 tests)tests/rosettadds.Tests/Rcl/DomainParticipantObsoleteTests.cs(4 tests)変更ファイル
src/rosettadds/Dds/DomainParticipant.cs: 518 行 → 86 行 ([Obsolete]委譲ラッパ)src/rosettadds/Dds/ParticipantTransportSet.cs/ParticipantEndpointFactory.cs/LeaseExpiryMonitor.cs: 内部シグネチャをContextOptions起点にtests/rosettadds.Tests/Dds/ParticipantTransportSetTests.cs/ParticipantEndpointFactoryTests.cs/LeaseExpiryMonitorTests.cs: 機械的書き換えtests/rosettadds.Tests/Integration/SedpReliableLoopbackTests.cs: リフレクション経由のアクセスを新構造に追従tests/rosettadds.Tests/rosettadds.Tests.csproj:<NoWarn>CS0618</NoWarn>(既存テスト 60+ ファイルからの[Obsolete]警告抑止)仕様書 / プラン
docs/superpowers/specs/2026-07-02-rcl-context-node-design.mddocs/superpowers/plans/2026-07-02-rcl-context-node.mdユーザー API (After)
互換性
DomainParticipant利用コードは[Obsolete]警告のみで動作継続。破壊的変更なし。tests/rosettadds.Tests/Integration/*) はすべて緑のまま。テスト
UdpTransportTests/PublisherBatchTests/SedpLoopback系。分離実行では全 PASS。本変更と無関係)Reviewer Feedback (final review 反映済み)
UserEntityIdAllocatorを Context に移動 (複数 Node での endpoint GUID 衝突防止)Node.Dispose()で DiscoveryDb イベント購読を解除 (メモリリーク対策)NodeOptions.Loggerを UserEndpointManager / SedpEndpointAdvertiser / Subscription / ServiceClient に wiringContext.BuildParticipantData()をinternal化Context._sedpAdvertiser削除 (未使用)生らす→生やす) 修正Follow-up (別 PR 予定)
DomainParticipant参照を Rcl に移行DomainParticipantの public DDS 詳細プロパティを段階的に[Obsolete]化DomainParticipant自体を削除