Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Glossary

The words this book uses with a precise meaning, in alphabetical order.

Action. The name a rule uses for what a request does: list, retrieve, create, update, partial_update, destroy, or the name of an action of the resource’s own (#[action], DRF’s @action). A detail action works on one object (/loans/{id}/give_back), a list action on the resource (/stations/count). See Actions.

Alias, prefix. Names a client can put in fields that stand for other fields of a serializer. See Serializers.

Annotated field. A serializer field computed by the database, as an SQL expression, in the same query as the list (Django’s annotate).

app(). The function of the application crate that returns the Application: its domains, its plugins, how users sign in. It plays the part of INSTALLED_APPS and of the root urls.py.

Authenticator. The value that implements Authenticate: it turns the Authorization header into an identity, nobody, or a 401. See Authentication.

Behaviour. A type listed on a model or a resource (behaviours(Tracking)) that adds what its writes set, and possibly filters and actions. It replaces Django’s abstract models, view mixins and pre_save signals. See Behaviours.

Context (Ctx). What every piece of resource code receives about the request: the database (ctx.db), the user (ctx.user), the action (ctx.action()), the typed parameters, the services.

Domain. One subject of the application, like a Django app: authors and books, or loans. A domain is several crates, one per layer: <domain>-models, <domain>-api… Domains are ordered: a domain’s models may point to the domains before it. See Organising an application.

Field group. A named set of columns added to models with #[with_fields(..)]: rind_auth::user_base adds the password and last_login.

Filterset. A struct of filters for one model’s list (#[derive(FilterSet)]), as django-filter’s FilterSet. See Filters.

Foreign table. A table no model describes, known to rind only by its keys, so that a deletion can still follow them.

Fresh schema. A PostgreSQL schema created for one test, with the application’s migrations applied (rind::testing::fresh_schema).

Hook. Code that runs inside a write’s transaction: a method of Writes (creating, updating, saved, deleting). Django’s perform_create and save() overrides. See Inputs. Plugins have hooks of another kind, around every call (Around): see Plugins.

Identity. What rind knows of the user of a request: an id, the is_staff and is_superuser flags, the slugs of their groups, and data of the application’s own.

Input. The struct that says what a client may write on a model, and how it is checked (#[derive(Input)]): the writing half of a DRF ModelSerializer. See Inputs.

Layer. One of models, shared, ops, api: the crates a domain is cut into. A crate depends only on the layers below it. ops holds what the domain does without HTTP (Django’s services.py); shared the serializers and filters other domains reuse.

Loader. An async function that computes a serializer field for the keys of a whole page at once (#[computed(loader = …)]): one call per page, never one per row.

Lookup. How a filter compares its column with the value: eq, gt, icontains, contains, under…

Mandatory, on request. A mandatory field is always sent, whatever the client asks. An on request field is sent only when the client asks for it (fields or include).

Mode. A value a rule gives to a request, which decides the rows the request works on (a query) and the fields it hides. It is rind’s get_queryset. An object outside the mode’s rows answers 404. See Permissions.

Nested field. A serializer field holding a related object, or a list of them, loaded once per page.

Output, serializer. The struct that says what an object looks like in an answer (#[derive(Serializer)]): the reading half of a DRF ModelSerializer. See Serializers.

Page envelope. The shape of a list answer: {"parameters", "nav", "results"}.

Path. A typed function that names a column or a relation of a model: Book::title(), Book::author().name(). Paths replace the strings of Django’s querysets ("author__name"), and the compiler checks them.

Plugin. A value installed with .with(..) in app(), usually behind a Cargo feature. It can add services, hooks, routes, models, commands and checks. See Plugins.

Resource. A model served over HTTP, with its list, detail, writes and actions (#[derive(Resource)]): DRF’s ModelViewSet. See Resources.

Rule. #[rule(..)] on a resource: it gives a kind of user (anyone, signed in, staff, a group…) some actions, and optionally a mode. The rules are read in order, and the first that accepts the request decides. See Permissions.

Scope. A function of a model that returns a query: Loan::of(user), Station::open(). Where Django has manager methods. Modes use scopes as their queries.

Scoped model. A model with #[model(scoped)]: it has no default query, so every use must say which rows it reads.

Service. A value shared by all requests (a mailer, a cache), found by its type: ctx.service::<T>().

State file. NNNN_name.state.json, beside each migration: the schema of the domain after it, which rind make compares the models with.

Typed parameters. A struct of query parameters that are not filters (#[derive(Parameters)]), read once and found with ctx.parameters::<P>(). See Parameters.