-
-
Notifications
You must be signed in to change notification settings - Fork 38
feat: design complete fastn-p2p and fastn-context systems for distributed operations #2202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Conversation
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
…reaming sessions - Document three core patterns: client::call(), client::connect(), server::listen() - Design unified server::Session<PROTOCOL> that handles both RPC and streaming - Add server::Session -> server::Request conversion with into_request() - Specify public fields for direct stream access (send, recv, stdin, stdout) - Include complete API reference with all methods and signatures - Use fully qualified paths throughout examples (no use statements) - Add protocol consistency requirements (client and server must use same protocol) - Clarify stream directions with "back to client" terminology Key design decisions: - server::listen() returns Session<PROTOCOL> stream - Session can convert to Request for RPC or use streams directly - Client Session accepts streams from server, Server Session opens streams to client - Public fields eliminate mutability conflicts with accessor methods Ready for implementation phase after design agreement. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
…fastn-context - Add global counter storage system that survives context drops - Design dotted path keys: "global.service.session.task.counter_name" - Add path tracking to Context structure with full_path field - Document persistent total counters vs auto-cleanup live counters - Add counter storage examples with hierarchical path structures - Ensure historical metrics persist beyond context lifecycles - Enable hierarchical counter aggregation via path-based queries Counter examples: - "global.connections" (app-level) - "global.remote-access.alice@bv478gen.commands" (session-level) - "global.http-proxy.requests" (service-level) Global HashMap storage ensures metrics survive context drops while maintaining hierarchical structure for status display and aggregation. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Remove incomplete command.rs file that was accidentally committed - Revert lib.rs to clean state without WIP command exports - Preserve complete fastn-context README design - Keep fastn-p2p README design for reference - Ready to begin implementation phase with clean slate
…lementation scope - Move fastn-context to repo root (not v0.5) for ecosystem-wide availability - Split comprehensive README into focused current vs future features - Create README.md with minimal Context API needed for fastn-p2p integration - Split future features into focused NEXT-*.md files: - NEXT-monitoring.md: Status trees, timing, system metrics - NEXT-locks.md: Named locks and deadlock detection - NEXT-counters.md: Global counter storage with dotted paths - NEXT-status-distribution.md: P2P status access - NEXT-complete-design.md: Full original design reference - Add workspace integration for fastn-context crate - Create minimal test example showing required API surface - Add basic Cargo.toml with minimal dependencies This focuses implementation on just what's needed for remote shell functionality: - Basic Context tree structure - Hierarchical cancellation - Task spawning with inheritance - Integration points for fastn-p2p Comprehensive monitoring features deferred to future PRs after core functionality proven. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
…t-scope content - Restore Context Tree Structure and Automatic Context Creation sections - Add back complete Context API with metrics, data storage, and builder pattern - Restore ContextBuilder fluent API with with_data() and with_metric() methods - Include detailed main macro configuration options (logging, shutdown modes) - Add back integration examples showing fastn-p2p usage patterns - Restore usage patterns for simple vs detailed task spawning - Include design benefits and debugging rationale - Reference NEXT-*.md files for future planned features All important current implementation details restored from original comprehensive design. No content lost - proper categorization between current API and future enhancements. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
…d of current() - Remove fastn_context::current() function from API to avoid hidden dependencies - Update test example to use explicit context passing patterns - Show two explicit patterns: context cloning and builder pattern with context parameter - Update README examples to use explicit context instead of current() - Remove thread-local/task-local context access from design Explicit context approach benefits: - Clear dependencies - functions declare context needs explicitly - Better testability - easy to provide specific context for tests - No magic behavior - context comes from explicit sources - Reviewable code - easy to see context usage patterns Will prove if explicit approach works well or if current() convenience needed later. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add spawn_child(name, |ctx|) as clean shortcut for common named task pattern - Update README to show three spawning patterns: - spawn() - inherit current context (no child) - spawn_child(name, |ctx|) - common case shortcut - child(name).with_*().spawn(|ctx|) - full builder pattern - Update test example to use spawn_child() instead of verbose cloning - Show both shortcut and builder pattern alternatives in documentation The spawn_child() shortcut eliminates verbose context cloning while providing named tasks essential for debugging. Most common pattern for everyday use. Three-tier API provides appropriate complexity levels: - Simple inheritance for basic tasks - Named children for debuggable tasks - Full builder for complex initialization 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
…EADME - Create NEXT-operation-tracking.md with named await/select macro design - Design fastn_context::await!() macro for tracking stuck operations - Design fastn_context::select!() macro for select operation tracking - Remove all metrics and data storage from current README scope - Clean up test examples to focus only on context trees and cancellation - Simplify Context struct to just name and cancellation (no metrics/data) - Update ContextBuilder to remove with_data/with_metric methods Current README now focused only on core context functionality: - Context tree structure with parent/child relationships - Hierarchical cancellation with wait/cancel - Three spawning patterns: spawn, spawn_child, child().spawn - Integration patterns for fastn-p2p All advanced features properly moved to NEXT-*.md files for future implementation. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
Author
This was referenced Sep 17, 2025
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.
Summary
Design and implement fastn-p2p streaming API and basic fastn-context integration needed for end-to-end remote shell functionality (rshell/rexec). Focused implementation for immediate remote access needs.
🎯 Focused Implementation Plan
Phase 1: Basic fastn-context (Minimal)
Phase 2: fastn-p2p Streaming API
Phase 3: Test and Validate
Phase 4: Remote Shell Integration
🎯 Minimal Breaking Changes
fastn-p2p changes needed:
client::connect()function (new)client::Sessiontype (new)server::listen()return type to SessionSession::into_request()methodmethods intact
Not included in this PR:
📋 Success Criteria
Goal: Working remote shell over P2P with minimal API surface for immediate use.
The comprehensive monitoring and ecosystem migration will come in follow-up PRs once the core streaming foundation is proven.
🤖 Generated with Claude Code