Skip to content

Releases: sociomantic-tsunami/ocean

v4.4.1 auto-converted to D2

v4.4.1

05 Nov 13:26
Compare
Choose a tag to compare
  • Workaround task pool regression (#658)

v4.4.0+breaking auto-converted to D2

v4.4.0+breaking

26 Oct 19:12
Compare
Choose a tag to compare

Migration Instructions

Tasks do not implement ISuspendable interface anymore

This is a breaking change that may cause compilation errors.

Marking Task class as implementing ISuspendable was a historical mistake
coming from similarity of methods - and it indeed worked for very simple use
cases. However, tasks are much more restrictive about when exactly it is legal
to call suspend and resume methods while ISuspendable expects both to be
callable at any arbitrary moment.

As a result, trying to use tasks as suspendables has caused several extremely
hard to debug issues and needs to be prohibited. Originally this change was
scheduled for v5.0.0 because it is a breaking one, but negative impact of bugs
occuring because of this mistake has proven to be strong enough to warrant
immediate upgrade effort.

Any affected code has to be adjusted to use raw epoll events (which are
registered on resume calls and unregistered on suspend calls) instead of a
task.

Move assumeUnique to ocean.core.TypeConvert

ocean.core.TypeConvert, ocean.transition

This helper function is not merely transitional: as an ocean counterpart
to the Phobos std.exception.assumeUnique function it will continue to
be useful even in D2-only code. The function has therefore been moved
to an appropriate non-transitional module.

ocean.transition retains access to the function via a public import,
so there should be no impact on downstream apps or libraries, but code
transitioning to D2 only can import the new module in order to bypass
any ocean.transition dependency.

Deprecations

Deprecate ConfigFiller.ClassIterator

ClassIterator has been renamed to ConfigIterator and now supports struct types
and should be used instead.

Usage of Task.continueAfterThrow is not needed anymore

ocean.task.Task.continueAfterThrow method has been deprecated and is now
implemented as no-op. Calls to this method can simply be removed; the required
cleanup behaviour is now handled automatically by the scheduler. (A task that
rethrows an unhandled exception to the caller will now be automatically resumed
by the scheduler for cleanup, using the delayedResume functionality.)

In rare cases when tasks are used without scheduler, caller must resume task
directly instead of calling continueAfterThrow.

Deprecate UnixSocketExt.add/removeInteractiveHandler

There's no need to separate addHandler/removeHandler for
different types of handlers, instead overloads of addHandler/
removeHandler should be used.

Features

Add StatsLogReader reader that parses stats

  • ocean.util.log.StatsReader

StatsLogReader iterates a char stream and it parses each
line into StatsLine which allows extracting values through
an opIndex overload.

Helpers for auto-relinquishing shared resources used by an execution context

ocean.util.container.pool.AcquiredResources

Helper structs for a specific execution context (e.g. a Task or connection
handler) to acquire and relinquish resources from a shared pool.

Several utilities are provided in this module, all of which build on top of
FreeList:
* Acquired: Tracks instances of a specific type acquired from the
shared resources and automatically relinquishes them when the
execution context exits.
* AcquiredArraysOf: Tracks arrays of a specific type acquired from the
shared resources and automatically relinquishes them when the
execution context exits.
* AcquiredSingleton: Tracks a singleton instance acquired from the
shared resources and automatically relinquishes it when the execution
context exits.

For more details on how to set up a global shared resources container and a
class to track the resources that have been acquired by a specific execution
context, see the module header documentation.

The module contains detailed usage examples. For the most common use case --
acquiring and reliniquishing arrays from a pool -- see the usage example of
AcquiredArraysOf.

Allow changing of the output streams for AppStatus

  • ocean.io.console.AppStatus, ocean.util.log.InsertConsole

    AppStatus and InsertConsole now support connecting and disconnecting
    to/from the output streams at runtime, decoupling them from the Stdout. This
    allows for connecting various output devices, such as unix domain sockets at
    runtime.

Add UnixSocketExt handler to display the AppStatus to socket

  • ocean.io.console.AppStatus

    AppStatus now allows program to register the AppStatus instance
    with the Unix domain socket's handler and print the app status there
    until the socket is connected. The usage example is as simple as
    this.unix_socket_ext.addHandler("show_status", &this.app_status.connectedSocketHandler)

Non-allocating replacement for declaring array literals.

  • ocean.core.Array

    Add a new helper function fill() to assign all the elements of an array.
    The function is an alternative for declaring an array literal, which is
    known to allocate GC memory. (fill() also checks that the length of the
    array matches the number of variadic arguments.)

    A couple of examples without this functionality:

    int[4] mem_array = [0, 1, 2, 3]; // allocates memory in the heap
    
    int[3] static_array;
    static_array[0] = 0;
    static_array[1] = 1; // Does not allocate memory in the heap but does not
    static_array[2] = 2; // scale well for many elements

    So the fill() functionality helps as follows:

    int[3] array;
    array.fill(0, 1, 2); // Does not allocate memory in the heap and scale well

Support struct types in ConfigIterator.

ClassIterator has been renamed to ConfigIterator and now supports iterating
over struct types.

Enhanced CSV parser implementation

ocean.text.csv.CSV

Internal implementation of the parser was rewritten to support the following
enhancements:

  • Handles quoted field on the end of row (some,"field")
  • Handles partially quoted field ("half,"other","half,secondfield)
  • More stack friendly, 512 byte stream reading buffer was moved to heap
  • Added tests for escaping quotes

Separate lifetime for empty records of ExpiringCache

ocean.util.container.cache.ExpiringCache

Now supports extra optional constructor argument - lifetime used for empty
cached records. If not specified, regular lifetime value will be used, same as
before.

ExpiringCache considers a cached record with array length 0 as being "empty".

This feature is intended for applications caching failures as empty values so
that shorter expiration can be used for those.

Wrap already open file descriptor in File instance

  • ocean.io.device.File

    File class implements all ocean's IO interfaces, so it's
    very convenient to wrap a file descriptor of previously
    opened device into File instance for easy composition
    in the rest of the IO framework. File class now implements
    setFileHandle method which allows user to wrap the
    File around it.

Allow turning off CPU/Memory usage and/or uptime in AppStatus

  • ocean.io.console.AppStatus

    AppStatus now allows turning off particular components of the heading
    line printout. This allows user not to query potentially expensive stats
    (such as MemoryUsage if not needed).

Add statistics counter for generating a time histogram

  • ocean.math.TimeHistogram

A timing statistics counter for any sort of transaction that takes a
microsecond to a second to complete. Collects the following statistical
information:

  • a logarithmic time histogram with bins from ≥1µs to <1s, three bins per
    power of ten in a stepping of 1 .. 2 .. 5 .., plus one bin for each <1µs
    and ≥1s,

  • the total number of transactions and the aggregated total completion time.

New bindings for OpenSSL

  • ocean.net.ssl.openssl.OpenSsl

    This new module contains C bindings for the OpenSsl library. Only a very
    small subset of the library is currently included. It contains the functions
    required for RSA encryption and low-level asynchronous SSL communication.

Change of StreamProcessor, TaskPool and ThrottledTaskPool internals

Also affects StreamProcessor as it uses ThrottledTaskPool internally.

Both TaskPool and ThrottledTaskPool stopped defining internal private
OwnedTask to wrap user-supplied type in. Instead, regular termination hook
infrastructure is used.

Both also don't try to catch and rethrow exceptions arising from a task. This is
not needed because recycling is already done by the termination hook system.

Overall, only expected observable impact is fixed interaction between
specialized worker fiber pools and TaskPool. However, because of how different
internal logic is now, it is highly recommended to carefully test applications
when upgrading.

Add ebtree based TreeMap data structure

  • ocean.util.container.map.TreeMap

TreeMap is an ebtree based map with malloc-allocated nodes,
with a very low overhead for the entire map. Additionally,
any tree modification is allowed during a tree iteration.

Extract the Unix socket command system from the application

The only convenient way to use the Unix domain socket as a control point was
through the UnixSocketExt, which was limiting this to a single socket per
application. Now the UnixSocketExt is only instantiating and configuring the
instance of UnixSocketListener and ComandsRegistry, which can also be
instantiated and configured manually as many times as needed.

Support registering handlers that accept unix socket in UnixSocketExt

UnixSocketExt now provides an interface for the user to register the
unix socket command h...

Read more

v4.3.7 auto-converted to D2

v4.3.7

24 Oct 15:56
Compare
Choose a tag to compare

Changes inherited from v4.2.11:

  • Revert "Add suspendables to throttler in consistent state" #651

v4.2.11 auto-converted to D2

v4.2.11

24 Oct 15:56
Compare
Choose a tag to compare

Bugs fixed:

  • Revert "Add suspendables to throttler in consistent state" #651

v4.3.6 auto-converted to D2

v4.3.6

17 Oct 08:27
Compare
Choose a tag to compare

Inherits changes from https://github.com/sociomantic-tsunami/ocean/milestone/94?closed=1

  • Handle tasks spawned by a task pool in SpecializedPools #643
  • Improve and fix ISuspendableThrottler style #642
  • Enable stomping for suspendables array #641
  • Add suspendables to throttler in consistent state #640
  • Stop printing at \0 #637