neuroevolution_lineage_events behaviour (faber_neuroevolution v1.2.4)
View SourceBehaviour definition for neuroevolution lineage event persistence.
This behaviour defines the minimal API for lineage tracking. Implementations MUST be non-blocking to avoid impacting evolution performance.
Callbacks
init/1 - Initialize backend persist_event/2 - Fire-and-forget single event persist_batch/2 - Fire-and-forget batch of events read_stream/3 - Read events (for recovery/replay) subscribe/3 - Subscribe to stream (for projections) unsubscribe/3 - Unsubscribe from stream
Performance Requirements
Lineage tracking must NEVER block the evolution loop:
- persist_event/persist_batch should return immediately - Use async I/O internally (spawn, cast, buffering) - Acceptable to lose events under extreme load - read_stream may block (only used for recovery)
Stream Design
Events are organized into streams based on entity type:
- individual-{id} : Birth, death, fitness, mutations - species-{id} : Speciation, lineage events - population-{id} : Generation, capacity events - coalition-{id} : Coalition lifecycle
Summary
Types
-type direction() :: forward | backward.
-type event() :: map().
-type position() :: non_neg_integer().
-type read_opts() :: #{from => position(), limit => pos_integer(), direction => direction()}.
-type stream_id() :: binary().