These are chat archives for RBMHTechnology/eventuate

5th
Oct 2016
Vikas Hazrati
@vhazrati
Oct 05 2016 03:11
Hello @krasserm @magro I got intrigued by the discussion here. Let me take a similar example. We are building a used car sales and support product. There is a car A which is up in the market. There are several ViewDetails command on the car which result in a say "CarViewed" event. Now is there a way for me to find out (without replaying the events and without using the external search / db system ) on how many views the car A got on Saturday versus Sunday (when there was a Superbowl). Shouldn't i be able to get this information from the event source itself, somehow?
Martin Krasser
@krasserm
Oct 05 2016 06:32
What you need is a projection of CarViewed events onto an application-specific "views per day" structure, so a separate query db is probably what you want.
Alexander Semenov
@Tvaroh
Oct 05 2016 20:07

@krasserm when creating user-defined CRDTs, does it make sense to have additional internal fields for optimization purposes, like hashing edges by tree id (edgesByNodeId map) in the following ORSet-based tree CRDT attempt:

case class TreeCrdt[A](edges: ORSet[Edge[A]] = ORSet.apply,
                       edgesByNodeId: Map[String, Edge[A]] = Map.empty) extends CRDTFormat {

  def value: Set[Edge[A]] =
    edges.value

  def createChildNode(parentId: String, nodeId: String, entry: A, timestamp: VectorTime): TreeCrdt[A] = {
    val edge = Edge(nodeId, parentId, entry)
    copy(
      edges = edges.add(edge, timestamp),
      edgesByNodeId = edgesByNodeId.updated(nodeId, edge)
    )
  }

}

?

Alexander Semenov
@Tvaroh
Oct 05 2016 20:12
also, could someone clarify how prepareRemove/remove methods on ORSet are supposed to be used?
Alexander Semenov
@Tvaroh
Oct 05 2016 20:23
I suppose prepareRemove should be used in command handler and remove in emitted event handler.
Alexander Semenov
@Tvaroh
Oct 05 2016 20:44
ah sorry, it's used internally by crdt service
Alexander Semenov
@Tvaroh
Oct 05 2016 21:02
prepareRemove - in "atSource" phase and remove in "downstream"
Alexander Semenov
@Tvaroh
Oct 05 2016 21:36
This message was deleted