Expand description
The data model: a graph of linked entities, not a list of files.
This is the central architectural decision of the project. We do not model “an album belongs to an artist” but “entities carry roles with respect to one another”. That is what will later make it possible to click on a drummer and see their forty appearances, without redoing anything.
Each Vec is indexed by identifier: catalog.artists[id] is artist id.
The persisted graph mirrors the tables described in schema.sql. A future
database would preserve this vocabulary; adopting SQLite depends on measured
storage and deployment budgets, rather than a mandatory milestone migration.
The module is divided by what the code does with the graph, which is the only division that holds up. This file is the vocabulary — the entities and the tables they live in — and beside it sit the three verbs:
| Module | What it does |
|---|---|
query | Reads the graph: every question a command asks of it |
builder | Turns scanned files into entities, deterministically |
relations | Derives the typed links between entities |
The division is not cosmetic. query takes &self throughout, so a
lookup that tried to change something would not compile; builder is the
only place identifiers are handed out; relations holds everything that
is inferred rather than read, which is why it carries a version of its own.
What the rest of the program calls is re-exported here, so model::build,
model::ScannedFile and model::rebuild_relations keep naming the same
things they always did — the split is internal, and no caller had to change.
Re-exports§
pub use builder::ScannedFile;pub use builder::build;pub use query::SearchHit;pub use query::TitleMatch;pub use relations::ALBUM_BY;pub use relations::APPEARS_ON;pub use relations::COMPILATION_APPEARANCE;pub use relations::CONTRIBUTED_TO;pub use relations::DISCOGRAPHY;pub use relations::DUPLICATE;pub use relations::EDITION_OF;pub use relations::HAS_EDITION;pub use relations::HAS_RECORDING;pub use relations::HAS_TRACK;pub use relations::OTHER_EDITION;pub use relations::PART_OF_RELEASE;pub use relations::PERFORMANCE_OF;pub use relations::PLACED_AS;pub use relations::PLACEMENT_OF;pub use relations::RELATION_RULES;pub use relations::RELEASED;pub use relations::RELEASED_BY;pub use relations::rebuild_relations;
Modules§
- builder
- Turning scanned files into a graph of entities.
- identity
- Which spellings of a name are the same person, decided before any of them becomes an entity.
- query
- Reading the graph.
- relations
- Deriving the typed links between entities.
Structs§
- Artist
- Person or group. The person/group distinction will come from MusicBrainz.
- Audio
File - A file on disk, with its technical properties and its raw tags.
- Catalog
- The complete catalog.
- Credit
- “Who does what, on what”. The heart of the graph.
- Credit
Attribute - One attribute modifying a credit relationship.
- Genre
- A genre, interned once however many entities carry it.
- Genre
Link - Attachment of a genre to an entity.
- Integrity
Record - An integrity verdict, with what produced it.
- Label
- A record company, as named by the
labeltag. - Recording
- One recorded performance, independent of the local files and editions carrying it.
- Relation
- A typed link between two canonical entities.
- Release
- An album, in the sense of a “release”: what MusicBrainz calls a release.
- Release
Group - A work’s release identity shared by its editions.
- Track
- A local placement of a recording: one file at one position within a release.
- Work
- A musical composition, distinct from every recording that realizes it.
Enums§
- Entity
Kind - Entity kind, for the polymorphic tables (credits, relations, genres).
Constants§
- PERFORMING_
ROLES - Roles that contribute to the performance, as opposed to composing or producing it. A conductor shapes a performance without being audible.
Functions§
- is_
performing_ role truewhen the role belongs to the performance side of the credit graph.
Type Aliases§
- Id
- Dense index into the catalog’s vectors:
catalog.artists[id]is artistid.