dirsql 0.4.16 → 0.4.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/howto/persist.md +13 -0
- package/docs/reference/path-tables.md +14 -6
- package/package.json +6 -6
package/docs/howto/persist.md
CHANGED
|
@@ -55,6 +55,19 @@ can't be trusted at all — the table/ignore configuration changed, or the
|
|
|
55
55
|
automatically. You never need to delete it by hand; a full rebuild costs
|
|
56
56
|
exactly what a non-persistent startup does.
|
|
57
57
|
|
|
58
|
+
A run that changes nothing writes nothing: the cache file is read and left
|
|
59
|
+
exactly as it was.
|
|
60
|
+
|
|
61
|
+
This covers both kinds of table. Declared tables keep their indexed rows, and
|
|
62
|
+
a [path-table](../reference/path-tables.md) parsed with `--on-file` keeps each
|
|
63
|
+
file's parser output — so the second run over an unchanged tree spawns no
|
|
64
|
+
parser process at all. A path-table's cached rows are keyed by the tree, the
|
|
65
|
+
glob, the parser command and the `dirsql` version together, so changing any of
|
|
66
|
+
them parses afresh rather than serving rows the current command never
|
|
67
|
+
produced. A *stat* path-table caches nothing, because there is nothing to
|
|
68
|
+
save: its columns are the metadata the scan already collected, and `content`
|
|
69
|
+
is read live by design.
|
|
70
|
+
|
|
58
71
|
Persistence is a startup-time optimization, not a change in meaning: the
|
|
59
72
|
database remains a derived view of your files, and queries return the same
|
|
60
73
|
rows either way ([how `dirsql` thinks](../explanation.md)).
|
|
@@ -140,6 +140,12 @@ the table:
|
|
|
140
140
|
scan continues. The schema is inferred from the files that did parse.
|
|
141
141
|
- **The skip rules still apply.** A parsed scan honors the same `node_modules`
|
|
142
142
|
/`.git`/`ignore` rules a stat scan does (see below).
|
|
143
|
+
- **`--persist` skips the parser for unchanged files.** With a
|
|
144
|
+
[persistent cache](/howto/persist), each file's parser output is stored
|
|
145
|
+
against its stat metadata, so a later run over an unchanged tree serves the
|
|
146
|
+
rows from the cache and spawns no process. Change the file, the glob, the
|
|
147
|
+
parser command, or the dirsql version and that file (or that whole table) is
|
|
148
|
+
parsed again.
|
|
143
149
|
|
|
144
150
|
`--on-file` applies to **every** path-table in the query and may be given **at
|
|
145
151
|
most once**. For different parsers per file set, define named tables in a
|
|
@@ -160,15 +166,17 @@ deleted *after* the scan finds it but *before* its `content` is read yields
|
|
|
160
166
|
than failing the query. This is an accepted consequence of reading live, not a
|
|
161
167
|
bug to design around.
|
|
162
168
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
169
|
+
The table itself is per-connection: it lives in `temp`, so it cannot leak into
|
|
170
|
+
`sqlite_master` or survive a restart. Under `--persist` a *parsed* table's rows
|
|
171
|
+
outlive the connection in the cache (above), but the table is still minted
|
|
172
|
+
fresh each run and the scan still decides what exists. The reserved top-level
|
|
173
|
+
`.dirsql/` directory is excluded from the scan, as everywhere else.
|
|
166
174
|
|
|
167
175
|
### When to promote to a declared table
|
|
168
176
|
|
|
169
|
-
Every query re-scans the filesystem: a path-table has no index
|
|
170
|
-
|
|
171
|
-
|
|
177
|
+
Every query re-scans the filesystem: a path-table has no index and no watcher.
|
|
178
|
+
That is the right trade for a hundreds-of-files, run-it-once question. When the
|
|
179
|
+
same tree is queried repeatedly, or is large, declare a
|
|
172
180
|
[table](/reference/config) for it instead — a declared table is indexed on
|
|
173
181
|
build, kept fresh by the watcher, and (with `--persist`) survives restarts, so
|
|
174
182
|
its rows are read from SQLite rather than re-walked each time.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dirsql",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.17",
|
|
4
4
|
"description": "Ephemeral SQL index over a local directory",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "https://github.com/thekevinscott/dirsql",
|
|
@@ -213,10 +213,10 @@
|
|
|
213
213
|
]
|
|
214
214
|
},
|
|
215
215
|
"optionalDependencies": {
|
|
216
|
-
"@dirsql/lib-linux-x64-gnu": "0.4.
|
|
217
|
-
"@dirsql/lib-linux-arm64-gnu": "0.4.
|
|
218
|
-
"@dirsql/lib-darwin-x64": "0.4.
|
|
219
|
-
"@dirsql/lib-darwin-arm64": "0.4.
|
|
220
|
-
"@dirsql/lib-win32-x64-msvc": "0.4.
|
|
216
|
+
"@dirsql/lib-linux-x64-gnu": "0.4.17",
|
|
217
|
+
"@dirsql/lib-linux-arm64-gnu": "0.4.17",
|
|
218
|
+
"@dirsql/lib-darwin-x64": "0.4.17",
|
|
219
|
+
"@dirsql/lib-darwin-arm64": "0.4.17",
|
|
220
|
+
"@dirsql/lib-win32-x64-msvc": "0.4.17"
|
|
221
221
|
}
|
|
222
222
|
}
|