为什么在尝试删除数据数据库时出现 http 错误?

Why am I getting http-error when trying to delete a datomic db?

我试图删除 datomic repl 中的一个 datomic 数据库。我有事务处理程序和对等服务器 运行,并且正在使用客户端 api。这是我在回复中所做的:

(require '[clojure.core.async :refer [<!!]]
         '[datomic.client :as client])

(use 'datomic.client.admin)

(pprint (<!! (delete-database 
    {:db-name "datemo"
     :account-id client/PRO_ACCOUNT
     :secret "datemo"
     :region "none"
     :endpoint "localhost:8998"
     :service "peer-server"
     :access-key "datemo"})))

我得到的错误如下所示:

{:cognitect.anomalies/category :cognitect.anomalies/incorrect,
 :datomic.client/http-error {:cause "Invalid Op"}}

docs for the datomic client 调用上面提供的参数映射。他们似乎还建议所需的参数是 :db-name,但如果我这样做:

(pprint (<!! (delete-database {:db-name "datemo"})))

我收到一条错误消息,指出 "connection config" 无效:

#:cognitect.anomalies{:category :cognitect.anomalies/incorrect,
                      :message
                      "Incomplete or invalid connection config: {:timeout 60000, :account-id \"00000000-0000-0000-0000-000000000000\", :access-key \"datemo\", :secret \"datemo\", :endpoint \"localhost:8998\", :service \"peer-server\", :region nil, :db-name \"datemo\"}"}

知情人的回答:

Peerserver can’t delete or create databases. Since a single peerserver could be connected to multiple transactors/backend storages at once the semantics aren’t clear what ‘create’ would mean - which backend should it use for example?

客户端 API 无法创建和删除数据库,因为对等服务器不拥有数据库。客户端 API 与对等服务器通信,因此客户端 API 不会创建或删除。您将要使用对等库来创建或删除。

http://docs.datomic.com/clojure/#datomic.api/delete-database http://docs.datomic.com/clojure/#datomic.api/create-database

Datomic 文档中的本地开发设置教程使用了 peer api 并且在 datomic 示例中也有使用 peer api 的示例:

http://docs.datomic.com/dev-setup.html#create-db https://github.com/Datomic/day-of-datomic