             :leaf (= depth parts-count)})
          (range 1 (inc parts-count)))))
 
-(defprotocol PathStore
-  (insert [this tenant path])
-  (exist? [this path])
-  (shutdown [this]))
+(defn- constuct-id
+  "Construct ID."
+  [path tenant]
+  (str path "_" tenant))
 
 (defn elasticsearch-metric-store
   "Elasticsearch path store."

                :properties {:tenant {:type "string" :index "not_analyzed"}
                             :path {:type "string" :index "not_analyzed"}}}})

(defn get-all-paths
  "Get all paths."
  [tenant path]
  (let [parts (str/split path #"\.")

      PathStore
      (insert [this tenant path]
        (try
          (dorun (map #(let [id (constuct-id (:tenant %) (:path %))]
                         (when-not (exists-fn id)
                           (update-fn id %)))
                      (get-all-paths tenant path)))
          (catch Exception e
            (wlog/error "Path store error: " e))))
      (exist? [this tenant path]
        (try
          (exists-fn (constuct-id tenant path))
          (catch Exception e
            (wlog/error "Path store error: " e))))
      (shutdown [this]
