eclipse-iceoryx / iceoryx2

Eclipse iceoryx2™ - true zero-copy inter-process-communication in pure Rust
https://iceoryx.io
Apache License 2.0
1.03k stars 40 forks source link

[#98] add `iox2 nodes` cli #380

Closed orecham closed 2 months ago

orecham commented 2 months ago

Notes for Reviewer

  1. enables commands iox2 nodes list and iox2 nodes details
    1. node ids are represented as hex rather than separate elements (pid, timestamps, counter)
    2. to retrieve node details, node id (as hex), node name, or pid can be provided
      1. if there are multiple nodes matching, all nodes should be provided
    3. output can be filtered by node state (Alive, Dead, etc.)
    4. functionality for outputting in multiple formats has been inherited (RON, JSON, YAML)
  2. cleanliness tweaks across all cli
    1. made implementations consistent
    2. reused output structs across clis

Usage:

iox2-nodes ```bash $ iox2-nodes --help Query information about iceoryx2 nodes Usage: iox2-nodes [OPTIONS] [COMMAND] Options: -f, --format [default: RON] [possible values: RON, JSON, YAML] -h, --help Print help -V, --version Print version Commands: list List all existing nodes details Show details of an existing node ```
iox2-nodes list ```bash $ iox2-nodes list --help List all existing nodes Usage: iox2-nodes list [OPTIONS] Options: -s, --state [default: All] [possible values: Alive, Dead, Inaccessible, Undefined, All] -f, --format [default: RON] [possible values: RON, JSON, YAML] -h, --help Print help ``` ```bash $ iox2-nodes list ( num: 1, details: [ ( state: Alive, id: ("00000000059fd39166e761ac0003d3e7"), pid: 250855, executable: Some("publish_subscribe_subscriber"), name: Some(""), ), ], ) ```
iox2-nodes details ```bash $ iox2-nodes details --help Show details of an existing node Usage: iox2-nodes details [OPTIONS] Arguments: Name, ID or PID Options: -s, --state [default: All] [possible values: Alive, Dead, Inaccessible, Undefined, All] -f, --format [default: RON] [possible values: RON, JSON, YAML] -h, --help Print help ``` ```bash $ iox2-nodes details 250855 { "state": Alive, "id": ("00000000059fd39166e761ac0003d3e7"), "pid": 250855, "executable": "publish_subscribe_subscriber", "name": "", "config": ( global: ( r#root-path-unix: "/tmp/iceoryx2/", r#root-path-windows: "c:\\Temp\\iceoryx2\\", prefix: "iox2_", service: ( directory: "services", r#publisher-data-segment-suffix: ".publisher_data", r#static-config-storage-suffix: ".service", r#dynamic-config-storage-suffix: ".dynamic", r#creation-timeout: ( secs: 0, nanos: 500000000, ), r#connection-suffix: ".connection", r#event-connection-suffix: ".event", ), node: ( directory: "nodes", r#monitor-suffix: ".node_monitor", r#static-config-suffix: ".details", r#service-tag-suffix: ".service_tag", r#cleanup-dead-nodes-on-creation: true, r#cleanup-dead-nodes-on-destruction: true, ), ), defaults: ( r#publish-subscribe: ( r#max-subscribers: 8, r#max-publishers: 2, r#max-nodes: 20, r#subscriber-max-buffer-size: 2, r#subscriber-max-borrowed-samples: 2, r#publisher-max-loaned-samples: 2, r#publisher-history-size: 1, r#enable-safe-overflow: true, r#unable-to-deliver-strategy: "Block", r#subscriber-expired-connection-buffer: 128, ), event: ( r#max-listeners: 2, r#max-notifiers: 16, r#max-nodes: 36, r#event-id-max-value: 32, ), ), ), } ```

Pre-Review Checklist for the PR Author

  1. [x] Add sensible notes for the reviewer
  2. [x] PR title is short, expressive and meaningful
  3. [x] Relevant issues are linked in the References section
  4. [x] Every source code file has a copyright header with SPDX-License-Identifier: Apache-2.0 OR MIT
  5. [x] Branch follows the naming format (iox2-123-introduce-posix-ipc-example)
  6. [x] Commits messages are according to this guideline
    • [x] Commit messages have the issue ID ([#123] Add posix ipc example)
    • [x] Commit author matches Eclipse Contributor Agreement (and ECA is signed)
  7. [ ] Tests follow the best practice for testing
  8. [x] Changelog updated in the unreleased section including API breaking changes
  9. [x] Assign PR to reviewer
  10. [x] All checks have passed (except task-list-completed)

Checklist for the PR Reviewer

Post-review Checklist for the PR Author

  1. [x] All open points are addressed and tracked via issues

References

Relates #98

codecov[bot] commented 2 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 79.45%. Comparing base (a9df608) to head (37ee56c). Report is 18 commits behind head on main.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/eclipse-iceoryx/iceoryx2/pull/380/graphs/tree.svg?width=650&height=150&src=pr&token=FN3YFXTJCI&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=eclipse-iceoryx)](https://app.codecov.io/gh/eclipse-iceoryx/iceoryx2/pull/380?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=eclipse-iceoryx) ```diff @@ Coverage Diff @@ ## main #380 +/- ## ========================================== - Coverage 79.49% 79.45% -0.04% ========================================== Files 193 193 Lines 22716 22716 ========================================== - Hits 18058 18050 -8 - Misses 4658 4666 +8 ``` [see 4 files with indirect coverage changes](https://app.codecov.io/gh/eclipse-iceoryx/iceoryx2/pull/380/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=eclipse-iceoryx)
orecham commented 2 months ago

Release notes added here: https://github.com/eclipse-iceoryx/iceoryx2/pull/379/commits/1512f6f833423b6f5380ae0fd445420b89c97726