Skip to content

Instantly share code, notes, and snippets.

@jbowles
Created November 23, 2012 15:26
Show Gist options
  • Save jbowles/4136115 to your computer and use it in GitHub Desktop.
Save jbowles/4136115 to your computer and use it in GitHub Desktop.
Horizon Transaction First Draft

The :hub is the transaction and/or application (more on this later). Each :node is wrapper around a Hero Formula responsible for passing the non-boolean values to the :hub, but it also returns a boolean. Each camel-cased line inside the :node parentheses is a Hero :formula and the values in quotes are the return values of a Formula's :step. Formula.step is the only thing responsible for changing state.

The following is in Clojure but it should be interpretable from a Ruby perspective; it's the relations that matter here not the syntax.

[:hub ;; begin transaction
 ( ;; begin set of Nodes
  
  :node-unique-accept 
   ( ;; begin set of Formulas for :node-unique-accept
    :ParseUrl "https, www, ruby-toolbox.com, categories/state_machines.html" 
    :ParseParams "fname lname school state zip" 
    :AcceptBool "0"
   )  ;; end set of Formulas for :node-unique-accept 
  
  :node-unique-check 
   ( ;; begin set of Formulas for :node-unique-check
    :FormatRead "UTF8" 
    :FormatCheckBool "0"
   ) ;; end set of Formulas for :node-unique-check
  
  :node-unique-persist 
   ( ;; begin set of Formulas for :node-unique-persist
    :SaveOrUpdate "id:89432 source_id:43927 parent_id:4893026 uuid:fjodau8Y*B state_type:26 timestamp:2012-11-19" 
    :PersistBool "0"
   ) ;; end set of Formulas for :node-unique-persist

  )  ;; end set of Nodes
 ] ;; end transaction

What is missing

I haven't built in the actual checks for :sound, :complete, :integrity, :stable. But these are more meta-data collectors and/or validators on the transactional meta-data. They are simply the aggregate check of each node's boolean value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment