- Go 96.3%
- HTML 2.1%
- CSS 1.6%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
|
|
||
| .vscode | ||
| archive | ||
| cmd | ||
| docs | ||
| internal | ||
| names | ||
| person | ||
| pid | ||
| research | ||
| .env.example | ||
| .gitignore | ||
| .goreleaser.yaml | ||
| CHANGELOG.md | ||
| CLAUDE.md | ||
| go.mod | ||
| go.sum | ||
| index.md | ||
| README.md | ||
| ROADMAP.md | ||
| task-plus.yml | ||
| Taskfile.yml | ||
life-weaver
The builder for i.bytestone.uk: a record and a life history for each person, one page each, as a cross between an encyclopaedia entry and a family-tree profile. The aim is a place for every one of the 117 billion people who have ever been born; the first is Victoria Drummond.
The records and files are not in this repo. They are the bytestone archive on the NAS; this repo is the builder that turns the archive into the site.
IDs
Each person has a number. In URLs and file names it is written in
Crockford base32, lower case:
0, a (10), z8 (1000), jm1fj00 (20 billion). The alphabet drops
i l o u, and decoding takes o as 0 and i, l as 1, so an ID
read aloud or off paper still finds its page. Base64 would save one
character at the price of case-sensitive URLs and file names.
life-weaver id 20000000000 # jm1fj00
life-weaver id jm1fj00 # 20000000000
pid is a public package, as are person (the record and the register),
archive (the instance an archive tree says it is, below) and names
(how a name is searched: its folded form and the match, story 007):
bytestone-loader imports the first three to write records into a sandbox
archive.
Records
Each person is one directory in the archive, people/<dir>/, holding
person.yaml and everything of theirs: files/ (what the record names),
items/<item-id>/ (archived things), renditions/, derived/. File
paths in a record are relative to that directory: files/images/father.jpg.
The directory comes from the id: pad it to an even length, split it into pairs, and put the number of pairs less one in front.
| Person | Directory |
|---|---|
0 |
people/0/00/ |
1 |
people/0/01/ |
100 (1024) |
people/1/01/00/ |
jm1fj00 (20 billion) |
people/3/0j/m1/fj/00/ |
life-weaver dir jm1fj00 # 3/0j/m1/fj/00
| Field | What |
|---|---|
name, short |
Full name; the short form links use |
summary |
One line under the name |
gender |
female, male or other; left out when unknown. Charts colour by it |
portrait |
A file under files/, the picture at the head of the page |
born, died, buried |
date (ISO prefix: 1894, 1894-10, 1894-10-14) and place |
parents |
IDs. Children and siblings are derived from these |
marriages |
spouse ID, date, place; recorded once, shown on both pages |
influences |
People who shaped the upbringing without being parents: person ID, role in the record's words (nanny, guardian, godmother), weight above 0 and up to 1. Nothing is derived from them |
bio |
Markdown, the life story |
albums |
Titled sets of photographs: file, caption, credit |
resources |
Documents: title, file, note. Markdown becomes a page; a directory (a web page with its index.html and assets) is published as it is; anything else is a download |
links |
Pages elsewhere |
sources |
Markdown lines |
Every file a record names is published, so a photograph or document goes
into a record only once its rights allow it on a public site. The
person's held items follow the albums as a gallery of thumbnails, each
linking to the item's page at /<id>/items/<item>/: the front, the back
when there is one, and what its photo.yaml says (description, claims
with their sources, provenance, credit, batch). Under each side the page
lists the copies a reader can take: the master from the bag (TIFF, its
pixel size, the record's master_ppi, file size) as a download, and the
display, thumbnail and tiny renditions. An item with no renditions is
left off and reported by the build.
A page (a file received from elsewhere, holding one or more prints)
comes after the photos in the gallery: it is evidence, not a picture to
browse. Its page shows the file as sent and what its page.yaml says
(sender, received, device, format and ppi, the photos cut from it, each
linked); a photo cut from a page says which and where
(front.cut_from, front.bounds). A later scan of the print a copy was
made from names the copy (supersedes): the gallery shows the scan and
not the copy, whose page stays and says what superseded it. These links
are to items the same person holds; another's is shown as a bare id.
Vocabulary
| Term | Meaning |
|---|---|
| Person | A life; identified by an ID |
| Record | The YAML file holding what we know of a person |
| Register | A directory of records with the ties between them checked |
| Family | A person's parents, spouses, siblings and children, derived from the register |
| Gender | What the record says, gender: female, male or other, left out when unknown; the chart's pink, blue and yellow (story 016) |
| Influence | Someone who shaped a person's upbringing without being a parent in the register's sense, with a role and a weight (influences, story 014) |
| Chart | A drawing of the kin around one person, the subject, from the register: rows by generation and the edges between them (internal/chart), drawn by genealogy to a directory with a review.html to judge by eye, and on the front page and every person page in boxes, each a link (story 020) |
| Hourglass chart | Ancestors above the subject, descendants below, the subject's row with siblings in birth order and spouses beside them: a drop-line chart, each couple joined by a bar and their children hung from it; influences as dashed curves as wide as their weight |
| Generation | One row of a chart, numbered from the subject: −1 parents, +1 children |
| Brief name | The shortest form a chart may call someone: the record's short, else names.Brief of the name, the name before any comma or bracket cut to its first word and surname (story 017) |
| Size | How much of a name a chart's boxes carry: brief or full (genealogy -size) |
| Theme | One drawing of a chart (genealogy -theme): boxes, the drop-line chart; vine; or a stem theme, trellis, tendril or garland (story 023) |
| Stem tie | An edge of the chart drawn as a stem of the flora, masked in the link ink as the margin is, in place of the straight drop line: trellis draws every line so, a leaf or two along the longer ones; tendril curls each stem where it meets a box; garland ends a child's stem in a bud and a spouse's in a blossom |
| Decoration | A small motif from the flora on a box, never over its text: tendril's sprig from the top-right corner, garland's quarter-flower at the top-left clipped to the box as a tile's corner is |
| Width | The widest the boxes drawing may be, in px (genealogy -width; the pages give the column's width): a chart that would be wider is cut to it, never scaled down (story 024) |
| Cut | A reduction of the hourglass to its width, one notch at a time: a generation of descendants below the children, then siblings from the longer side, then the youngest children, then a generation of ancestors above the parents; what is cut is counted in a more box. Nothing left to cut, the chart is drawn as it is |
| More box | A box standing for the people a cut took off a row, hung where they would hang: its count, "+4", over their kind, older siblings, younger siblings or children; no link, no id |
| Vine | The chart drawn in the flora (story 018): the subject a flower at the root, the ties stems, ancestors flowers, siblings leaves, spouses blossoms, children hanging buds, influences sprigs, the names in the ink beside them; a step towards the margin of #99 |
| Composition | Stems point by point and motifs at points, in page centimetres, that ornament.Grow draws by seed as it draws the margin's own |
| Event | A dated, placed moment: birth, death, burial, marriage |
| Album, Photo | Pictures we may publish, with credit |
| Resource | A document about the person the site publishes |
| Margin | The floral ornament down the sides of the front page and of person pages on wide screens, margin.svg, drawn by the build from the day's seed in the link ink (story 009) |
| Ink | The cobalt the site is drawn in, --link, florilegium's ink at its own hue; the margin and the tiles are masked in it (story 011, the brand page) |
| Copper | The second ink, florilegium's accent and the colour of the runes: the band's digits and the self card, never text |
| Byte stone | The site's mark: the silhouette of U 240 at Lingsberg, its serpent band carrying 0s and 1s in place of the runes; bare on the favicon and in the header |
| Tile | A square ornament in the Delft manner, ornament.Tile: a quarter-flower at each corner, the same on every tile so four meeting complete it, and a motif from the flora at the centre by seed |
| Portrait tile | The tile shown in the portrait's place when a record names none, chosen from the tile set by the id, masked in the ink (story 012) |
| Tile set | The tiles the build draws once, tiles/<n>.svg, n from 0 to 31; a person shows tile id mod 32 |
| Id bits | A person's id as the fewest whole bytes that hold it, msb first, on the band of their page's byte stone: 0 is 00000000 |
| Brand page | docs/brand.html: the palette and ramp, the type, the stone, tiles and the day's margin as the build draws them (life-weaver brand DIR) |
| Archive | The primary store: a directory per person (docs/archive.md) |
| Archive instance | One archive tree, named by its archive.yaml (name, purpose, slot); build and serve report which they are on |
| Slot | An instance's place among the ten that may serve at once, 0 to 9, and so its address: serve listens on localhost:8321+slot. Production is slot 0, so its clients default to localhost:8321, and UAT is slot 1, said or not; a scratch or scale instance names its own, 2 to 9 |
| Production | The archive of record, on the NAS, purpose: production; bulk writers refuse it, and nothing writes it but a promotion |
| UAT | The staging instance beside production on the NAS, purpose: uat, slot 1: a full copy, people and items, that every depositor writes and i.bytestone.uk is built from; bulk writers may write it (story 026) |
| Promotion | task promote: production becomes exactly what UAT is now, tree and site |
| Item | One archived thing with its own id, kept as a bag in its home person's directory |
| Kind | What an item is: a photo, a print scanned here with photo.yaml beside it, or a page, with page.yaml. Read off the bag; the receipt names it |
| Page | A file received from elsewhere (a copy emailed, a phone photograph of prints), kept unaltered as an item of its own; the prints on it are photos cut from it, as from a bed scan |
| Cut from | A photo's tie to the page it was cut from and where on it the print lay; the page lists its photos |
| Supersedes | A later scan's tie to the copy of the same print it replaces; the site shows the scan in the copy's place and the copy stays |
| Mirror | The laptop's copy of UAT's people tree without items and renditions, which the build reads |
| Site | The static output: / the front page, /<id>/ page, /<id>/<file> downloads, /<id>/<name>/ document pages, /version.json what built it |
| Location | Somewhere the archive or the site lives, as the status page probes it (story 030): an archive tree, the served one or one on the NAS, or a site |
| Front page | The featured life with their family as the hourglass chart, the count of lives, the slogan and the search (stories 006, 020) |
| Featured life | The person the front page opens with: the best-recorded (portrait and bio) with the most kin, else the best-connected |
| Kinship | How two people are connected: the shortest chain of parents, children and spouses, drawn in the browser by Go compiled to wasm when a search match is chosen |
| Folded name | A name's search form: script-specific variation that does not tell people apart removed (names.Fold, story 007) |
| Shard | One file of the static search index, names/<key>.json, the key a word's first two runes; a query fetches one |
Search
A name is found the same way on the front page and in the service:
every word of the folded query is a prefix of a word of the folded name
or short form, in any order (names.Match). Folding drops case, accents
and other marks, maps letters that do not decompose (ø, æ, ß, ł…),
takes each Han character as a word, drops apostrophes and turns other
punctuation into spaces, so vict dru finds Victoria Drummond,
odeg finds Ødegaard and 白 finds 李白; ria does not find Victoria.
No transliteration yet: Victoria does not find Виктория.
The site ships the index as shards, names/<key>.json, one per
two-rune prefix of a word (an initial or a Han character is a key on its
own), each holding everyone with such a word; the page's Go
(kinship.wasm) fetches the shard of the query's longest word and
matches the whole query within it, so a sandbox of millions searches
without a server. One typed letter finds initials; two find names.
A query handed on in the page's URL, /?q=name, as www.bytestone.org's
search box sends one, is searched on landing as if typed. A page on
another host carries the same search by loading wasm_exec.js and
kinship.wasm from the site of lives and naming it in data-lives on
its search form; with no featured life a match links to the person's
page there (story 025).
Usage
task uat:seed # once: UAT on the NAS copied from production entire, named uat
task archive:pull # UAT on the NAS → mirror (~/.local/share/bytestone/uat): archive.yaml and the people tree, less items and renditions
task person:pull ID=0 # one person entire, items included
task build # mirror → site/, then the front page's wasm (task wasm)
task archive:push # mirror → UAT on the NAS (adds and updates; never deletes on the NAS)
task person:push ID=0 # one person entire
task serve # the archive service over the mirror: its API and its status page at /, probing the NAS and the sites (below)
task preview # preview site/ locally
task publish # mirror → UAT, UAT → mirror, then docs and site to their hosts (tp pages deploy)
task promote:diff # what promote would change in production, deletions included
task promote # production becomes what UAT is now: the tree on the NAS, and i.bytestone.org what i.bytestone.uk serves
task check # fmt, vet, lint, test
task perf # the search ladder: GET /people?q= at each scale of register
The mirror is UAT's. Edit a record in it, then task archive:push or
person:push. task publish brings the mirror and UAT on the NAS level,
builds and sends site/ and docs/ to their hosts. The site it sends is
i.bytestone.uk, where a publish is looked at; task promote then makes
production what UAT is, the tree on the NAS, deletions included, and the
site as served copied over i.bytestone.org, the production site of
lives, on the host itself. Production changes only by a promotion, and
task promote:diff shows what one would do.
.env (gitignored; .env.example) may set BYTESTONE_ARCHIVE, the
archive the build and the service read, and BYTESTONE_ADDR, where the
service listens; the defaults are the mirror and the instance's slot address.
Every archive instance names itself in archive.yaml at its root, and
build and serve refuse a tree without one:
name: bytestone
purpose: production # or uat, scratch or scale
slot: 0 # production's; uat is 1; a scratch or scale instance takes 2 to 9
serve listens on localhost:8321+slot unless -addr says otherwise,
and first asks who is on that address: nothing, it listens; the same
instance, it says so and stops; another instance or something else, it
refuses, naming what has the address. So several instances serve at once,
each where its slot puts it, and a scratch run cannot take production's
address by accident.
Anything that writes in bulk (a synthetic generator, a mass import)
calls archive.Load(root) and then Instance.Bulk(), which refuses
production. UAT takes bulk writes: that is what it is for, and the
mirror is UAT's, carrying UAT's file. A scratch or scale instance is any
other tree with its own file.
The archive service
life-weaver serve is the API the archive's clients use
(docs/archive.md, stage 2). It reads the register
(bytestone-scan uses it to find a batch's home person) and takes
deposits: an item id reserved under its home person, the bag put for it,
and a receipt for either. Its front page, /, is a status page for the
operator: which release and instance is serving, over which archive and
where, what it holds, who is on each of the ten slots, and the locations
(story 030): the archive trees, here and on the NAS, and the sites, each
probed every five minutes. task serve names the NAS trees and the
sites (LOCATIONS in the Taskfile); by hand they are
-nas USER@HOST:PORT -tree DIR … -site URL …, the trees read over SSH
with the key loaded. A tree is measured by one shell script run where it
is; a site by the version.json the build writes beside index.html
(the release, when, how many people, the instance).
| Call | Answer |
|---|---|
GET /people |
Every entry in the register, by id: id, name, short, summary, born, died |
GET /people?q=words |
The entries the query finds: every word of the folded query a prefix of a word of the folded name or short form (names.Match; README Search) |
GET /people/{id} |
The person's record as JSON, the YAML fields under the same names; 404 if there is none, 400 if the id does not parse |
GET /people/{id}/items |
The receipts of every item homed with the person, held and reserved alike, in item-id order, as a JSON array; [] for none; 404 if there is no such person. One page at a time: ?limit=N sets the page size (1000 by default and at most; 400 under 1) and ?after=ITEM starts past that item (400 if not an item id). When items remain the answer carries Link: </people/{id}/items?after=…&limit=…>; rel="next" |
POST /people/{id}/items |
Reserve the next item id, homed with the person: 201 and the receipt, status: reserved |
PUT /items/{item} |
Deposit for a reserved id, the body a tar holding the bag under bag/ and each master's renditions under renditions/<recipe>/ (display.jpg, thumb.jpg, tiny.jpg, recipe.yaml naming the master's sha256; the back's under back/): 201 and the receipt, status: held, with payload, the bag's manifest; 200 when the same bag is held already (its renditions stay); 400 a bag not whole or naming another id, or a refusal renditions (file is what is missing or wrong, or the master with none); 404 an id not reserved; 409 a refusal, duplicate (a picture in the bag is held as part of duplicate_of, homed with home) or conflict (the id holds a bag with other checksums). The layout is in docs/archive.md, Depositing an item |
GET /items/{item} |
The receipt: reserved, or held with the manifest; 404 if there is none |
GET /items/{item}/fixity |
The item's checksums recomputed from the bag on disk, every byte read: {"item", "home", "status", "payload", "checked", "failures": [{"file", "reason"}], "sound", "unrendered"}, payload the manifest as it is on disk and unrendered the pictures no rendition names. sound is held with nothing wrong; a reserved id is not sound and has nothing checked; 404 if there is no such item. For verifying, where the receipt is for looking up (#87; docs/archive.md, Fixity) |
GET /version |
{"version": "v0.14.0", "instance": {"name": "bytestone", "purpose": "production", "slot": 0}}: the life-weaver release serving ((devel) for a local build) and the archive instance it serves, so a client can tell production from a scratch or scale instance |
GET /status |
This service, as the status page shows it (story 029): version, instance, archive (the directory served), addr, since, people, items (held, reserved), requests served since the start (this one included) and slots, one per slot 0 to 9: addr and status (this, serving with the instance answering there, taken by something that is not life-weaver, or free) |
GET / |
The status page: GET /status as HTML in the lofigui manner, reloaded by the browser every 10 s. For the operator; every other call is for clients |
GET /status, locations |
Where the archive and the site live, as last probed (story 030; at says when, and the key is absent before the first probe): trees, the served archive and each -tree on the -nas, with where, its instance, people, held, reserved, bytes and latest (the newest record's mtime), or error; sites, each -site, with the HTTP code of its version.json and what that says (version, built, people, instance), or of its front page when it has none |
A receipt is {"item", "home", "status", "kind", "payload": {"data/front.tif": "<sha256>", …}};
kind is photo or page, read off the held bag (data/page.yaml
makes a page), and absent while the id is only reserved. A bag holding
both records is refused.
The scanner closes a batch once every photo's receipt says held.
GET /people?q= scans the register, about 2 µs a person, so it answers
within its budget of 100 ms to some 45,000 people; a release's tests gate
on 10,000, and task perf measures the rungs up to a million
(story 008).
Links
| Site | https://i.bytestone.uk |
| Documentation | https://life-weaver.docs.bytestone.uk |
| Source | https://git.bytestone.uk/hum3/life-weaver |
| Lecture | https://git.bytestone.uk/hum3/victoria-drummond-lecture |
Credits
The front page's floral margins and the tiles are a port to Go of
florilegium by Kevin
Raymond (MIT), its stems, leaves and flowers as parametric curves; the
notice travels in internal/ornament. The palette is its Delft ramp,
navy to mist at the ink's own hue, and its copper accent
(brand page).
The byte stone is U 240 at Lingsberg, the runestone on bytestone.org's
masthead, its runes become bits.