Commit graph

158 commits

Author SHA1 Message Date
Nick Alexander
a4dd7e4e9c Review comment: make a large-ish dropping buffer for JS listen! consumers. 2016-10-13 16:11:22 -07:00
Nick Alexander
032bfafec2 Review comment: fail pending transactions after closing connection.
This is pretty difficult to test robustly, but here's a stab at it.
2016-10-13 16:11:22 -07:00
Nick Alexander
f02d508370 Review comment: ensure <transact! after <close is rejected. 2016-10-13 16:11:22 -07:00
Nick Alexander
b20c70fc2a Review comment: ensure report is non-nil after in-transaction!. 2016-10-13 16:11:22 -07:00
Nick Alexander
cea0e3d60f Review comment: return pair-chan; accept a result chan and close? flag. 2016-10-13 16:11:22 -07:00
Nick Alexander
e5917406b4 Add {un}listen{-chan}! to connection. (#61) 2016-10-13 16:11:16 -07:00
Nick Alexander
a8ad79d0e6 Make <transact! run in a critical section. (#80) 2016-10-11 20:32:35 -07:00
Nick Alexander
2081ca4563 Pre: Add unlimited-buffer and unblocking-chan?. 2016-10-11 20:32:35 -07:00
Nick Alexander
e1b1abe2de Pre: clarify comments. 2016-10-11 20:32:35 -07:00
Richard Newman
c36be57018 Expose a 'tempid' function on transaction results, because JS object lookup doesn't work for TempIds. 2016-10-07 20:12:17 -07:00
Richard Newman
5b6000003d Support order-by query option from JS. 2016-10-07 20:12:17 -07:00
Richard Newman
e89544beba Implement all four find specs. Fixes #38. r=nalexander 2016-10-07 11:02:35 -07:00
Richard Newman
021f2be620 Review comment: add comment about cljify. 2016-10-05 14:07:07 -07:00
Richard Newman
61757e271c Review comment: use datomish.api where possible. 2016-10-05 14:06:36 -07:00
Richard Newman
c7d0a8596b Part 2: extend 'cljify' implementation to round-trip records like TempId. 2016-10-05 12:54:26 -07:00
Richard Newman
0b6ac81ed5 Part 1: extend 'db' JS object with more useful methods. 2016-10-05 12:53:57 -07:00
Richard Newman
b777445ebf Sort variable sets to make tests consistent across platforms. 2016-10-04 11:38:14 -07:00
Nick Alexander
3cd64fb4d8 Review comments. 2016-09-30 17:00:27 -07:00
Nick Alexander
611d44fcce Process lookup-refs in batches. Fixes #25.
This uses a common table expression and multiple SQL calls rather than a
temporary table, since transactions with huge numbers of distinct
lookup-refs are likely to be very rare.

We mark lookup-refs with `lookup-ref`, which is a little awkward because
binding `(let [[a v] lookup-ref] ...)` doesn't directly work, but avoids
some ambiguity present in Datomic and DataScript around interpreting
lookup-refs as multiple value lists.  (Which bit the tests in an earlier
version of this patch!)
2016-09-30 16:47:04 -07:00
Nick Alexander
20531c1789 Pre: Don't insert nil tx where it should not be. 2016-09-30 16:47:04 -07:00
Nick Alexander
c46f0eb8ae Part 2: Get rid of {0, 1} -> {2, 3} mapping for added/added0. Fixes #28.
Now that we copying from tx_lookup_before -> tx_lookup_after, we don't
need to avoid duplicating rows.
2016-09-30 16:47:04 -07:00
Nick Alexander
da1250d210 Part 1: Separate tx_lookup into tx_lookup_before and tx_lookup_after. 2016-09-30 16:47:04 -07:00
Richard Newman
a7d6a37cfc Update comment in cc.cljc. 2016-09-29 15:49:30 -07:00
Richard Newman
6ab93208cb Part 2: implement complex 'or' translation. Fixes #57. r=nalexander
We implement sql-projection-for-simple-variable-list to allow us to add
a projection to subqueries.
2016-09-29 15:46:15 -07:00
Richard Newman
b9b9c37dfa Part 1: pass in :select when creating a partial subquery from a CC. 2016-09-29 15:44:16 -07:00
Richard Newman
1296b8090f Allow sets of attributes in fulltext expressions. Fixes #54. r=nalexander 2016-09-26 16:34:37 -07:00
Richard Newman
9587311412 Include deps.cljs giving externs for Node.js consumers; normalize build output.
cljsbuild using leiningen projects that depend on Datomish will
automatically include the externs.
2016-09-22 16:24:37 -07:00
Richard Newman
d0a04a5e56 Review comment: extracted shared go-promise. 2016-09-22 16:24:37 -07:00
Richard Newman
17d7eaec7b Add a babelified test file, Webpack the add-on, and make the JS API work.
We concatenate a simple setTimeout monkeypatch onto the add-on itself.
2016-09-22 15:59:15 -07:00
Richard Newman
360f7622e8 Add handling of simple schemas. Fixes #53. 2016-09-22 15:59:15 -07:00
Richard Newman
4f37a86039 Use cljify in promise-sqlite. 2016-09-22 15:59:15 -07:00
Richard Newman
ea027e8cea Implement cljify. 2016-09-22 15:59:15 -07:00
Richard Newman
1d53d547b8 Externs. 2016-09-22 12:43:36 -07:00
Richard Newman
330433a45c Add externs file for Node's use of promise_sqlite. 2016-09-22 12:43:35 -07:00
Nick Alexander
1a30306314 Move datomish.api into exported namespace. 2016-09-19 12:03:09 -07:00
Richard Newman
b5aec2e890 Move src-node and src-browser into subdirectories of src. 2016-09-09 12:07:03 -07:00
Richard Newman
418bb34d57 Add is-node?. 2016-09-08 19:11:44 -07:00
Richard Newman
5ccc725b56 Flesh out JS API. 2016-09-08 19:11:44 -07:00
Richard Newman
9e4e95ce51 Default SQLite's user_version to zero.
I saw nil here with Sqlite.jsm.
2016-09-08 19:11:44 -07:00
Richard Newman
cc25ce33e2 Move platform-specific code into src-node. 2016-09-08 19:11:44 -07:00
Richard Newman
9dbda3d9d8 Pre: remove exec_repl.cljc. 2016-09-08 19:04:15 -07:00
Richard Newman
53322d8389 Pre: @arg -> @param to quiet cljsbuild warnings. 2016-09-08 19:04:15 -07:00
Nick Alexander
659c26339c Serialize and de-serialize non-keyword schema values correctly. Fixes #52. 2016-09-07 17:31:30 -07:00
Nick Alexander
362bdb2028 Add :db.fn/retractAttribute and :db.fn/retractEntity. Fixes #46.
There's no distinction made for fulltext attributes, since the values
found by the retractAttributes SELECT are already rowids into the
fulltext_values table and therefore need no additional mapping.
2016-09-06 13:13:20 -07:00
Nick Alexander
94bac9704b Pre: Use SQLite temp files in deftest-db.
These temp files will almost certainly live in memory only, speeding our
test suite evaluation significantly.  Before this patch, in a warmed
REPL environment I get:

Testing datomish.db-test

Ran 19 tests containing 97 assertions.
0 failures, 0 errors.
"Elapsed time: 1408.720681 msecs"
"Elapsed time: 1343.986464 msecs"
"Elapsed time: 1338.660762 msecs"

After this patch, in a warmed REPL environment I get:

Testing datomish.db-test

Ran 19 tests containing 97 assertions.
0 failures, 0 errors.
"Elapsed time: 587.605168 msecs"
"Elapsed time: 569.522333 msecs"
"Elapsed time: 589.080282 msecs"
2016-09-06 13:13:20 -07:00
Nick Alexander
cfdce12c1a Pre: Use deftest-db in tests. 2016-09-06 13:13:20 -07:00
Richard Newman
5424e61be4 Review comment: args -> inputs. 2016-09-02 16:23:30 -07:00
Richard Newman
1197764949 Implement :limit and :order-by-vars. Fixes #37.
We'd like this to be part of the query syntax itself, but doing so
requires extending DataScript's parser.

Instead we generalize our `args` to `options`, and take `:limit`
and `:order-by-vars`. The former must be an integer or nil, and the
latter is an array of `[var direction]` pairs.

This commit includes descriptive error messages and tests for success
and failure.
2016-09-02 08:32:45 -07:00
Nick Alexander
d92016166a Cache partition map and update materialized partition view once. Fixes #47.
This caches a partition map per DB, which is helpful because it exposes
what the point in time DB partition state is, but is unhelpful because
the partition state can advance underneath the DB cache.  This is
generally true of the approach -- this can happen to the ident/entid
maps, and the datoms themselves -- so we'll roll with it for now.

This reduces the number of SQL UPDATE operations from linear in the
number of id-literals used to constant in the number of known
partitions.
2016-09-01 14:46:04 -07:00
Nick Alexander
d419554361 Revert "Add Datomic, for testing."
This reverts commit 1b1cc6f18e.

This should never have escaped the lab; Datomic is not a dependency of
Datomish.
2016-08-31 16:17:08 -07:00