Skip to content

Instantly share code, notes, and snippets.

@Samstiles
Created November 4, 2015 18:17
Show Gist options
  • Save Samstiles/d9732b4582066f04da29 to your computer and use it in GitHub Desktop.
Save Samstiles/d9732b4582066f04da29 to your computer and use it in GitHub Desktop.
(ns stats-service.domain.protocols
"Protocols used throughout the stats service."
(:refer-clojure :exclude [name])
(:require [co.paralleluniverse.pulsar.core :as a]))
(defprotocol Statistic
"Base statistic from which all other statistics are derived."
(name [this] "Returns the name of this Statistic. Will be used by the Actor to update its map of Records when the Record changes")
(context [this] "Returns the context for the Statistic (Interaction, Resource, Queue)")
(event-set [this] "Returns the set of events that this Statistic cares about")
(receive [this event] "Receive an event. Returns a Vector with an updated version of this record and any generated reporting events")
(finished? [this] "Am I still waiting for any events?")
(serialize [this] "Generate a representation that is persistable"))
(a/suspendable! stats_service.domain.protocols.Statistic)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment