Blackholes

The blackholes plugin permanently removes or replaces field values in history, including transaction history and configured backups. Use it to remove leaked secrets or personal data that ordinary deletion leaves in history. History retention controls how much history a database keeps. Enable blackholes in the plugins option when you open the database. See plugin selection for the open options.

Warning

Execution permanently changes history and backups. Review the preview and obtain approval before you execute.

Definitions

A blackhole is a stored definition of the blackholes kind. Write it with patch_definition like a query or mutation. For example, store the following definition with kind blackholes and path keys/leaked. It has a query and a patch, like a mutation:

TRON426 B
Offset (hex)Bytes (hex)Meaning
00054 52 4F 4Emagic TRON
0042C 3F65txt "?e"
0070E 0D 00 0100 010000 00 04000000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @4
0142C 3F65txt "?e"
0174C 6B696E64txt "kind"
01C6C 6170694B6579txt "apiKey"
0230E 15 00 0700 030000 00 14000000 170000 00 1C000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @14 → @17 → @1C
0382C 3F65txt "?e"
03B5C 6F776E6572txt "owner"
0419C 3F6B65794F776E 6572txt "?keyOwner"
04B0E 15 00 0700 030000 00 38000000 3B0000 00 41000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @38 → @3B → @41
0601C 3Dtxt "="
0629C 3F6B65794F776E 6572txt "?keyOwner"
06C6C 3F6F776E6572txt "?owner"
0730E 15 00 0700 030000 00 60000000 620000 00 6C000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @60 → @62 → @6C
0880E 15 00 0700 030000 00 23000000 4B0000 00 73000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @23 → @4B → @73
09D5C 7768657265txt "where"
0A30F 0A 9D000000 8800 0000map leaf, size 10: @9D → @88
0AD4C 66696E64txt "find"
0B20F 0A AD000000 0700 0000map leaf, size 10: @AD → @7
0BC07 0E 0A000000 A300 0000 B2000000map branch, size 14, depth 0 (root), slots 1, 3: @A3 → @B2
0CA4C 6C697374txt "list"
0CF5C 3F73656564txt "?seed"
0D56C 3F76616C7565txt "?value"
0DC0E 15 00 0700 030000 00 CA000000 CF0000 00 D5000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @CA → @CF → @D5
0F14C 68617368txt "hash"
0F60E 11 00 0300 020000 00 F1000000 DC0000 00array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @F1 → @DC
1076C 736563726574txt "secret"
10E00nil
10F0F 0A 07010000 0E01 0000map leaf, size 10: @107 → @10E
1194C 6E6F7465txt "note"
11E8C 72656461637465 64txt "redacted"
1270F 0A 19010000 1E01 0000map leaf, size 10: @119 → @11E
1315C 746F6B656Etxt "token"
1370F 0A 31010000 F600 0000map leaf, size 10: @131 → @F6
14107 12 00380000 0F01 0000 27010000 3701 0000map branch, size 18, depth 0 (root), slots 11, 12, 13: @10F → @127 → @137
1532C 3F65txt "?e"
1560F 0A 53010000 4101 0000map leaf, size 10: @153 → @141
1605C 7175657279txt "query"
1660F 0A 60010000 BC00 0000map leaf, size 10: @160 → @BC
1705C 7061746368txt "patch"
1760F 0A 70010000 5601 0000map leaf, size 10: @170 → @156
18007 0E 40020000 6601 0000 76010000map branch, size 14, depth 2, slots 6, 9: @166 → @176
18E07 0A 01000000 8001 0000map branch, size 10, depth 1, slots 0: @180
19807 0A 80000000 8E01 0000map branch, size 10, depth 0 (root), slots 7: @18E

This definition selects every API key belonging to the supplied owner and names three fields on each selected entity. The query binds ?keyOwner from stored facts and compares it with the required input ?owner. The input has no default. Preview and execution fail if ?owner is omitted. The preview request below supplies owner 7.

The query selects rows from the current state by default. Temporal query clauses can select records from earlier history, including records already deleted from current state. Ordering, distinct results, aggregation and limits keep their usual query meaning. After aggregation, each patch target must still bind an individual entity. Each patch key is a ?variable that the query binds to an entity. Each field in a target is one of these:

ValueEffect on every assertion of the field
nullTurns the assertion into a retraction. The field disappears from current and historical records.
An expressionReplaces the assertion's value with the expression result. A literal such as redacted is a constant expression.

An assertion is a stored fact that gives the field a value. Existing retractions stay unchanged. Transactions keep their numbers and commit times, and other fields and entities do not change.

The definition is checked when you store it. The query and expressions must compile. Each patch target must be a query variable. After macro expansion, each expression input must be a query variable or one of the reserved inputs listed below. Patch fields in the reserved stardust/ namespace, generated _ targets and #_tx targets are refused. A refused definition reports invalid_definition.

Definition writes replace each supplied top-level member in full, including nested null values. For example, an update to query must supply the complete query. Other top-level members remain unchanged. A top-level null removes that member. Inside patch, null erases the selected field or entity throughout history.

A null at the entity position erases every historical field of that entity. For example, store this definition with kind blackholes and path people/erase:

TRON286 B
Offset (hex)Bytes (hex)Meaning
00054 52 4F 4Emagic TRON
0042C 3F65txt "?e"
0070E 0D 00 0100 010000 00 04000000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @4
0142C 3F65txt "?e"
0174C 6B696E64txt "kind"
01C6C 706572736F6Etxt "person"
0230E 15 00 0700 030000 00 14000000 170000 00 1C000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @14 → @17 → @1C
0381C 3Dtxt "="
03A2C 3F65txt "?e"
03D7C 3F656E74697479txt "?entity"
0450E 15 00 0700 030000 00 38000000 3A0000 00 3D000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @38 → @3A → @3D
05A0E 11 00 0300 020000 00 23000000 450000 00array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @23 → @45
06B5C 7768657265txt "where"
0710F 0A 6B000000 5A00 0000map leaf, size 10: @6B → @5A
07B4C 66696E64txt "find"
0800F 0A 7B000000 0700 0000map leaf, size 10: @7B → @7
08A07 0E 0A000000 7100 0000 80000000map branch, size 14, depth 0 (root), slots 1, 3: @71 → @80
0982C 3F65txt "?e"
09B00nil
09C0F 0A 98000000 9B00 0000map leaf, size 10: @98 → @9B
0A68C 696E636F6D696E 67txt "incoming"
0AF6C 72656D6F7665txt "remove"
0B60F 0A A6000000 AF00 0000map leaf, size 10: @A6 → @AF
0C05C 7175657279txt "query"
0C60F 0A C0000000 8A00 0000map leaf, size 10: @C0 → @8A
0D05C 7061746368txt "patch"
0D60F 0A D0000000 9C00 0000map leaf, size 10: @D0 → @9C
0E007 0E 40020000 C600 0000 D6000000map branch, size 14, depth 2, slots 6, 9: @C6 → @D6
0EE5C 6C696E6B73txt "links"
0F40F 0A EE000000 B600 0000map leaf, size 10: @EE → @B6
0FE07 0E 01100000 E000 0000 F4000000map branch, size 14, depth 1, slots 0, 12: @E0 → @F4
10C07 0A 80000000 FE00 0000map branch, size 10, depth 0 (root), slots 7: @FE

Supply ?entity as an entity link in both preview and execution. The query selects entities explicitly. An outgoing link does not select its destination, regardless of the field name. To erase another entity, select it in the query and name it in the patch. Temporal query clauses can select entities already deleted from current state.

Without links {incoming remove}, an incoming reference to an erased entity refuses planning with incoming_links. With this option, every historical reference to an erased entity is removed. A field containing only that link becomes a retraction. In a map or an ordered list, only the matching reference is removed; other members and empty containers remain. The source entity stays. A self-link or a link between two selected entities does not cause further selection. References in protected system fields refuse planning with protected_link.

Selecting the same entity for whole-entity erasure and a field patch reports conflicting_targets. Preview includes the expanded scope in affected, and its digest covers that scope before execution.

Replacement expressions

An expression is evaluated once for each historical assertion. It receives these inputs:

VariableValue
?valueThe original typed value.
?entityThe numeric entity ID.
?fieldThe field name.
?transactionThe assertion's transaction ID.
?seedA private random seed for the whole operation.
Other ?variablesThe row's bindings from the query.

The reserved names take precedence over query variables with the same name. The plugin expands stored callables before it identifies the query variables an expression reads. Variables in unused macro arguments do not need row bindings. The approval digest covers the expanded expression and its row bindings.

Preview

preview selects and plans a definition without changing anything. It uses the current database transaction as its cutoff. The request is a native object. This example uses DUST:

TRON121 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
045C 236C696E6Btxt "#link"
0A02 07000000000000 00i64 7
130F 0A 04000000 0A00 0000map leaf, size 10: @4 → @A
1D6C 3F6F776E6572txt "?owner"
240F 0A 1D000000 1300 0000map leaf, size 10: @1D → @13
2EAC 706172616D6574 657273txt "parameters"
390F 0A 2E000000 2400 0000map leaf, size 10: @2E → @24
439C 626C61636B686F 6C65txt "blackhole"
4DBC 6B6579732F6C65 616B6564txt "keys/leaked"
590F 0A 43000000 4D00 0000map leaf, size 10: @43 → @4D
6307 0E 20040000 3900 0000 59000000map branch, size 14, depth 0 (root), slots 5, 10: @39 → @59
MemberValueMeaning
blackholeTextThe definition path.
parametersObjectOptional. Merged over the query's declared parameters, as for a stored query run.

Preview results use these members. Public results omit empty collections.

MemberMeaning
digestA SHA-256 value {#sha256 ...} identifying what execution may change.
targetsThe number of selected entity fields.
matchedThe number of assertions the operation rewrites.
replacementsThe number of assertions replaced.
removalsThe number of assertions turned into retractions.
confirmThe text execute must repeat.
samplesUp to ten records with entity, field, transaction and replacement.
affectedMaps of erased entities and rewritten fields, including incoming-reference cleanup. See audit metadata.

The digest covers the definition and its authored revision, the effective parameters, the cutoff, every selected entity field with its expanded expression and row bindings, and the original assertions. It does not depend on sample replacements or seeds.

Two rows can select the same entity field. They form one target when they agree: both remove the field, or both apply the same expression to the same row bindings. Rows that disagree are refused with invalid_argument and the code conflicting_targets.

Each preview generates one temporary seed and returns samples from it. Another preview can return different samples with the same approval digest. Preview does not keep operation state between calls, so preview and execution can run in different processes.

Limits and errors

ResourceLimit
Selected entity fields100,000 in one operation.
Rewritten assertions1,048,576 in one operation.
Authored program64 KiB.
Expanded program64 KiB.
Evaluation work10,000,000 counted expression operations in one operation.
Evaluation CPUFive seconds of thread CPU time in one operation.
Whole-entity and incoming-reference selection10,000,000 history rows and five seconds of thread CPU time per expansion.
Definition copies, selection bindings, expression state and planned replacementsThe database memory budget.

Repeated planning shares the same work and CPU limits. These failures change no history:

StatusCodeCause
invalid_argumentinvalid_requestThe request is malformed.
invalid_argumentinvalid_parametersThe parameters do not fit the query.
invalid_argumentinvalid_definitionThe stored definition is not a valid blackhole.
invalid_argumentinvalid_queryThe query cannot run.
invalid_argumenttarget_not_entityA patch variable bound something other than an entity.
invalid_argumentunbound_variableAn expression reads a variable a row does not bind.
invalid_argumentconflicting_targetsTwo rows give one entity field different changes.
invalid_argumentincoming_linksAn entity selected for erasure has incoming references, but the definition omits links {incoming remove}.
invalid_argumentprotected_linkA protected system field references an entity selected for erasure.
invalid_argumentinvalid_targetA selected entity is not a data entity.
invalid_argumentinvalid_expressionAn expression is invalid or exceeds its size limit.
not_foundnot_foundNo definition has the path.
not_foundno_matchThe selection has no assertion to rewrite.
evaluation_failedexpression_failedEvaluation fails.
evaluation_failedwork_limitEvaluation exceeds its work or CPU limit.
out_of_memoryexhaustedThe operation exceeds a limit or cannot allocate the memory it needs.

Error messages do not include expression diagnostics that could disclose original values or the private seed.

Execute

execute repeats the preview's blackhole and parameters. It also requires these members:

MemberValue
digestThe SHA-256 value {#sha256 ...} from the approved preview.
confirmThe exact confirmation text from that preview.
actorNonblank text identifying who requested the operation.
reasonNonblank text explaining the operation.

Copy digest and confirm from your actual preview. The digest below is only an example:

TRON376 B
Offset (hex)Bytes (hex)Meaning
00054 52 4F 4Emagic TRON
0045C 236C696E6Btxt "#link"
00A02 07000000000000 00i64 7
0130F 0A 04000000 0A00 0000map leaf, size 10: @4 → @A
01D6C 3F6F776E6572txt "?owner"
0240F 0A 1D000000 1300 0000map leaf, size 10: @1D → @13
02E7C 23736861323536txt "#sha256"
03614 40 356230666434 6131633665396232 6438613337633065 3431663964356136 6238633365376632 3039313464366138 3562376331653066 3361396432346236 6338txt "5b0fd4a1c6e9b2d8a37c0e41…"
0780F 0A 2E000000 3600 0000map leaf, size 10: @2E → @36
082AC 706172616D6574 657273txt "parameters"
08D0F 0A 82000000 2400 0000map leaf, size 10: @82 → @24
0976C 646967657374txt "digest"
09E0F 0A 97000000 7800 0000map leaf, size 10: @97 → @78
0A85C 6163746F72txt "actor"
0AE3C 6F7073txt "ops"
0B20F 0A A8000000 AE00 0000map leaf, size 10: @A8 → @AE
0BC07 0E 00240000 9E00 0000 B2000000map branch, size 14, depth 1, slots 10, 13: @9E → @B2
0CA9C 626C61636B686F 6C65txt "blackhole"
0D4BC 6B6579732F6C65 616B6564txt "keys/leaked"
0E00F 0A CA000000 D400 0000map leaf, size 10: @CA → @D4
0EA7C 636F6E6669726Dtxt "confirm"
0F214 27 5045524D414E 454E544C59205245 5752495445204849 53544F525920414E 44204241434B5550 53txt "PERMANENTLY REWRITE HIST…"
11B0F 0A EA000000 F200 0000map leaf, size 10: @EA → @F2
1256C 726561736F6Etxt "reason"
12C14 14 457261737572 6520726571756573 742032323931txt "Erasure request 2291"
1420F 0A 25010000 2C01 0000map leaf, size 10: @125 → @12C
14C07 0E 01080000 1B01 0000 42010000map branch, size 14, depth 1, slots 0, 11: @11B → @142
15A07 16 200E0000 8D00 0000 BC000000 E000 0000 4C010000map branch, size 22, depth 0 (root), slots 5, 9, 10, 11: @8D → @BC → @E0 → @14C

Execution blocks other writes, then selects and plans the definition again with a fresh 256-bit cryptographic seed. Callers cannot supply the seed, and every expression in the operation uses the same one. The plugin discards it when the operation finishes. Execution applies the rewrite only if the new digest matches the approved one. Editing the definition, changing the parameters, or any commit since the preview causes conflict. Obtain a new preview and approval before trying again.

Every selected entity field changes in one transaction. Queries and indexes read the rewritten history. Subscriptions receive an incomplete change notification and read the database again. An index that covers a selected field but cannot repair itself rejects execution with unavailable and the code index_unsupported. On macOS, execution is refused while the filesystem plugin has a mount configured. The macOS mount cannot expire files that are already open, so execute reports unsupported with the code mounted_removal_unsupported and changes nothing. To execute, reopen the database without the filesystem plugin.

The execution result contains these members:

MemberMeaning
stagecomplete, or recovering if the rewrite committed but backup or recovery-record cleanup remains.
transactionThe rewrite transaction ID. Its metadata contains the immutable audit.
cutoffThe approved transaction cutoff.
targetsThe number of selected entity fields.
matchedThe number of assertions rewritten.
replacementsThe number of assertions replaced.
removalsThe number of assertions turned into retractions.
requestDigestA SHA-256 value {#sha256 ...} identifying the targets with their expressions and row bindings.
effectDigestA SHA-256 value {#sha256 ...} identifying the changes to the assertions.

Execution results contain no samples or seed. The replacement values remain readable in the rewritten records. An expression that returns the original value or exposes the seed can disclose sensitive information. Choose expressions that remove the information you need to erase.

An output allocation failure can occur after the rewrite commits. Read the audit or reopen the database before retrying.

Backup recovery

With the backups plugin enabled, every target must be reachable and match local history before execution begins. Otherwise, execute reports unavailable and changes nothing. The operation completes these steps:

  1. The rewrite, its transaction audit, the rebuilt indexes and a recovery record commit together.
  2. Every target replaces its history from the first changed transaction with the rewritten history.
  3. The recovery record is deleted.

A failure before the first step leaves history unchanged. After that commit, cancellation, closing the database or a crash cannot undo the rewrite. A result with stage recovering confirms that the local rewrite and audit committed but recovery work remains. Until the database reopens, another execute reports unavailable with the code recovery_pending. The next database open resumes recovery before comparing local history with the targets. Opening fails while a required target is unreachable. While the backups plugin is disabled, recovery waits and status reports recovering true. Enable backups and reopen the database to finish recovery. See backup status for target progress and whether new writes are allowed.

Keep every recorded target configured with its original name and storage namespace until recovery finishes. Removing, renaming or redirecting a target prevents recovery. Restore its original configuration and reopen the database. Recovery copies the committed replacements without evaluating the expressions again. It needs no execution seed.

Audit and status

Each execution writes one immutable stardust/blackhole metadata object on its own transaction. The audit commits atomically with the rewrite. Recovery does not create or change it. Only the plugin can write this reserved field. Explicit patches cannot target transactions; incoming-reference cleanup can remove links from ordinary user transaction metadata.

The object contains definition, definitionDigest, actor, reason, cutoff, matched, requestDigest, effectDigest and affected. definition links to the named definition; definitionDigest identifies its authored source at execution. All digest fields are native SHA-256 values, written as {#sha256 ...} in DUST. affected.entities maps erased entity IDs to true. affected.fields maps each rewritten field name to a map of affected entity IDs, also with values of true. Whole-entity erasures appear in entities; their fields are not repeated in fields. Public results omit empty groups, as with other empty object members. Recovery progress is separate from transaction metadata.

For example, this scope erases entity 101 and removes incoming references from entity 200's manager field:

TRON129 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
043C 313031txt "101"
0809bit true
090F 0A 04000000 0800 0000map leaf, size 10: @4 → @8
133C 323030txt "200"
1709bit true
180F 0A 13000000 1700 0000map leaf, size 10: @13 → @17
227C 6D616E61676572txt "manager"
2A0F 0A 22000000 1800 0000map leaf, size 10: @22 → @18
348C 656E7469746965 73txt "entities"
3D0F 0A 34000000 0900 0000map leaf, size 10: @34 → @9
476C 6669656C6473txt "fields"
4E0F 0A 47000000 2A00 0000map leaf, size 10: @47 → @2A
5807 0E 09000000 3D00 0000 4E000000map branch, size 14, depth 0 (root), slots 0, 3: @3D → @4E
668C 61666665637465 64txt "affected"
6F0F 0A 66000000 5800 0000map leaf, size 10: @66 → @58

The plugin does not copy removed values or invocation parameters into the audit. Keep sensitive information out of the actor and reason text you supply.

audit lists these metadata objects with their transaction IDs in ascending transaction order. Its optional request accepts after and limit. The limit is from 1 to 1000. status reports enabled, audits, recovering and backups.

Removal limits

A blackhole changes readable history in this database and its configured backup targets. Later writes can store the fields or the same values again. Removing a field that references a binary payload does not delete that shared payload.

Removal does not overwrite freed disk pages or erase versions kept by a storage provider. Independent database copies and external snapshots require separate cleanup. Bytes already delivered to an application cannot be recalled.

Reopen mounted snapshots affected by a rewrite. Discard staged saves based on the old history and read the records again.

Operations

OperationReturnsSummary
Blackholes::previewdocumentblackholes.preview(request) selects and plans a stored blackhole definition and returns an owned document with the digest to approve.
Blackholes::executedocumentblackholes.execute(request) permanently rewrites the approved history and returns an owned completion record.
Blackholes::auditdocumentblackholes.audit(options) returns an owned array document of transaction audits in ascending transaction order.
Blackholes::statusdocumentblackholes.status() returns an owned document describing the runtime.

Blackholes::preview

rust61 B
pub fn preview(&self, request: &Document) -> Result<Document>

Parameters

ParameterTypeOwnershipDefaultMeaning
self&SelfBorrowed for the callRequiredThe blackholes owner for this operation. Keep it alive during the call.
request&DocumentBorrowed for the callRequiredThe borrowed preview request: {blackhole [parameters]}.

Errors

StatusWhen
Status::INVALID_ARGUMENTthe request is malformed, the parameters do not fit the query, a selected target is a reserved field or not a data entity, or rows disagree about one entity field
Status::NOT_FOUNDno definition has the path (code not_found), or the selection has no assertion to rewrite (code no_match)
Status::EVALUATION_FAILEDa replacement expression fails or exceeds its work limit. History stays unchanged
Status::UNAVAILABLEthe database does not enable the blackholes plugin
Status::CLOSEDthe database is closed
Status::OUT_OF_MEMORYnative memory is exhausted

Notes

See preview for the request and result fields.

Examples

Store a blackhole definition and preview it

rust312 B
let definition = stardust::parse("{query {find [?e] where [[?e name Ada]]} patch {?e {name null}}}", Format::DUST)?;
db.patch_definition("blackholes", "people/erase-ada", &definition)?;
let request = stardust::parse("{blackhole people/erase-ada}", Format::DUST)?;
let result = db.blackholes().preview(&request)?;
TRON404 B
Offset (hex)Bytes (hex)Meaning
00054 52 4F 4Emagic TRON
0047C 23736861323536txt "#sha256"
00C14 40 383632313166 3763346165303161 3964353264393661 6265313261666238 3731656134623932 6631656431383164 3063346331373330 3765363232613538 3337txt "86211f7c4ae01a9d52d96abe…"
04E0F 0A 04000000 0C00 0000map leaf, size 10: @4 → @C
0581C 31txt "1"
05A09bit true
05B0F 0A 58000000 5A00 0000map leaf, size 10: @58 → @5A
0654C 6E616D65txt "name"
06A0F 0A 65000000 5B00 0000map leaf, size 10: @65 → @5B
0746C 6669656C6473txt "fields"
07B0F 0A 74000000 6A00 0000map leaf, size 10: @74 → @6A
085CC 7265706C616365 6D656E7473txt "replacements"
09202 00000000000000 00i64 0
09B0F 0A 85000000 9200 0000map leaf, size 10: @85 → @92
0A57C 74617267657473txt "targets"
0AD02 01000000000000 00i64 1
0B60F 0A A5000000 AD00 0000map leaf, size 10: @A5 → @AD
0C007 0E 08200000 9B00 0000 B6000000map branch, size 14, depth 1, slots 3, 13: @9B → @B6
0CE7C 6D617463686564txt "matched"
0D602 01000000000000 00i64 1
0DF0F 0A CE000000 D600 0000map leaf, size 10: @CE → @D6
0E96C 646967657374txt "digest"
0F00F 0A E9000000 4E00 0000map leaf, size 10: @E9 → @4E
0FA7C 636F6E6669726Dtxt "confirm"
10214 27 5045524D414E 454E544C59205245 5752495445204849 53544F525920414E 44204241434B5550 53txt "PERMANENTLY REWRITE HIST…"
12B0F 0A FA000000 0201 0000map leaf, size 10: @FA → @102
1358C 72656D6F76616C 73txt "removals"
13E02 01000000000000 00i64 1
1470F 0A 35010000 3E01 0000map leaf, size 10: @135 → @13E
15107 0E 01080000 2B01 0000 47010000map branch, size 14, depth 1, slots 0, 11: @12B → @147
15F8C 61666665637465 64txt "affected"
1680F 0A 5F010000 7B00 0000map leaf, size 10: @15F → @7B
17207 1A 308A0000 C000 0000 DF000000 F000 0000 51010000 6801 0000map branch, size 26, depth 0 (root), slots 4, 5, 9, 11, 15: @C0 → @DF → @F0 → @151 → @168

C exports: stardust_db_plugin_call, stardust_result_take_document, stardust_result_error, stardust_result_release

Blackholes::execute

rust61 B
pub fn execute(&self, request: &Document) -> Result<Document>

Parameters

ParameterTypeOwnershipDefaultMeaning
self&SelfBorrowed for the callRequiredThe blackholes owner for this operation. Keep it alive during the call.
request&DocumentBorrowed for the callRequiredThe borrowed execute request: {blackhole [parameters] digest confirm actor reason}.

Errors

StatusWhen
Status::INVALID_ARGUMENTthe request is malformed, confirm is wrong, the parameters do not fit the query, a selected target is a reserved field or not a data entity, or rows disagree about one entity field
Status::NOT_FOUNDno definition has the path (code not_found), or the selection has no assertion to rewrite (code no_match)
Status::CONFLICTthe definition, parameters, selection or history changed since the preview, or the digest names another request
Status::EVALUATION_FAILEDa replacement expression fails or exceeds its work limit. History stays unchanged
Status::UNAVAILABLEthe database does not enable the blackholes plugin, an earlier execution is still recovering, an index covers a selected field and cannot be repaired, or a backup target cannot take the blackhole
Status::CLOSEDthe database is closed
Status::OUT_OF_MEMORYnative memory is exhausted

Notes

Obtain approval before execution. The plugin cannot undo a committed rewrite. An output allocation failure can occur after commit. Read the audit or reopen before retrying. See execution.

Examples

Execute a blackhole with the approved preview

rust932 B
#[derive(serde::Deserialize)]
struct Approval {
    digest: std::collections::BTreeMap<String, String>,
    confirm: String,
}
#[derive(serde::Serialize)]
struct Request<'a> {
    blackhole: &'a str,
    digest: &'a std::collections::BTreeMap<String, String>,
    confirm: &'a str,
    actor: &'a str,
    reason: &'a str,
}
let definition = stardust::parse("{query {find [?e] where [[?e name Ada]]} patch {?e {name null}}}", Format::DUST)?;
db.patch_definition("blackholes", "people/erase-ada", &definition)?;
let target = stardust::parse("{blackhole people/erase-ada}", Format::DUST)?;
let preview = db.blackholes().preview(&target)?;
let approval: Approval = stardust::decode(&preview)?;
let request = stardust::encode(&Request {
    blackhole: "people/erase-ada",
    digest: &approval.digest,
    confirm: &approval.confirm,
    actor: "ops",
    reason: "Erasure request",
})?;
let result = db.blackholes().execute(&request)?;
TRON485 B
Offset (hex)Bytes (hex)Meaning
00054 52 4F 4Emagic TRON
0047C 23736861323536txt "#sha256"
00C14 40 653133346232 6264323466646563 3961343264343261 6463366665623337 3636366635366239 6532363436386266 6634613462623739 3830643962613966 3631txt "e134b2bd24fdec9a42d42adc…"
04E0F 0A 04000000 0C00 0000map leaf, size 10: @4 → @C
0587C 23736861323536txt "#sha256"
06014 40 313736303466 6137386363663365 3664636632303265 6639346563646132 3739643165393666 3035326664373039 6561666435326663 3033306161663031 3936txt "17604fa78ccf3e6dcf202ef9…"
0A20F 0A 58000000 6000 0000map leaf, size 10: @58 → @60
0ACCC 65666665637444 6967657374txt "effectDigest"
0B90F 0A AC000000 A200 0000map leaf, size 10: @AC → @A2
0C3CC 7265706C616365 6D656E7473txt "replacements"
0D002 00000000000000 00i64 0
0D90F 0A C3000000 D000 0000map leaf, size 10: @C3 → @D0
0E37C 74617267657473txt "targets"
0EB02 01000000000000 00i64 1
0F40F 0A E3000000 EB00 0000map leaf, size 10: @E3 → @EB
0FE07 0E 08200000 D900 0000 F4000000map branch, size 14, depth 1, slots 3, 13: @D9 → @F4
10C7C 6D617463686564txt "matched"
11402 01000000000000 00i64 1
11D0F 0A 0C010000 1401 0000map leaf, size 10: @10C → @114
127DC 72657175657374 446967657374txt "requestDigest"
1350F 0A 27010000 4E00 0000map leaf, size 10: @127 → @4E
13FBC 7472616E736163 74696F6Etxt "transaction"
14B02 08000000000000 00i64 8
1540F 0A 3F010000 4B01 0000map leaf, size 10: @13F → @14B
15E6C 6375746F6666txt "cutoff"
16502 07000000000000 00i64 7
16E0F 0A 5E010000 6501 0000map leaf, size 10: @15E → @165
1785C 7374616765txt "stage"
17E8C 636F6D706C6574 65txt "complete"
1870F 0A 78010000 7E01 0000map leaf, size 10: @178 → @17E
1918C 72656D6F76616C 73txt "removals"
19A02 01000000000000 00i64 1
1A30F 0A 91010000 9A01 0000map leaf, size 10: @191 → @19A
1AD07 0E 000C0000 8701 0000 A3010000map branch, size 14, depth 1, slots 10, 11: @187 → @1A3
1BB07 22 720E0000 B900 0000 FE000000 1D01 0000 35010000 5401 0000 6E010000 AD01 0000map branch, size 34, depth 0 (root), slots 1, 4, 5, 6, 9, 10, 11: @B9 → @FE → @11D → @135 → @154 → @16E → @1AD

C exports: stardust_db_plugin_call, stardust_result_take_document, stardust_result_error, stardust_result_release

Blackholes::audit

rust67 B
pub fn audit(&self, options: Option<&Document>) -> Result<Document>

Parameters

ParameterTypeOwnershipDefaultMeaning
self&SelfBorrowed for the callRequiredThe blackholes owner for this operation. Keep it alive during the call.
optionsOption<&Document>Borrowed for the callAbsent selects operation defaultsThe borrowed options, or none: {[after] [limit]}.

Errors

StatusWhen
Status::INVALID_ARGUMENToptions is not an object, or an option is invalid or unsupported
Status::UNAVAILABLEthe database does not enable the blackholes plugin
Status::CLOSEDthe database is closed
Status::OUT_OF_MEMORYnative memory is exhausted

Notes

The plugin does not copy removed values or invocation parameters into the audit. Keep sensitive information out of actor and reason. See the audit.

Examples

List Blackholes audit records

rust113 B
let options = stardust::parse("{limit 100}", Format::DUST)?;
let result = db.blackholes().audit(Some(&options))?;
TRON21 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
040E 09 00 0000 000000 00array leaf, size 9, shift 0, bitmap 0000, count 0 (root)

C exports: stardust_db_plugin_call, stardust_result_take_document, stardust_result_error, stardust_result_release

Blackholes::status

rust40 B
pub fn status(&self) -> Result<Document>

Parameters

ParameterTypeOwnershipDefaultMeaning
self&SelfBorrowed for the callRequiredThe blackholes owner for this operation. Keep it alive during the call.

Errors

StatusWhen
Status::UNAVAILABLEthe database does not enable the blackholes plugin
Status::CLOSEDthe database is closed
Status::OUT_OF_MEMORYnative memory is exhausted

Examples

Check Blackholes status

rust39 B
let result = db.blackholes().status()?;
TRON130 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
046C 617564697473txt "audits"
0B02 00000000000000 00i64 0
140F 0A 04000000 0B00 0000map leaf, size 10: @4 → @B
1EAC 7265636F766572 696E67txt "recovering"
2901bit false
2A0F 0A 1E000000 2900 0000map leaf, size 10: @1E → @29
347C 656E61626C6564txt "enabled"
3C09bit true
3D0F 0A 34000000 3C00 0000map leaf, size 10: @34 → @3C
4707 0E 50000000 2A00 0000 3D000000map branch, size 14, depth 1, slots 4, 6: @2A → @3D
557C 6261636B757073txt "backups"
5D01bit false
5E0F 0A 55000000 5D00 0000map leaf, size 10: @55 → @5D
6807 12 22040000 1400 0000 47000000 5E00 0000map branch, size 18, depth 0 (root), slots 1, 5, 10: @14 → @47 → @5E

C exports: stardust_db_plugin_call, stardust_result_take_document, stardust_result_error, stardust_result_release