Skip to content

1.0.0

Compare
Choose a tag to compare
@Neverlord Neverlord released this 26 Jun 13:00
· 109 commits to main since this release

Added

  • The actor system now offers a println convenience function for printing to
    the console. When building CAF with C++20 enabled, the function uses
    std::format internally. Otherwise, it falls back to the compatibility layer
    with the same syntax. The function also recognizes inspect overloads for
    custom types. Any printing done by this function is thread-safe. The function
    is available on actors in order to allow self->println("...").
  • Actors have a new monitor member function that takes an actor handle and a
    callback. The callback will run when the monitored actor terminates (in the
    context of the monitoring actor). The function returns a monitorable object
    that can be used to cancel the monitoring. This mechanism replaces the old
    approach that relied on down_msg handlers in event-based actors (nothing
    changes for blocking actors).
  • Event-based actors can now set an idle timeout via set_idle_handler. The
    timeout fires when the actor receives no messages for a specified duration.
    This new feature replaces the after(...) >> ... syntax and allows actors to
    specify what kind of reference CAF will hold to that actor while it is waiting
    for the timeout (strong or weak) and whether to trigger the timeout once or
    repeatedly.
  • New flow operators: buffer, sample, start_with,
    on_backpressure_buffer, on_error_return, on_error_return_item, and
    on_error_complete.
  • The unit test framework now offers the new utility (template) class
    caf::test::approx for approximate comparisons.

Fixed

  • Fix building CAF with shared libraries (DLLs) enabled on Windows (#1715).
  • The actor_from_state utility now evaluates spawn options such as linked
    (#1771). Previously, passing this option to actor_from_state resulted in a
    compiler error.
  • Sending a message to an already terminated actor from a function_view now
    properly reports an error (#1801).
  • URIs now support support username and password in the user-info sub-component
    (#1814). Consequently, the userinfo field of the URI class now has two
    member variables: name and (an optional) password. Further, the userinfo
    field is now optional in order to differentiate between an empty user-info and
    no user-info at all.
  • The parser for reading JSON and configuration files now properly handles
    Windows-style line endings (#1850).
  • Calling force_utc on a caf::chrono::dateime object now properly applies
    the UTC offset. Previously, the function would shift the time into the wrong
    direction (#1860).
  • Fix a regression in the work-stealing scheduler that prevented workers from
    stealing work from other workers in the relaxed polling state (#1866).
  • Fix handling of integer or boolean values as keys as well as lists as values
    in dictionaries when using the json_builder.
  • Calling caf::chrono::datetime::to_local_time will now properly interpret the
    stored time as local time if no UTC offset is present.

Removed

  • The obsolete CAF types caf::string_view, caf::byte, caf::optional,
    caf::replies_to, and caf::flow::item_publisher.
  • The obsolete operator* for "combining" two actor handles.
  • All to_stream and to_typed_stream member functions on actors (they are
    available on caf::flow::observable directly).
  • The group API has been removed entirely.
  • The experimental APIs for actor profiling and inserting tracing data have been
    removed. Neither API has a clear use case at the moment and since we have not
    received any feedback on either API, we have decided to remove them to
    simplify the code base.
  • The actor_system_config no longer contains special member variables for the
    OpenSSL module. The module now uses the regular configuration system.
  • The caf-run tool no longer ships with CAF. The tool has not been maintained
    for a long time, has never been thoroughly tested, and has no documentation.
  • The actor_system_config no longer contains the logger_factory setter. We
    might reintroduce this feature in the future, but we think the new logger
    interface class is not yet stable enough to expose it to users and to allow
    custom logger implementations.

Changed

  • When using the caf-net module, users may enable Prometheus metric export by
    setting the configuration option caf.net.prometheus-http. The option has the
    following fields: port, address, tls.key-file, and tls.cert-file. When
    setting the TLS options, the server will use HTTPS instead of HTTP.
  • Sending messages from cleanup code (e.g., the destructor of a state class) is
    now safe. Previously, doing so could cause undefined behavior by forming a
    strong reference to a destroyed actor.
  • Actors will now always send an error message if an incoming message triggered
    an unhandled exception. Previously, CAF would only send an error message if
    the incoming message was a request (#1684).
  • Stateful actors now provide a getter function state() instead of declaring a
    public state member variable. This change enables more flexibility in the
    implementation for future CAF versions.
  • Passing a class to spawn_inactive is now optional and defaults to
    event_based_actor. The next major release will remove the class parameter
    altogether.
  • Event-based actors can now handle types like exit_msg and error in their
    regular behavior.
  • The check_eq and require_eq functions in the unit test framework now
    prohibit comparing floating-point numbers with ==. Instead, users should use
    new approx utility class.
  • The member functions send, scheduled_send, delayed_send, request and
    delegate are deprecated in favor of the new mail API.
  • The free functions anon_send, delayed_anon_send, scheduled_anon_send are
    deprecated in favor of the new anon_mail API.

Deprecated

  • Using spawn_inactive now emits a deprecation warning when passing a class
    other than event_based_actor.
  • The experimental actor_pool API has been deprecated. The API has not seen
    much use and is too cumbersome.
  • The printing interface via aout has been replaced by the new println
    function. The old interface is now deprecated and will be removed in the next
    major release.
  • Calling monitor with a single argument is now deprecated for event-based
    actors. Users should always provide a callback as the second argument. Note
    that nothing changes for blocking actors. They still call monitor and then
    receive a down_msg in their mailbox.
  • The function set_down_handler is deprecated for the same reasons as
    monitor: please use the new monitor API with a callback instead.
  • The spawn flag monitored is deprecated as well and users should call
    monitor directly instead.
  • Constructing a behavior with after(...) >> ... has been deprecated in favor
    of the new set_idle_handler function. Note that blocking actors may still
    pass a timeout via after(...) to receive functions. The deprecation only
    targets event-based actors.
  • The use case for function_view is covered by the new feature on blocking
    actors that allows calling receive with no arguments. Hence, function_view
    becomes obsolete and is deprecated.
  • The set_default_handler member function on event-based actors is now
    deprecated. Instead, users should use a handler for message in their
    behavior as a catch-all. For skipping messages, CAF now includes a new
    mail_cache class that allows explicitly stashing messages for later
    processing.
  • Special-purpose handlers for messages like exit_msg and error are now
    deprecated. Instead, users should handle these messages in their regular
    behavior.
  • The legacy testing framework in caf/test/unit_test.hpp is now deprecated and
    the header (as well as headers that build on top it such as
    caf/test/dsl.hpp) will be removed in the next major release. Users should
    migrate to the new testing framework.