 (s/def ::changes
   (s/coll-of ::change-entry :kind vector?))
 
-;; Tablet node.
-(s/def :merkle-db/patch
-  (s/keys :req [::changes]))
+;; Patch tablet node data.
+(s/def ::node-data
+  (s/and
+    (s/keys :req [::changes])
+    #(= data-type (:data/type %))))
+
+
+
+;; ## Construction
+
+(defn from-changes
+  "Construct a patch tablet node data from a map of change data."
+  [changes]
+  {:data/type data-type
+   ::changes (vec changes)})
 
 
 
 ;; ## Utility Functions
-
-; (merge-patch patch-tablet pending) => patch-tablet
-; (apply-patch data-tree pending) => data-link
-
 
 (defn remove-tombstones
   "Returns a lazy sequence of record entries with tombstoned records removed."



(defn tombstone?
  "Returns true if the value x is a tombstone."
  [x]
  (identical? ::tombstone x))



;; ## Specs

;; Maximum number of changes to allow in a patch tablet.
(s/def ::limit pos-int?)



(defn filter-patch
  "Takes a full set of patch data and returns a filtered sequence based on the
  given options."
  [patch opts]
  (when (seq patch)
