Expand description
Typed tables a provider reads and writes through, whatever keeps them.
A Table is the source of a provider’s records: a MemoryTable built in code, a file
with a codec, a SQL database or an HTTP API are all tables, and the provider cannot tell
them apart. Reloading caches the latest Snapshot and refreshes it through
Table::changes_since.
Structs§
- Memory
Table - A table kept in memory, built in code. It is writable and its revision counts the changes made to it.
- Reloading
- A table with its latest
Snapshotcached, refreshed throughTable::changes_sinceon every use, so a write by anyone else is seen without reopening. - Revision
- Which state of a table a
Snapshotis: opaque, compared only for equality, and chosen by the table.0is what a table that never changes may use for ever. - Snapshot
- All the records of a table at one
Revision, in the table’s order.
Enums§
- Source
Error - Why a table could not answer. Messages never contain record contents or secrets.
Traits§
- Keyed
- A record a table can find again by name.
- Table
- Where a provider’s records of type
Tcome from, and optionally go to.
Functions§
- check_
field - Whether
valuemay be a record’s field: not empty, at mostmax_byteslong, and free of control characters (which would let a field forge a line in a log or a file). - check_
keys - Checks that no key is used twice and that there are at most
maxrecords. A provider’s own validation calls this first. - unix_
now - Now, in whole seconds since the Unix epoch, as records stamp
made_unixand compareexpires_unix;0on a clock set before 1970.
Type Aliases§
- Update
- What
Table::updateis given to decide a change: the records read, and the record to put, if any. - Update
One - What
Table::update_oneis given to decide a change to one record: that record as the table holds it (Nonewhen there is none), and the record to put, if any.