Expand description
The home screen: pick a dataset without first knowing where it is.
It lists roots (places to look) and catalogs (named datasets and directories):
- The working directory.
- Catalogs:
catalog.toml(Ctrl+D adds to it), the filescatalogslists, and the bundledpubliccatalog. A directory in one is a row to step into.
RECENT lists every dataset opened, grouped under the directory or prefix it
lives in; Enter on such a place row browses it. It is derived state, cheap to
rebuild or discard.
Modules§
- catalog
- Catalogs: named datasets, local or remote, one TOML file each.
- codebook
- A catalog dataset’s documentation: what its columns mean, in their publisher’s words.
- discover
- Dataset discovery for the home screen. Not a catalog: listings are computed from
the filesystem when asked and forgotten at session end; between runs datui keeps
only recent paths and measured shapes (
remembered, valid while the files are unchanged). Every function scans one directory level, since data lives on slow mounts and huge partition trees. - fuzzy
- Fuzzy matching scored as fzf scores it, so ranking matches the finder people already
know (
fzf,fzf-lua, Telescope’s fzf-native andsnacks.picker, a port offzf/src/algo/algo.go, all agree). The scoring constants are fzf’s: - home_
preview - The home screen’s
ROWSpreview: the first rows of the selected file, read the way the open reads them and handed to the open as its first page (#547 M4). - locality
- Where a dataset physically lives, and what that implies about opening it (2 GB on
tmpfs and on hotel-wifi NFS are the same row and a thousandfold apart). Derived from
/proc/self/mountinfo, a kernel-generated local read that cannot block on a share that stopped answering. - search
- Recursive search for datasets below a directory: one bounded background walk of the
working directory, its results filtered in memory like listed rows; nothing repeats
per keystroke. Every limit exists because some real directory needs it (see
Limits). The walk keeps every data file, scored off the UI thread (score); the listing cap counts matches, so a match is never lost behind non-matches.
Structs§
- Catalog
Places - The catalogs’ datasets and bookmarks indexed by place, for per-row lookups.
- Cloud
Source - One cloud source on home: a row under
CLOUDand its bucket list. Kept apart fromSectionto survive rebuilds: re-listing buckets would be a billed round trip per keystroke. - Hit
- How a row answers the filter: its score, and whether its name or a column matched. Scored when rows are listed; the matched characters are found when drawn, for the rows on screen rather than every row of thousands.
- Home
State - Home screen state.
- Listing
- What a listing pass produced.
- Listing
Request - Everything
build_listingneeds, gathered on the UI thread so the worker never reaches into the app. - Mark
- Where the cursor was in a listing the user went inside from, by row identity: the listing is rebuilt on a worker and may change.
- Measured
- What measuring a dataset yielded; each part absent when unknowable without reading the data.
- Narrowed
- What a cut-short cloud directory holds under one name prefix, asked of the server for a typed filter.
- Path
Listing - What the
~prompt lists: the directory part of what is typed, and what is in it. - Path
Name - One name in the directory the
~prompt is typing. - Probes
- Every probe, by the place it lists.
- Root
- A place datui will look, and whether it can currently be read.
- RowLabel
- What a home row is called, decided once for the list and the pane beside it.
- Rows
Cache HomeState::visible’s rows, cached until their inputs change: building scores every row and sorts each section, and every pass reads them.HomeState’s own row-changing methods drop it; fields set elsewhere (filter, sort, folds) are compared on every read.- Score
Job - What a worker needs to score the filter against a walk’s files.
- Search
State - One recursive walk below the working directory. Kept apart from
sections, which rebuild often: re-walking each time would cost per keystroke. - Section
- A titled group of rows on the home screen.
- Shown
Catalog - A catalog as the home screen shows it: a section of named datasets, local and remote alike.
- Shown
Dataset - One dataset of a
ShownCatalog.
Enums§
- Cloud
Look - A directory in an object store that has not said what it holds yet.
- Cloud
Status - Where a cloud source’s listing stands.
- Door
Kind - What a directory’s door opens, from the kind and the tally already in hand.
- Probe
- Where the listing of one network root or remote directory stands; read off the UI
thread (see
HomeState::pending_probes). - Root
Origin - Where a root came from, shown subtly in the UI.
- Row
- One line of the home screen; headers are selectable to fold. Places and
morerows are view rows, not entries: anEntry’s kind triggers probes, measurement and caching, none of which may happen to a place. - RowKey
- A row’s identity apart from its index, to find it again after a rebuild or a cap
change: the cursor’s index points at different rows whenever a listing lands or
the terminal resizes, which would make
Enteropen the wrong row. - Sort
Mode - How rows are ordered within each section.
Constants§
- BUNDLED_
ORIGIN - The chip on the bundled catalog’s section.
- CATALOG_
ORIGINS - The chips a catalog’s section carries, and nothing else does.
- CLOUD_
PLACE - How a cloud source is addressed on home:
cloud://<id>, naming the level above its buckets, which no real URL can.
Functions§
- build_
listing - Build the home listing. A free function so it runs on a worker: it is home’s only filesystem access, and a wedged mount, FIFO or failing disk blocks here, so never call it from the drawing thread.
- catalog_
entry_ for - The catalog entry
pathis or is inside, with its catalog’s label: the innermost, or the first listed of two at one place. - catalogs
- The catalogs home shows, in order. The bundled catalog keeps only what this build can open (all its datasets are remote); a user’s catalog is shown whole. An empty catalog has no section.
- cloud_
account - The source ID and account of a
cloud://<id>/<account>place: an Azure storage account, which has no URL of its own. - cloud_
place - The place for one cloud source.
- cloud_
source_ id - The source ID of a
cloud://<id>place. - codebook_
for - The column notes of the catalog dataset
pathis or is inside (the innermost), among datasets with notes. - complete_
path - Complete a partly typed path against its directory: the longest unambiguous
extension of
typedand the candidate count. Reads a directory, so only on a worker. - describe
- What
entryis called.lookis a bucket directory’s look-up state, drawn at spinnerframe;known_sourcesare the sources a URL can name,Nonewhere the trail already names it. - desktop_
recent_ dirs - Directories holding data files the desktop recorded you opening
(
recently-used.xbel), so a fresh install has places to suggest. Only the directories are used, never the files: the list holds whatever was opened anywhere, which may be private. - directory_
dataset_ url - The URL that opens a cloud directory as one dataset: with a trailing slash, so it is scanned as a prefix rather than fetched as an object.
- dirs_
from_ xbel - Extract directories of data files from XBEL content. Scans for
href="file://…"rather than parsing XML, to avoid an XML dependency. - display_
path - Abbreviate a path with
~for display. - door_
kind - Which
DoorKinda door is. A directory the footers or headers turned down as one table isDirectorywith one format in its tally; the listing alone calls itMultiFile. - door_
lands - Whether stepping into a directory puts the cursor on its door: only when the door
opens the one dataset the directory’s own
Enteropens; elsewhere it would start an unasked combined read. - door_
name - The door’s name: the directory, and what
Enteron it opens. - door_
reads - What
Enteron a door that is not one table reads and leaves out, for the details pane. Locally: the commonest format’s files directly inside, or a whole Parquet scan when there are subdirectories or no own files. In an object store: the prefix scanned whole in its commonest format. - expand_
user_ path - Expand
~and$VARin a path the user typed. - facts_
for - The record to keep for a row that has just been measured.
- fuzzy_
positions - Character positions in
haystackthatneedlematched, from the same alignment that scored it. - fuzzy_
score - Whether and how well
needlematcheshaystack(higher is better), throughcrate::home::fuzzy::best_matchlike every ranking and highlight. - holds_
nothing_ to_ open - Whether a directory holds nothing a
(all files)row could read. Shared by the door and the details pane so they agree. - index_
key - The key a record about
pathis filed under in the dataset index. Opens record under the resolved URL (s3://bucket/xfors3://lab@bucket/x, oneabfss://spelling for Azure) while recents are stored as typed; both must meet here. - is_
catalog_ origin - Whether a section’s origin chip says it is a catalog.
- is_
cloud_ place - Whether
pathis one of datui’s owncloud://places rather than a real location. - is_
network_ path - Whether
pathis on a network filesystem by the mount table (longest matching mount point). False where the table is unavailable: a hint, never a gate. Usescrate::home::locality::Mounts::cached, since this is asked per row per frame. - is_
object_ store_ url - Whether
pathis a place in an object store:s3://,gs://, or Azure. - is_
remote_ path - Whether reading
pathcould block: an object-store or HTTP URL, or a network filesystem. Decides what home may touch on the UI thread; answered from the string and mount table alone. - list_
typed_ dir - A local directory typed at
~, for the prompt’s list; reads it, so runs on a worker. Nothing typed lists the working directory. - login_
of - How a catalog URL is read, in words: what
authandconnectionsay. - look_
into_ as - Find out what a row is, then what is in it, in one pass on the same filesystem
(
measure_rowdoes nothing for a plain directory), reading files as the following open will: the command line passes the user’s reader settings; listing passes use the defaults, as a home open does. - look_
into_ batch - Look into a batch of rows on a worker, passing each answer to
eachand caching what was learned. Shared by the measure and classify passes. Every row is classified before any is measured: a kind is one directory read, a count up to sixty-four footers. - match_
hit match_score, with what the row is marked by when drawn.- match_
score - How well an entry answers the filter, by name or by column (the footer’s column
names: “which has a
customer_id?”). A name match always outranks a column match. Higher is better, as in fzf; seecrate::home::fuzzy. - matching_
column - The first column of
entrycontainingfilter, case-insensitively. Substring, not subsequence: fuzzy matching dozens of names matches nearly everything. - measured_
from - Fold a measured probe into the record kept for a row.
- name_
by_ spec - Name files a format spec’s glob matches as data, under the spec’s name, from the name alone. Files a spec’s magic matches were named by the scan’s sniff.
- names_
a_ file - Whether a remote path’s name says it is a file: a data extension or any dot in its last segment. A trailing slash is always a prefix.
- names_
under - The names one level below
diramongurls: hows3://,gs://andaz://complete, from what was listed, opened or cataloged. Nothing is asked of the store. - object_
place_ label - The service’s word for the top of an object-store place: a source, account,
bucket or container.
Noneotherwise, including directories inside a bucket, which are labeled by their contents like local ones. - parent_
location - The location one level up from
path, orNoneat the top. A URL’s top is its bucket or host (Path::parentwould makegs://bucketintogs:). - place_
is_ browsable - Whether a place can be listed: a directory or an object-store prefix. An HTTP server has no listing, so a URL recent’s place is a heading, not a door.
- place_
of - The place a recent lives in: its directory or object-store prefix; a bare bucket or host is its own place.
- substring_
positions - Character positions of the first case-insensitive occurrence of
needle, since column matching is a substring test. - typed_
dir - The directory part of a typed path, through its last separator; for a URL at
least its scheme (
s3://), so buckets list under it. - typed_
dir_ is_ url - Whether a typed directory is a URL, listed from what datui knows rather than read.