From 5f774f6e35a7dc587017f833e0373a026efcce10 Mon Sep 17 00:00:00 2001 From: swarnabhasinha Date: Wed, 3 Dec 2025 13:34:02 +0530 Subject: [PATCH 1/3] docs: add docs for start and end index flags --- docs/guide.md | 80 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 78 insertions(+), 2 deletions(-) diff --git a/docs/guide.md b/docs/guide.md index c4dfe69..349a46b 100644 --- a/docs/guide.md +++ b/docs/guide.md @@ -1077,9 +1077,48 @@ Then publish to all nodes in the file: **Flags:** - `-topic`: Topic name to publish to (required) - `-ipfile`: File containing IP addresses, one per line (required) +- `-start-index`: Starting index in IP file for selecting a subset of IPs (default: 0) +- `-end-index`: Ending index in IP file (exclusive, default: 10000) - `-count`: Number of messages to publish per node (default: 1) - `-sleep`: Delay between messages (e.g., `500ms`, `1s`) +**Index Range Selection (`-start-index` and `-end-index`):** + +These flags allow you to select a specific range of IP addresses from your IP file, which is useful when: +- Testing with a subset of nodes from a large IP file +- Running parallel tests across different IP ranges + +**How it works:** +- Uses **zero-based indexing** (first IP is at index 0) +- `-end-index` is **exclusive** (like Python slicing: `ips[start:end]`) +- If your IP file has 10 IPs and you use `-start-index=0 -end-index=5`, it will use IPs at indices 0, 1, 2, 3, 4 (5 IPs total) +- If `-end-index` exceeds the number of IPs in the file, it automatically caps to the file length +- Both flags must be valid: `start-index >= 0`, `start-index < end-index`, and `start-index < total IPs` + +**Examples:** + +```sh +# Publish to first 5 IPs (indices 0-4) +./grpc_p2p_client/p2p-multi-publish \ + -topic=test-topic \ + -ipfile=ips.txt \ + -start-index=0 \ + -end-index=5 \ + -count=10 + +# Publish to IPs 10-19 (indices 10-19) +./grpc_p2p_client/p2p-multi-publish \ + -topic=test-topic \ + -ipfile=ips.txt \ + -start-index=10 \ + -end-index=20 \ + -count=10 + +# If not specified, defaults to start-index=0, end-index=10000 +# (or file length if less than 10000 IPs) +./grpc_p2p_client/p2p-multi-publish -topic=test-topic -ipfile=ips.txt +``` + **Example Output:** ``` Found 4 IPs: [localhost:33221 localhost:33222 localhost:33223 localhost:33224] @@ -1111,11 +1150,48 @@ Subscribe to multiple nodes and collect messages: **Flags:** - `-topic`: Topic name to subscribe to (required) - `-ipfile`: File containing IP addresses, one per line (required) -- `-start-index`: Starting index in IP file (default: 0) -- `-end-index`: Ending index in IP file (default: 10000) +- `-start-index`: Starting index in IP file for selecting a subset of IPs (default: 0) +- `-end-index`: Ending index in IP file (exclusive, default: 10000) - `-output-data`: Output file for message data (TSV format: receiver, sender, size, sha256) - `-output-trace`: Output file for trace events (TSV format: type, peerID, receivedFrom, messageID, topic, timestamp) +**Index Range Selection (`-start-index` and `-end-index`):** + +These flags allow you to select a specific range of IP addresses from your IP file, which is useful when: +- Monitoring a subset of nodes from a large IP file +- Running parallel subscription tests across different IP ranges + +**How it works:** +- Uses **zero-based indexing** (first IP is at index 0) +- `-end-index` is **exclusive** (like Python slicing: `ips[start:end]`) +- If your IP file has 10 IPs and you use `-start-index=0 -end-index=5`, it will subscribe to IPs at indices 0, 1, 2, 3, 4 (5 IPs total) +- If `-end-index` exceeds the number of IPs in the file, it automatically caps to the file length +- Both flags must be valid: `start-index >= 0`, `start-index < end-index`, and `start-index < total IPs` + +**Examples:** + +```sh +# Subscribe to first 5 IPs (indices 0-4) +./grpc_p2p_client/p2p-multi-subscribe \ + -topic=test-topic \ + -ipfile=ips.txt \ + -start-index=0 \ + -end-index=5 \ + -output-data=received_data.tsv + +# Subscribe to IPs 10-19 (indices 10-19) +./grpc_p2p_client/p2p-multi-subscribe \ + -topic=test-topic \ + -ipfile=ips.txt \ + -start-index=10 \ + -end-index=20 \ + -output-trace=trace_data.tsv + +# If not specified, defaults to start-index=0, end-index=10000 +# (or file length if less than 10000 IPs) +./grpc_p2p_client/p2p-multi-subscribe -topic=test-topic -ipfile=ips.txt +``` + **Example Output:** ``` numip 4 index 10000 From db6c0056e9a03793c388edf26d9ac19263131b4c Mon Sep 17 00:00:00 2001 From: swarnabhasinha Date: Wed, 3 Dec 2025 13:37:13 +0530 Subject: [PATCH 2/3] fix --- docs/guide.md | 37 +------------------------------------ 1 file changed, 1 insertion(+), 36 deletions(-) diff --git a/docs/guide.md b/docs/guide.md index 349a46b..d5d3113 100644 --- a/docs/guide.md +++ b/docs/guide.md @@ -1155,42 +1155,7 @@ Subscribe to multiple nodes and collect messages: - `-output-data`: Output file for message data (TSV format: receiver, sender, size, sha256) - `-output-trace`: Output file for trace events (TSV format: type, peerID, receivedFrom, messageID, topic, timestamp) -**Index Range Selection (`-start-index` and `-end-index`):** - -These flags allow you to select a specific range of IP addresses from your IP file, which is useful when: -- Monitoring a subset of nodes from a large IP file -- Running parallel subscription tests across different IP ranges - -**How it works:** -- Uses **zero-based indexing** (first IP is at index 0) -- `-end-index` is **exclusive** (like Python slicing: `ips[start:end]`) -- If your IP file has 10 IPs and you use `-start-index=0 -end-index=5`, it will subscribe to IPs at indices 0, 1, 2, 3, 4 (5 IPs total) -- If `-end-index` exceeds the number of IPs in the file, it automatically caps to the file length -- Both flags must be valid: `start-index >= 0`, `start-index < end-index`, and `start-index < total IPs` - -**Examples:** - -```sh -# Subscribe to first 5 IPs (indices 0-4) -./grpc_p2p_client/p2p-multi-subscribe \ - -topic=test-topic \ - -ipfile=ips.txt \ - -start-index=0 \ - -end-index=5 \ - -output-data=received_data.tsv - -# Subscribe to IPs 10-19 (indices 10-19) -./grpc_p2p_client/p2p-multi-subscribe \ - -topic=test-topic \ - -ipfile=ips.txt \ - -start-index=10 \ - -end-index=20 \ - -output-trace=trace_data.tsv - -# If not specified, defaults to start-index=0, end-index=10000 -# (or file length if less than 10000 IPs) -./grpc_p2p_client/p2p-multi-subscribe -topic=test-topic -ipfile=ips.txt -``` +**Note:** The `-start-index` and `-end-index` flags work the same way as described in the Multi-Node Publisher Usage section above. **Example Output:** ``` From c99c5f69dc78c8d39b145d2afb49e28b4e9e361d Mon Sep 17 00:00:00 2001 From: swarnabhasinha Date: Wed, 3 Dec 2025 16:49:52 +0530 Subject: [PATCH 3/3] fix --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index affe363..2228954 100644 --- a/.gitignore +++ b/.gitignore @@ -17,4 +17,5 @@ grpc_p2p_client/remote-ips.txt # Output files *.txt +*.tsv !grpc_p2p_client/local.ips.tsv