Expand description
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.
Structs§
- Cost
- What pressing Enter on a dataset will cost (200 MB of zstd Parquet is gigabytes in memory, and NFS is not tmpfs), all from what datui already reads: the mount table and the footer.
- Entry
- One row on the home screen.
- Holds
- What one listing of a directory found, counted rather than judged. The row’s label
comes from here (
12 parquet), true whether or not the files are one table. - HowRead
- How opening a file row will read it. See
how_read. - Partitions
- How a hive dataset is laid out, from directory names alone.
- Rules
- Where the local and the bucket listings deliberately differ.
- Scan
- What one directory listing produced, and whether it saw all of it.
- Seen
- One entry of a listing, on disk or in a bucket, as
classifyasks about it. - TableOf
- What a row inside a file of tables says about its table.
Enums§
- Directory
Format - What the data files sitting directly in a directory say about how to read it.
- Entry
Kind - What a home-screen row represents.
- Sniffed
- What a listing finds a file to be by its first bytes.
Constants§
- CLASSIFIER_
VERSION - Bump whenever classification changes. A cached kind is restored without re-deriving it (a remote row cannot be read cheaply), so it is restored only when written by a build with the same version; measurements in the record (rows, columns, cost) survive regardless.
- MAX_
ENTRIES_ PER_ DIR - Upper bound on entries read from one directory, so a huge one cannot hang the UI.
- NO_
READER - What the home screen says of a file
unreadable_by_nameturns away.
Functions§
- classify
- A directory’s kind and holdings from one listing level: the one rule for
look_at_directoryand bucket prefixes, so a directory and its mirror agree;Rulesholds their differences. The caller sets truncation. - classify_
directory - Classify a directory without walking it: one listing bounded by
MAX_ENTRIES_PER_DIR(not a probe of the first few entries, whose answer would depend on read order). Includes rows on network mounts: onegetdentswalk, stat’ing only symlinks.home_open_selectedcalls it on the key thread; others on workers. - column_
names - Column names from a Parquet footer.
- data_
extension - The extension saying what a file is, past any compression suffix (
sales.csv.gzis CSV);Nonewhen not something datui reads. - data_
format - The format a file’s name says it holds, past any compression suffix. Extensions
are not formats (
.ipc,.arrow,.arrows,.featherare one); askingcrate::FileFormatkeeps home from listing what the reader cannot open. - database_
rows - A file of tables listed as rows (a database’s tables and views, an archive’s arrays), each at its path inside the file; SQLite’s own marked hidden.
- directory_
format - What
DirectoryFormatthe data files directly indiramount to. - enrich
- Fill in row and column counts from Parquet footers: one file, or a bounded sum for
hive and multi-file datasets. Non-Parquet keeps
None, a blank in the UI. - enrich_
as - As
enrich, reading files as the following open will: where the header is decides what the names are, so judging with other settings would misjudge (e.g.--no-header). - enrich_
parquet - Fill in a Parquet file’s counts from its footer, reading no column data. Other
formats keep
None(a CSV’s rows need a scan). - enrich_
tables - A file of tables’ tables (SQLite schema, NumPy archive directory): how many, whether
Enter opens one, and that one’s columns. A file whose bytes contradict its name (a
.dbthat is not SQLite) is unopenable. - enrich_
with - As
enrich_as, using the shape an open kept inrememberedwhile the files are unchanged, instead of sampling footers. - format_
age - Render “how long ago” compactly (
2d,3h). - format_
rows - Render a row count compactly (
2.4M). - has_
no_ extension - Whether a file’s name has no extension at all:
part-00000,LICENSE. - has_
parquet_ magic - Whether a local file is Parquet by its contents:
PAR1at both ends. - hive_
leaf_ format - What the files under a hive root’s partitions are.
directory_formatcan only sayDeeperof a root, so this follows one spine (the first partition at each level, as a hive scan reads its schema) to the bottom. A sample: disagreeing partitions report as the first one. - how_
read - How opening
entryreads it (crate::FileFormat::read_modefor its format and storage), and whether a remote one is downloaded first.Noneunless a file’s name says its format. - is_
bookkeeping - Whether a listing entry is bookkeeping: a leading
_or.(_SUCCESS,_committed_*,_metadata.json,.crc) or the_$folder$marker. One predicate for every listing and open, so they agree. - is_
data_ file - Whether a path looks openable by name or place (a part file in a
.parquetdirectory). Every route asks here so they agree. - is_
empty_ marker - An empty extensionless object: a tool’s folder marker (
yellow/year=2032), whether or not the folder still exists. Nothing datui opens is both empty and nameless. - is_
parquet_ key - Whether a key or path is Parquet: named
.parquet, or an extensionless part file in a.parquetdirectory (Spark, GBIF:occurrence.parquet/000001). Hidden and job files (_SUCCESS,.crc) are not. - is_
parquet_ path - Whether a path names a Parquet file, by extension or as an extensionless part file
in a
.parquetdirectory. Unlikeis_parquet_key, a writer’s own file (_manifest.parquet) counts: it can be opened, even if it does not make its directory a dataset. - is_
partition_ name - Whether a name is a hive partition (
year=2024):key=value, with a non-empty key. The value may be empty in practice. - look_
at_ directory - The kind (what
Enterdoes) and what the listing found (what the label says), from one read. - name_
spec_ file - Name
entrya file ofspec; a spec reading several record variants also makes it a place whose tables → lists. - name_
unlisted_ file - Name an unlisted local file row (a recent) by the spec that reads it, as a listing would: by glob, else by magic when its name says nothing.
- partition_
layout - Describe how a hive dataset is partitioned, from directory names alone.
- physical_
facts - Pull layout and compression from an already-read footer: what reading the file will do, beyond its size.
- scan_
dir_ progressive - List one directory with bounded work: one
read_dirand a stat per entry, up toMAX_ENTRIES_PER_DIR; errors give an empty listing. Nothing is classified: subdirectories returnEntryKind::Unknownand are looked into later from the viewport, so a label is a fact about the row, not its position.progressgets the rows read since the last call, everyLISTING_PROGRESS_EVERY, so a slow share shows rows as they arrive. - scan_
dir_ specs scan_dir_progressive, also naming sniffed files byformats’ magic.- schema_
preview - A dataset’s column names and types without reading data; Parquet only,
Noneotherwise (the UI says so). - sniff_
format - What a file with no usable extension is, from its first bytes (Parquet, Arrow,
Avro and ORC carry signatures; CSV and JSON have none and are not guessed). Asked
only of a directory being opened, never one being looked at; which signatures a
listing trusts is each format’s call (
crate::formats::readers::Trusted::listing). - sniff_
listed sniff_format, else the format spec an open would pick (by glob, else by magic andmatch.where), from one read of the file’s head.- split_
row - The row of a split named by its path inside its cache directory (a recent);
Noneif none. - split_
rows - A Hugging Face cache directory’s splits as rows at their paths inside it
(
cache/test), opened with--table. Empty otherwise, or for one split (its door opens it). - table_
row - The row of a table named by its path inside its file (
app.db/users, a recent);Noneif none. - unreadable_
by_ name - Whether a name already rules the file out: an extension no reader takes, past any
compression suffix. A bare
data.gzor extensionless name is left to the open. - variant_
row - The row of a variant named by its path inside its file (a recent);
Noneif none. - variant_
rows - A spec-read file’s variants as rows at their paths inside it (
day.itch/add), opened with--table. Empty for other files. - worth_
sniffing - Whether a listing sniffs a file: no extension, an uninformative one (
.bin), or only text (.log, which candump writes;.txt).
Type Aliases§
- Schema
Preview - Column name and type, for the home screen’s preview pane.