-
Notifications
You must be signed in to change notification settings - Fork 0
Refactor actor spawning methods and streamline actor system traits #48
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
Conversation
- Removed deprecated methods from `ActorSystemCoreExt` and `ActorSystemAdvancedExt` to simplify the API. - Consolidated actor spawning logic into a single internal method, enhancing clarity and reducing redundancy. - Updated usage of actor spawning in tests and examples to utilize the new builder pattern for improved readability and maintainability. - Adjusted imports and module structure for better organization and consistency across the codebase.
…ptions - Simplified the handling of lazy actor references by delegating message sending to resolved references, reducing complexity and avoiding recursion. - Introduced a new `Format` enum for message serialization, supporting binary and JSON formats, with auto-detection capabilities for improved flexibility. - Updated the `SpawnOptions` and `ResolveOptions` structures to utilize default constructors, enhancing code clarity and consistency. - Improved error handling in the `SpawnBuilder` for actor name validation, ensuring clearer feedback on invalid paths. - Adjusted documentation and examples to reflect the new default options and serialization methods.
- Updated the ActorLifecycle struct to replace string-based identifiers with ActorId for both watchers and targets, enhancing type safety and consistency. - Modified watch and unwatch methods to accept ActorId parameters, streamlining the registration and removal of watchers. - Adjusted related methods and tests to reflect the new ActorId usage, ensuring proper functionality and improved clarity in actor relationships. - Enhanced logging to utilize ActorId for better traceability during watch operations.
- Introduced UUID-based ActorId and NodeId, replacing previous numeric identifiers for improved uniqueness and traceability. - Updated ActorAddress to support new UUID format, ensuring backward compatibility with legacy formats. - Refactored tests and system components to utilize the new ActorId structure, enhancing clarity and consistency across the codebase. - Added `uuid` dependency to the project for UUID generation and handling. - Modified Justfile to include necessary build dependencies for Python and C++ integration.
- Introduced SystemActorProxy and PythonActorServiceProxy for direct method calls, improving interaction with system and service actors. - Refactored BucketStorage and TopicBroker to utilize remote method support, streamlining actor communication. - Updated tests to validate new proxy methods and ensure proper functionality across various scenarios. - Enhanced message serialization and error handling for improved robustness and clarity in actor interactions.
… handling - Converted StorageManager from an Actor to a remote class, enabling direct method calls. - Replaced message-based communication with explicit method calls for bucket and topic management. - Updated related methods to enhance clarity and maintainability, including get_bucket, get_topic, list_buckets, and get_stats. - Adjusted tests to validate the new proxy method interactions, ensuring proper functionality across scenarios.
| import hashlib | ||
| import logging | ||
| from typing import Any | ||
| from typing import TYPE_CHECKING, Any |
Check notice
Code scanning / CodeQL
Unused import Note
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 2 days ago
To fix the problem, we should remove the unused Any symbol from the import statement while retaining TYPE_CHECKING, which is used later in the file. This avoids an unnecessary dependency and clarifies that only TYPE_CHECKING is required from typing.
Specifically, in python/pulsing/queue/manager.py, update line 6 from from typing import TYPE_CHECKING, Any to from typing import TYPE_CHECKING. No other code changes are needed, since nothing depends on Any in the shown snippet. This preserves all existing functionality and only cleans up the unused import.
-
Copy modified line R6
| @@ -3,7 +3,7 @@ | ||
| import asyncio | ||
| import hashlib | ||
| import logging | ||
| from typing import TYPE_CHECKING, Any | ||
| from typing import TYPE_CHECKING | ||
|
|
||
| from pulsing.actor import ActorId, ActorRef, ActorSystem, remote | ||
|
|
| from typing import Any, AsyncIterator | ||
|
|
||
| from pulsing.actor import Actor, ActorId, Message, StreamMessage | ||
| from pulsing.actor import ActorId, StreamMessage, remote |
Check notice
Code scanning / CodeQL
Unused import Note
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 2 days ago
To fix an unused-import issue, remove the specific unused symbol from the import statement while keeping the used ones. This eliminates the unnecessary dependency and makes the code clearer, without impacting behavior.
In this file, ActorId and remote are used, but StreamMessage is not. The fix is to update the import on line 7 of python/pulsing/queue/storage.py to drop StreamMessage from the imported names. No other code changes are needed: there are no references to StreamMessage in the provided methods, so removing it will not break anything.
Concretely, in python/pulsing/queue/storage.py, find the line:
from pulsing.actor import ActorId, StreamMessage, remoteand change it to:
from pulsing.actor import ActorId, remoteNo additional imports, methods, or definitions are required.
-
Copy modified line R7
| @@ -4,7 +4,7 @@ | ||
| import logging | ||
| from typing import Any, AsyncIterator | ||
|
|
||
| from pulsing.actor import ActorId, StreamMessage, remote | ||
| from pulsing.actor import ActorId, remote | ||
|
|
||
| from .backend import StorageBackend, get_backend_class | ||
|
|
ActorSystemCoreExtandActorSystemAdvancedExtto simplify the API.Overview:
Details:
Where should the reviewer start?
Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)