All Downloads are FREE. Search and download functionalities are using the official Maven repository.

simulant.schema.edn Maven / Gradle / Ivy

;;   Copyright (c) Metadata Partners, LLC. All rights reserved.
;;   The use and distribution terms for this software are covered by the
;;   Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
;;   which can be found in the file epl-v10.html at the root of this distribution.
;;   By using this software in any fashion, you are agreeing to be bound by
;;   the terms of this license.
;;   You must not remove this notice, or any other, from this software.

{:core
 [[{:db.install/_partition :db.part/db,
    :db/id #db/id[:db.part/db],
    :db/ident :model}
   {:db.install/_partition :db.part/db,
    :db/id #db/id[:db.part/db],
    :db/ident :test}
   {:db.install/_partition :db.part/db,
    :db/id #db/id[:db.part/db],
    :db/ident :sim}
   {:db.install/_partition :db.part/db,
    :db/id #db/id[:db.part/db],
    :db/ident :log}]]

 :clock
 [[{:db/id #db/id[:db.part/db]
    :db/ident :clock/type
    :db/index true
    :db/valueType :db.type/ref
    :db/cardinality :db.cardinality/one
    :db.install/_attribute :db.part/db}
   {:db/id #db/id[:db.part/db]
    :db/ident :clock.type/fixed}
   {:db/id #db/id[:db.part/db]
    :db/ident :clock/realStart
    :db/valueType :db.type/long
    :db/doc "Real time at which sim clock started"
    :db/cardinality :db.cardinality/one
    :db.install/_attribute :db.part/db}   
   {:db/id #db/id[:db.part/db]
    :db/ident :clock/multiplier
    :db/valueType :db.type/double
    :db/doc "Multiply real time by a fixed multiplier"
    :db/cardinality :db.cardinality/one
    :db.install/_attribute :db.part/db}
   {:db/id #db/id [:db.part/db]
    :db/ident :deliver
    :db/doc "Set an attribute's value iff not already set. Idempotent."
    :db/fn #db/fn
    {:lang "clojure"
     :params [db e a v]
     :code (when (zero? (count (q '[:find ?e ?a
                                    :in $ ?e ?a
                                    :where [?e ?a]]
                                  db e a)))
             [[:db/add e a v]])}}]]
 
 :model
 [[{:db/id #db/id[:db.part/db]
    :db/ident :model/type
    :db/valueType :db.type/ref
    :db/index true
    :db/cardinality :db.cardinality/one
    :db.install/_attribute :db.part/db}
   {:db/id #db/id[:db.part/db]
    :db/ident :model/tests
    :db/valueType :db.type/ref
    :db/doc "Tests generated from this model"
    :db/cardinality :db.cardinality/many
    :db.install/_attribute :db.part/db}]]

 :test
 [[{:db/id #db/id[:db.part/db]
    :db/ident :test/type
    :db/index true
    :db/valueType :db.type/ref
    :db/cardinality :db.cardinality/one
    :db.install/_attribute :db.part/db}
   {:db/id #db/id[:db.part/db]
    :db/ident :test/duration
    :db/valueType :db.type/long
    :db/index true
    :db/doc "Duration covered by test (in msec)"
    :db/cardinality :db.cardinality/one
    :db.install/_attribute :db.part/db}
   {:db/id #db/id[:db.part/db]
    :db/ident :test/agents
    :db/valueType :db.type/ref
    :db/doc "Agents in this test"
    :db/cardinality :db.cardinality/many
    :db.install/_attribute :db.part/db}
   {:db/id #db/id[:db.part/db]
    :db/ident :test/sims
    :db/valueType :db.type/ref
    :db/doc "Sims run for this test"
    :db/cardinality :db.cardinality/many
    :db.install/_attribute :db.part/db}]]

 :agent
 [[{:db/id #db/id[:db.part/db]
    :db/ident :agent/type
    :db/valueType :db.type/ref
    :db/index true
    :db/doc "Type of agent"
    :db/cardinality :db.cardinality/one
    :db.install/_attribute :db.part/db}
   {:db/id #db/id[:db.part/db]
    :db/ident :agent/errorDescription
    :db/valueType :db.type/string
    :db/cardinality :db.cardinality/one
    :db/doc "Human readable description of agent error, if any"
    :db.install/_attribute :db.part/db}   
   {:db/id #db/id[:db.part/db]
    :db/ident :agent/actions
    :db/valueType :db.type/ref
    :db/doc "Actions performed by this agent"
    :db/cardinality :db.cardinality/many
    :db.install/_attribute :db.part/db}]]

 :actionLog
 [[{:db/id #db/id[:db.part/db]
    :db/ident :actionLog/action
    :db/valueType :db.type/ref
    :db/doc "Action this log entry is associated with"
    :db/cardinality :db.cardinality/one
    :db.install/_attribute :db.part/db}
   {:db/id #db/id[:db.part/db]
    :db/ident :actionLog/sim
    :db/valueType :db.type/ref
    :db/doc "Sim this log entry is associated with"
    :db/cardinality :db.cardinality/one
    :db.install/_attribute :db.part/db}
   {:db/id #db/id[:db.part/db]
    :db/ident :actionLog/nsec
    :db/valueType :db.type/long
    :db/doc "How long this action took, in nsec"
    :db/cardinality :db.cardinality/one
    :db.install/_attribute :db.part/db}
   {:db/id #db/id [:db.part/db]
    :db/ident :simulant.sim/actionLog}
   {:db/id #db/id[:db.part/db]
    :db/ident :simulant.sim/processState}]]
 
 :action
 [[{:db/id #db/id[:db.part/db]
    :db/ident :action/atTime
    :db/valueType :db.type/long
    :db/doc "Time this action should happen, in msec relative to start of the sim."
    :db/index true
    :db/cardinality :db.cardinality/one
    :db.install/_attribute :db.part/db}
   {:db/id #db/id[:db.part/db]
    :db/ident :action/type
    :db/valueType :db.type/ref
    :db/doc "Type of the action."
    :db/index true
    :db/cardinality :db.cardinality/one
    :db.install/_attribute :db.part/db}]]
 
 :process
 [[{:db/id #db/id[:db.part/db]
    :db/ident :process.type/basic}
   {:db/id #db/id[:db.part/db]
    :db/ident :process.state/running}   
   {:db/id #db/id[:db.part/db]
    :db/ident :process.state/completed}   
   {:db/id #db/id[:db.part/db]
    :db/ident :process.state/failed}
   {:db/id #db/id[:db.part/db]
    :db/ident :process/errorDescription
    :db/valueType :db.type/string
    :db/cardinality :db.cardinality/one
    :db/doc "Human readable description of process error, if any"
    :db.install/_attribute :db.part/db}   
   {:db/id #db/id[:db.part/db]
    :db/ident :process/type
    :db/index true
    :db/valueType :db.type/ref
    :db/cardinality :db.cardinality/one
    :db.install/_attribute :db.part/db}
   {:db/id #db/id[:db.part/db]
    :db/ident :process/state
    :db/valueType :db.type/ref
    :db/index true
    :db/cardinality :db.cardinality/one
    :db.install/_attribute :db.part/db}   
   {:db/id #db/id[:db.part/db]
    :db/ident :process/ordinal
    :db/valueType :db.type/long
    :db/index true
    :db/doc "Ordinal number of process within sim, determines which actions this process is responsible for."
    :db/cardinality :db.cardinality/one
    :db.install/_attribute :db.part/db}
   {:db/id #db/id[:db.part/db]
    :db/ident :process/uuid
    :db/valueType :db.type/uuid
    :db/doc "Unique id for process"
    :db/unique :db.unique/value
    :db/cardinality :db.cardinality/one
    :db.install/_attribute :db.part/db}]]

 :services
 [[{:db/id #db/id[:db.part/db]
    :db/ident :service/type
    :db/valueType :db.type/ref
    :db/index true
    :db/cardinality :db.cardinality/one
    :db.install/_attribute :db.part/db}
   {:db/id #db/id[:db.part/db]
    :db/ident :service/key
    :db/valueType :db.type/ref
    :db/index true
    :db/cardinality :db.cardinality/one
    :db.install/_attribute :db.part/db}
   {:db/id #db/id[:db.part/db]
    :db/ident :service/constructor
    :db/valueType :db.type/string
    :db/cardinality :db.cardinality/one
    :db/doc "The fully qualified name of a Clojure function that
builds the service. The function will be called with a DB connection and 
this service entity."
    :db.install/_attribute :db.part/db}
   {:db/id #db/id[:db.part/db]
    :db/doc "Service that accumulates events during a sim run,
and then transacts them into the sim database at the
end of the run."
    :db/ident :service.type/actionLog}
   {:db/id #db/id[:db.part/db]
    :db/doc "Service that allows a process to track its state in a database"
    :db/ident :service.type/processState}]]
 
 :sim
 [[{:db/id #db/id[:db.part/db]
    :db/ident :sim.type/basic}
   {:db/id #db/id[:db.part/db]
    :db/ident :sim/services
    :db/valueType :db.type/ref
    :db/cardinality :db.cardinality/many
    :db/doc "Services used by this sim"
    :db.install/_attribute :db.part/db}   
   {:db/id #db/id[:db.part/db]
    :db/ident :sim/type
    :db/index true
    :db/valueType :db.type/ref
    :db/cardinality :db.cardinality/one
    :db.install/_attribute :db.part/db}
   {:db/id #db/id[:db.part/db]
    :db/ident :sim/systemURI
    :db/valueType :db.type/string
    :db/doc "System under test"
    :db/index true
    :db/cardinality :db.cardinality/one
    :db.install/_attribute :db.part/db}   
   {:db/id #db/id[:db.part/db]
    :db/ident :sim/processCount
    :db/valueType :db.type/long
    :db/index true
    :db/doc "Total number of processes desired for this sim."
    :db/cardinality :db.cardinality/one
    :db.install/_attribute :db.part/db}
   {:db/id #db/id[:db.part/db]
    :db/ident :sim/clock
    :db/valueType :db.type/ref
    :db/doc "The clock used by this sim"
    :db/cardinality :db.cardinality/one
    :db.install/_attribute :db.part/db}
   {:db/id #db/id[:db.part/db]
    :db/ident :sim/processes
    :db/valueType :db.type/ref
    :db/doc "Processes that have joined this sim."
    :db/cardinality :db.cardinality/many
    :db.install/_attribute :db.part/db}
   {:db/id #db/id [:db.part/db]
    :db/ident :sim/join
    :db/doc "Add proc to the sim, if any slots are still available"
    :db/fn #db/fn
    {:lang "clojure"
     :params [db simid proc]
     :code (let [procid (:db/id proc)
                 procs (q '[:find ?procid
                            :in $ ?simid
                            :where [?simid :sim/processes ?procid]]
                          db simid)]
             (when (and (< (count procs) (:sim/processCount (d/entity db simid)))
                        (not (some (fn [[e]] (= e procid)) procs)))
               [[:db/add simid :sim/processes procid]
                proc
                [:db/add procid :process/ordinal (count procs)]]))}}]]

 :codebase
 [[{:db/id #db/id [:db.part/db]
    :db/ident :source/codebase
    :db/valueType :db.type/ref
    :db/doc "Reference to information about the source tree"
    :db/cardinality :db.cardinality/one
    :db.install/_attribute :db.part/db}
   {:db/id #db/id[:db.part/db]
    :db/ident :repo.type/git}
   {:db/id #db/id[:db.part/db]
    :db/ident :repo/type
    :db/index true
    :db/valueType :db.type/ref
    :db/cardinality :db.cardinality/one
    :db/doc "Type of repository"
    :db.install/_attribute :db.part/db}
   {:db/id #db/id[:db.part/db]
    :db/ident :git/uri
    :db/valueType :db.type/string
    :db/doc "Git repository URI"
    :db/index true
    :db/cardinality :db.cardinality/one
    :db.install/_attribute :db.part/db}
   {:db/id #db/id [:db.part/db]
    :db/ident :git/sha
    :db/index true
    :db/valueType :db.type/string
    :db/doc "SHA ref for current git HEAD"
    :db/cardinality :db.cardinality/one
    :db.install/_attribute :db.part/db}]]}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy