This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-12-14
Channels
- # adventofcode (107)
- # aleph (1)
- # announcements (8)
- # beginners (57)
- # boot (3)
- # braveandtrue (18)
- # calva (374)
- # cider (6)
- # cljdoc (8)
- # cljs-dev (140)
- # clojure (199)
- # clojure-berlin (5)
- # clojure-europe (3)
- # clojure-finland (1)
- # clojure-hamburg (4)
- # clojure-italy (17)
- # clojure-nl (16)
- # clojure-spec (2)
- # clojure-uk (70)
- # clojurescript (29)
- # component (2)
- # cursive (10)
- # datomic (44)
- # docker (1)
- # figwheel (3)
- # fulcro (13)
- # immutant (2)
- # juxt (5)
- # leiningen (53)
- # nrepl (3)
- # off-topic (7)
- # pedestal (3)
- # re-frame (7)
- # ring (3)
- # ring-swagger (5)
- # rum (5)
- # shadow-cljs (14)
- # spacemacs (6)
- # specter (12)
- # tools-deps (11)
- # unrepl (11)
- # vim (7)
I'm trying to write a transaction function that links two entities together via a :ref
, but one or both of the entities may not already exist in the db at the time this runs. I was hoping the upsert behavior would allow me to ignore whether they exist or not, but I'm getting
java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: :db.error/not-an-entity Unable to resolve entity:
I'm using a lookup ref on an identity/unique attribute in the entity and value positions.if I can't abstract over entity existence, what's the idiomatic way to check if the target entity existed from the result of a pull expression?
but you can do e.g. [[:db/add "e1" :ident1 "id1"] [:db/add "e2" :ident2 "id2"] [:db/add "e1" :ref "e2"]]
I’m just using the schema from tomjack. :ref
is a :db.type/ref
attribute
[{:db/ident :ident1
:db/cardinality :db.cardinality/one
:db/valueType :db.type/string
:db/unique :db.unique/identity}
{:db/ident :ident2
:db/cardinality :db.cardinality/one
:db/valueType :db.type/string
:db/unique :db.unique/identity}
{:db/ident :ref
:db/cardinality :db.cardinality/one
:db/valueType :db.type/ref}]
that's interesting. I wonder if there's a technical reason why lookup refs can't work in this case.
I wanted to do it that way so the tx fn could accept anything valid to identify an entity, so I guess lookup ref or entity id at this point, and pass it through to Datomic without introspecting to figure out which type it was
given the existence of the "default partition" (and lack of partitions in cloud) it would seem reasonable to me
ro6: I’ve always wished idents would eval to temp ids as well as entity ids, would be really cool
there’s a case where the semantics might be confusing though (imo)
[[:db/retract [:ident1 "thing"] :ident1 "thing"]
{:thing1 "thing" .. other stuff ..}
{:thing1 "other" :ref [:ident1 "thing"]}]
currently, that ref would always point to the “old” thing
is that :ref
thing really valid syntax?
What do I miss out on when if I use cloud Datomic. I'm aware of: 1. No excision 2. No backup/restore 3. Lambda cold starts (> 10 seconds) What else could be a pain point? I'm not trying to be negative. Everything is a tradeoff. I just want to go in with my eyes open.
Nothing in the Peer library that isn't also in the Client lib, so the entity
api and multi-database queries
The cold start thing is surmountable. In the early stages you can just hit the endpoint periodically to keep it warm (I actually have an endpoint called /keep-warm
), and I think they are working on a direct link from API Gateway to the EC2 instances that would bypass Lambda, and make $ sense as you scale.
I really like the lambda idea, but I think a lot of the slowdown is because the lambda is inside the VPC. could be wrong
I’ve tested this and you can see the ENI init is approx 8 secs, the other 8 is the lambda. I consistently see 16 sec cold starts.
after the first one, other lambdas start in approx 8 secs i.e. ENI is already in place
if Ions stop using Lambda we will still have ENI cold start but that will be once and, with any active app, that will be almost never
presumably that’s just by how Lambda, the Ultimate is implemented and could be optimized a lot further
it seems like the lambda code itself would be the simplest part to optimize since it’s just a data transform layer depending on the type of event.