Liking cljdoc? Tell your friends :D

automaton-simulation-de.scheduler.snapshot

A scheduler snapshot is a consistent set of data for the scheduler. It is containing the simulation state, past events and future events and iteration number scheduler snapshot is identified with an id property and is related to exactly one date. Past and Future events are sorted collection of events.

Remarks:

  • An entity using the scheduler snapshot should not access past or future events to have some information on the state the simulation.

A scheduler snapshot is a consistent set of data for the scheduler.
It is containing the simulation state, past events and  future events and iteration number scheduler snapshot is identified with an id property and is related to exactly one date.  Past and Future events are sorted collection of events.

Remarks:
* An entity using the scheduler snapshot should not access past or future events to have some information on the state the simulation.

  * [See entity](docs/archi/snapshot_entity.png)
raw docstring

buildclj/s

(build id iteration date state past-events future-events)

Creates a snapshot

Creates a snapshot
raw docstring

inconsistency?clj/s

(inconsistency? {:keys [:automaton-simulation-de.scheduler.snapshot/date]
                 :as snapshot})

Check snapshot consistency

Returns sequence of future events which are before current date or past events which are after current date Returns false if consistent

Check snapshot consistency

Returns sequence of future events which are before current date
or past events which are after current date
Returns false if consistent
raw docstring

initialclj/s

(initial starting-evt-type date)

Creates an initial snapshsot

Creates an initial snapshsot
raw docstring

next-snapshotclj/s

(next-snapshot previous-snapshot)

Creates the next snapshot based on the previous one and decision of what is the event and new-past-events and new-future-events Returns a snapshot.

Creates the next snapshot based on the previous one and decision of what is the event and new-past-events and new-future-events
Returns a snapshot.
raw docstring

schemaclj/s

(schema)

Scheduler snapshot is a map containing:

  • id - Unique identificator of an scheduler snapshot. It is in a one to one relationship with a scheduler snapshot (so it acts like an id of that scheduler snapshot in the context of a scheduler play) in the context scheduler.
  • iteration - A counter of scheduler iteration. By convention, the counter is starting at 0.
  • date - Defines the date where that scheduler-snapshot happens
  • state - State modified by the event
  • past-events - Collection of a past event. A past event is event that has already been executed, so its date is in the past. A past event cannot be modified anymore (i.e. it is immutable).
  • future-events - Collection of a future event. A future event is an event that has not been executed yet, so its date is in the future. A future event may be updated during the simulation - its date may change, its data may change or it could be cancelled (i.e. it’s a mutable event)
Scheduler snapshot is a map containing:
* `id` - Unique identificator of an scheduler snapshot.  It is in a one to one relationship with a scheduler snapshot (so it acts like an id of that scheduler snapshot in the context of a scheduler play) in the context scheduler.
* `iteration` - A counter of scheduler iteration. By convention, the counter is starting at 0.
* `date` - Defines the date where that scheduler-snapshot happens
* `state` - State modified by the event
* `past-events` - Collection of a past event. A past event is event that has already been executed, so its date is in the past. A past event cannot be modified anymore (i.e. it is immutable).
* `future-events` - Collection of a future event. A future event is an event that has not been executed yet, so its date is in the future. A future event may be updated during the simulation - its date may change, its data may change or it could be cancelled (i.e. it’s a mutable event)
raw docstring

update-snapshot-with-event-returnclj/s

(update-snapshot-with-event-return event-return sorting snapshot)

Updates the snapshot with the event-return state and future-events data. Events are sorted are sorted according to sorting function, which takes a sequence of future-events and returns the sorted sequence.

  • Design decision: state and future-events are replaced with values returned by the event execution
    • Rationale:
      • State structure need not to be known from here
      • Merging the old value and a chunk is not efficient
    • Consequence
      • The events should update the value of the state
      • The events should not update the difference only
    • Limits
      • Not known.
Updates the `snapshot` with the `event-return` `state` and `future-events` data.
Events are sorted are sorted according to `sorting` function, which takes a sequence of `future-events` and returns the sorted sequence.

* Design decision: `state` and `future-events` are replaced with values returned by the event execution
   * Rationale:
     * State structure need not to be known from here
     * Merging the old value and a chunk is not efficient
   * Consequence
     * The events should update the value of the state
     * The events should not update the difference only
   * Limits
     * Not known.
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close