在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:Eva开源软件地址:https://gitee.com/mirrors/Eva开源软件介绍:
What is Eva?Eva is a distributed database-system implementing an entity-attribute-value data-modelthat is time-aware, accumulative, and atomically consistent. Its API isby-and-large compatible with Datomic's. This software should be considered alphafor the purposes of quality and stability. Check out the FAQ for more info. Getting StartedIf you are brand new to Eva, we suggest reading through this entire readme to familiarize yourself with Eva as a whole. Afterwards, be sure to check out the Eva tutorial series, which break down and go over almost everything you will want to know. DevelopmentRequired ToolsExample: Hello WorldFirst we kick off the repl with: lein repl Next we create a connection ( (def conn (eva/connect {:local true}))(def datom [:db/add (eva/tempid :db.part/user) :db/doc "hello world"])(deref (eva/transact conn [datom])) Note: deref can be used interchangeably with the @ symbol. Now we can run a query to get this fact out of Eva. We don't use (def db (eva/db conn)) Next we execute a query that returns all entity ids in the system matching the doc string (eva/q '[:find ?e :where [?e :db/doc "hello world"]] db) If we want to return the full representation of these entities, we can do that by adding (eva/q '[:find (pull ?e [*]) :where [?e :db/doc "hello world"]] db) Project Structure
Development TasksRunning the Test Suitelein test ConfigurationEva exposes a number of configuration-properties that can be configuredusing java system-properties. Some specific configuration-properties canalso be configured using environment-variables. The About the Eva Data ModelEntity-Attribute-Value (EAV)EAV data-entities consist of:
EAV data can be represented in the following (equivalent) forms:
Time-AwareTo make the EAV data-model time-aware, we extend the EAV-tupleinto an EAVT-tuple containing the transaction-id (T) that introduced the tuple: [;; E A V T [12345, :attribute1, "value1", 500], [12345, :attribute2, "value2", 500]] AccumulativeTo make the EAVT data-model accumulative, we extend the EAVT-tuplewith a final flag that indicates if the EAV information was added or removedat the transaction-id (T). [;; E A V T added? [12345, :attribute1, "value1", 500, true], [12345, :attribute2, "value2", 500, true]] Under this model, common data operations (create, update, delete) are represented like this:
[[12345, :attribute1, "create entity 12345 with field :attribute1 at transaction 500", 500, true]]
[[12345, :attribute1, "create entity 12345 with field :attribute1 at transaction 500", 501, false]]
[ ;; At transaction 502 ;; invalidate the old entry for :attribute2 [12345, :attribute2, "old-value", 502, false] ;; add a new entry for :attribute2 [12345, :attribute2, "new-value", 502, true]] The complete history of the database is the cumulative list of these tuples. Atomic ConsistencyData-updates are submitted as transactions that are processed atomically.This means that when you submit a transaction, either all the changes inthe transaction are applied, or none of the changes are applied. TransactionsTransactions are submitted as a list of data-modification commands. The simplest data-modification commands ( [ [:db/retract 12345 :attribute2 "old-value"] [:db/add 12345 :attribute2 "new-value"]] When this transaction is committed it will produce the following tuples in the database history(where [ [12345, :attribute2, "old-value", <next-tx>, false] [12345, :attribute2, "new-value", <next-tx>, true]] Using Object/Map form in transactionsIn addition to the command-form, you can also create/update data using theobject/map form of an entity: [ {:db/id 12345 :attribute1 "value1" :attribute2 "value2"}] This form is equivalent to the command-form: [ [:db/add 12345 :attribute1 "value1"] [:db/add 12345 :attribute2 "value2"]] SchemasBecause all stored data reduces to EAVT tuples,schemas are defined per Attribute, rather than per Entity. Schemas definitions are simply Entities that have special schema-attributes. Defining the schema for |
请发表评论