Skip to content

v0.14.0

Latest
Compare
Choose a tag to compare
@tqwewe tqwewe released this 16 Jan 17:42
· 11 commits to main since this release
ba1c7b7

Kameo 0.14 is here, bringing some nice new features, two new contributors, and two new generous sponsors.

A huge thank you to Huly Labs and Caido Community for supporting Kameo's development! 💖

And thanks to @meowjesty and @Kamil729 for their contributions!

New Features

Deadlock Warnings

Any ask or tell requests which could result in a deadlock will now emit tracing warnings.

An example includes sending a tell request with .send instead of .try_send, which may result in a deadlock if the mailbox is full.
Doing so will print a warning:

At src/lib.rs:277, An actor is sending a blocking tell request to itself using a bounded mailbox, which may lead to a deadlock.

A nice feature of these warnings is that they show exactly which line of code the issue comes from, making it easily resolvable.

Note that these warnings are only present in debug builds.

Remote Actor Links

Actors can now be linked together remotely! This means if one actor dies, the other will be notified.

This can be achieved with the new methods:

  • ActorRef::link_remote
  • ActorRef::unlink_remote
  • RemoteActorRef::link_remote
  • RemoteActorRef::unlink_remote

Additionally, if a peer gets disconnected, any actors with links to that peer will be notified with ActorStopReason::PeerDisconnected,
making the system robust even if a peer crashes or is disconnected.

ActorRef's blocking_link and blocking_unlink

ActorRef now supports linking and unlinking actors with the new blocking_link and blocking_unlink methods for syncrhonous contexts.

Local Actor Registry

Previously actors could be registered and looked up with kameo's remote feature. But now, this feature is supported for non-remote kameo environments,
providing an easy way to register and lookup actors.

let actor_ref = kameo::spawn(MyActor); 
actor_ref.register("my awesome actor")?; 

let other_actor_ref = ActorRef::<MyActor>::lookup("my awesome actor")?.unwrap(); 
assert_eq!(actor_ref.id(), other_actor_ref.id()); 

Full Control Over Actor Swarm

Configuring or having any sort of control over the underlying libp2p swarm was impossible with kameo.
But now, its very easy and flexible, allowing any kind of custom behaviour to be implemented.

Some new methods when bootstrapping include:

  • ActorSwarm::bootstrap_with_behaviour for providing a custom behaviour.
  • ActorSwarm::bootstrap_with_swarm for providing a custom swarm.
  • ActorSwarm::bootstrap_manual for extremely manual processing of the actor swarm. (see examples/manual_swarm.rs)

Added

  • BREAKING: Add support for manual swarm operations (#111)
  • BREAKING: Add local actor registry for non-remote environments (#114)
  • BREAKING: Add support for remote actor links (#116)
  • Add warnings for potential deadlocks (#87)
  • Implement infallible reply for std::path types (#96)
  • Add blocking_link and blocking_unlink methods to ActorRef (#115)

Changed

  • BREAKING: Use kameo::error::Infallible in Reply derive macro instead of ()
  • BREAKING: Modularize features and improve conditional compilation (#112)

Removed

  • BREAKING: Remove actor state from PreparedActor (#99)
  • BREAKING: Remove deprecated link_child, unlink_child, link_together, and unlink_together methods </>
  • Remove mailbox capacity warning on unbounded mailbox tell requests </>
  • Remove itertools dependency and replace repeat_n with std::iter::repeat </>

Fixed

  • Fix clippy lints and add to CI

Documentation

  • Add Caido Community sponsor to README.md </>
  • Remote stars badge from README.md </>
  • Add huly labs sponsor to README.md </>

Misc

  • Fix release script with current release notes </>
  • Add changelog links for new versions </>
  • Remove flake.nix and flake.lock </>

See the full CHANGELOG.md