Skip to content
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

Rebuild the structure #1

Open
Baptouuuu opened this issue Jan 25, 2024 · 1 comment
Open

Rebuild the structure #1

Baptouuuu opened this issue Jan 25, 2024 · 1 comment

Comments

@Baptouuuu
Copy link
Member

Baptouuuu commented Jan 25, 2024

Overhaul

This package should be rebuilt from scratch around the mantle asynchronous framework. This would allow to work on each actor as if it were synchronous, thus creating a simple architecture.

Actor interface

interface Actor
{
    public function __invoke(Receive $receive): Receive;
}
Receive::message(T)|Receive::signal(Signal)
    ->on(T::class, callable(T, Address(sender)): void)
    ->onChildFailure(callable(Address(child)): void)
    ->onPostStop(callable(): void)
    ->onPreRestart(callable(): void)
    ->onTerminated(callable(Address(child)): void)
    ->stopWhen(callable(): bool);

This style allows for a more declarative approach and may help optimize the system by not calling the callables when declared.

@Baptouuuu
Copy link
Member Author

Instead of using Receive::stopWhen() maybe the continuation pattern should be used on each callable passed to Receive

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant