Skip to content
shlomi-nx edited this page Aug 18, 2018 · 5 revisions

Papiea is a general purpose intent engine. It helps to manage state when it is composed of many different systems and environments.

Basic concepts

  1. Entities - the basic unit of state is an entity. An entity is composed of 3 descriptions:

    1. Metadata - where the entity's identity is kept. Such as its uuid, and version
    2. Spec - a map representing the intended state of this entity
    3. Status - a map that represents the actual current state of this entity. It must be a superset of Spec
  2. Entity prefix - an entity prefix is the path taken starting the root of the State map (see below) to get to the list of entities of the same kind. It could be thought of as the type or kind of the entity. A prefix is effectively a list of strings, allowing for a notion of hierarchy.

  3. State map - The state map is the logical repository which keeps track of all entities. Every entity kind will have its own prefix.

  4. Provider - a provider supplies ACID functionality per each prefix (See Provider wiki page)

Example of a State map

{:filesystem {:files [{:metadata {:uuid         "1"
                                  :spec_version 0}
                       :spec     {:path "/usr/bin"
                                  :name "ls"}
                       :status   {:path "/usr/bin"
                                  :name "ls"}}
                      {:metadata {:uuid         "2"
                                  :spec_version 2}
                       :spec     {:path "~/bin"
                                  :name "lein"}
                       :status   {:path "~/bin"
                                  :name "lein"}}]
              
              :block-devices [{:metadata {:uuid         "3"
                                          :spec_version 0}
                               :spec     {:dev  "/dev/sda"
                                          :size {:amount 10
                                                 :weight :gib}}
                               :status   {:dev  "/dev/sdb"
                                          :size {:amount 750
                                                 :weight :mib}}}]}}

In this examples we see there are two prefixes possible: [:filesystems :files] and [:filesystems :block-devices]

Clone this wiki locally