Referencia · §8.32

Branches

branches, §M14.13 B3

Ez az oldal a nucleus saját dokumentációjából készül, ezért angol nyelvű.

A branch is a copy of the database made in constant time and space, written on its own (the storage: §4.6; the engines: §5.2). CREATE BRANCH name [FROM parent] [AS OF TIMESTAMP t | AS OF COMMIT n] makes one of the session’s database (or of parent) as it is now — or as it was then, within the history kept (nucleus server --history; else 72000), at the cost of a pass over its entries (§5.2); DROP BRANCH [IF EXISTS] name; ALTER BRANCH name RESET makes it its parent as it is now. An administrator’s, not in a transaction block (25001); 42501 for others. Names: 1–63 ASCII letters, digits, -, _, . (quote one with - or .: "pr-1"), not main or nucleus (42602); one that exists 42P04, none 3D000; the main branch cannot be dropped (0A000), nor one with branches of its own (2BP01), nor the session’s own (55006). nc_catalog.branches (name, parent, current — the session’s). nc_catalog.ranges: the ranges the database is cut into (§6.6). A client names a branch as its database: the nucleus protocol’s Hello (nucleus — a driver’s default —, main or nothing: the main one; another unknown: 3D000, after the login), PostgreSQL’s database parameter (a name that is not a branch: the main one, as a PostgreSQL client’s default is the user’s name), nucleus sql <dir> -d. The login is the main database’s (passwords, throttling, the audit of refusals); the role then must exist in the branch, whose privileges apply — a branch made before a role is the main one’s has no such role. Each branch has its own Kv::instance, so the state kept in memory per database (HNSW upkeep) is never mixed. nucleus branch <dir> create | list | drop | reset does the same on a local directory (not one a server has open; --at <time> needs --history <duration>, the server’s, since the retention is not stored with the database — a longer one could take a time whose versions vacuum removed). tests/branches.rs: tables, rows, indexes and schema changes on each side invisible to the other, a branch of a branch, drop and reset, every refusal’s code; crates/client/tests/client.rs connects to a branch by name.