Fork me on GitHub
#datomic
<
2019-08-24
>
George Ciobanu17:08:25

Sorry for double posting I just wanted to see if anyone has thoughts on this

George Ciobanu17:08:30

Hi! I am trying to model a tree of components (Page, button group, tab, buttons etc) as a hierarchy of maps (each component has a bunch of attributes). It's very similar to the DOM in that if the user deleted a tab group that has buttons as children, the buttons need to be deleted as well. Of course, the user can also move a subtree of components to a different nodes etc. It's a standard GUI editor. I think the best way to model this is to make each node a component so that if any node is deleted its children are deleted as well. Does that make sense? Are there any subtleties I'm missing, and should I manage deletion and the whole hierarchy by hand using plain ref types? Any thoughts much appreciated. A link to an article is also fine (I tried to RTFM but I never saw anyone use components for hierarchies and am wondering why).

favila18:08:50

This might be a fit, but generally IsComponent is used to reference an entity which doesn’t have an identity at all apart from its parent

favila19:08:25

Dataomic assumes (but does not enforce) that if there’s an assertion [e iscomponentattr component-e], this is the only datom in the entire db with Component-e in the v slot

favila19:08:23

At least the d/entity api will also make the reverse-ref of an attr not-a-collection for this reason (even if there is in fact more than one entity pointing to it!)

favila19:08:53

You should be careful with “reparenting” a node via an IsComponent attr because you can end up violating this constraint by accident

favila19:08:41

You will need a transaction function

George Ciobanu19:08:52

Thank you Favila much appreciated. I couldn't find documentation about the assumption you mention, any chance you have a handy link?

George Ciobanu20:08:40

Specifically I'm thinking of this: Components allow you to create substantial trees of data with nested maps, and then treat the entire tree as a single unit for lifecycle management (particularly retraction). All nested items remain visible as first-class targets for query, so the shape of your data at transaction time does not dictate the shape of your queries. This is a key value proposition of Datomic when compared to row, column, or document stores.

George Ciobanu20:08:59

"all nested items remain visible..."

favila15:08:52

It’s not explicitly stated that way anywhere to my knowledge but it’s an inevitable consequence of the special behavior IsComponent attrs get: 1) retractEntity deletes them even if other entities reference them ; reverse-ref in entity and pull doesn’t show all reverse refs only the first one; pull * and d/touch eagerly follow and load the value of those references

Mark Addleman19:08:49

Trying to deploy an ion to a new Datomic Cloud instance in a new AWS account. The deploy step is failing and Cloudwatch logs reports

{
    "errorMessage": "No Deployment Group found for name: mbsolo-Compute-KLOG23BUPMGI",
    "errorType": "DeploymentGroupDoesNotExistException",
    "stackTrace": [
        "Request.extractError (/var/runtime/node_modules/aws-sdk/lib/protocol/json.js:51:27)",
        "Request.callListeners (/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:106:20)",
        "Request.emit (/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:78:10)",
        "Request.emit (/var/runtime/node_modules/aws-sdk/lib/request.js:683:14)",
        "Request.transition (/var/runtime/node_modules/aws-sdk/lib/request.js:22:10)",
        "AcceptorStateMachine.runTo (/var/runtime/node_modules/aws-sdk/lib/state_machine.js:14:12)",
        "/var/runtime/node_modules/aws-sdk/lib/state_machine.js:26:10",
        "Request.<anonymous> (/var/runtime/node_modules/aws-sdk/lib/request.js:38:9)",
        "Request.<anonymous> (/var/runtime/node_modules/aws-sdk/lib/request.js:685:12)",
        "Request.callListeners (/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:116:18)"
    ]
}
Weirdly, when I look in the AWS CodeDeploy Console, I see mbsolo-Compute-KLOG23BUPMGI listed in the deployment group.

Mark Addleman19:08:07

Just noticed that the push operation reported an empty :deploy-groups list.

{:rev "5c79aede20d112c7ebbdc8a9a65514451a2a6f19",
 :deploy-groups (),
 :dependency-conflicts
 {:deps
  {com.cognitect/transit-java #:mvn{:version "0.8.311"},
   org.clojure/clojure #:mvn{:version "1.10.0"},
   commons-codec/commons-codec #:mvn{:version "1.10"},
   org.clojure/tools.analyzer.jvm #:mvn{:version "0.7.0"},
   com.fasterxml.jackson.core/jackson-core #:mvn{:version "2.9.8"},
   com.google.guava/guava #:mvn{:version "18.0"},
   org.msgpack/msgpack #:mvn{:version "0.6.10"},
   com.cognitect/transit-clj #:mvn{:version "0.8.285"},
   com.cognitect/s3-creds #:mvn{:version "0.1.23"},
   org.clojure/tools.reader #:mvn{:version "1.0.0-beta4"},
   org.clojure/test.check #:mvn{:version "0.9.0"},
   com.amazonaws/aws-java-sdk-kms #:mvn{:version "1.11.479"},
   org.clojure/core.async #:mvn{:version "0.3.442"},
   com.amazonaws/aws-java-sdk-s3 #:mvn{:version "1.11.479"}},
  :doc
  "The :push operation overrode these dependencies to match versions already running in Datomic Cloud. To test locally, add these explicit deps to your deps.edn."},
 :deploy-command
 "clojure -Adev -m datomic.ion.dev '{:op :deploy, :group <group>, :rev \"5c79aede20d112c7ebbdc8a9a65514451a2a6f19\"}'",
 :doc
 "To deploy, issue the :deploy-command, replacing <group> with a group from :deploy-groups"}

Mark Addleman19:08:54

From the thread, it looks like the solution is to create a new AWS account but it would be helpful to open an AWS support ticket.

Mark Addleman19:08:35

@U1QJACBUM Can you confirm this is the same problem? If so, I could use some guidance on what to put in the support ticket

Mark Addleman21:08:34

I found the problem (spolier: It's my own fault): I had two ion-config.edn files - one in the proper place and the one that I was editing in the wrong location. The one in the proper place had an app-name pointing to an old and deleted cloud stack.

jaret01:08:06

Ah! That would do it. Sorry I didn’t see this until Today Mark.

🙂 4
Mark Addleman15:08:29

No worries 🙂

Mark Addleman15:08:15

I noticed there are a lot of resources not cleaned up when a stack is deleted. Do you guys have much control over that?