ArangoPreservesTrait
Reads and validates the `[arango.preserves]` config section — the rules of the `preserve` and `reinject` actions.
One table per collection (edge collections included), keyed by its name :
[arango.preserves.articles]
filters = { _key = "string" }
filter = '{"key":"_key","op":"nsw","val":"src:"}'
maxPercent = 50 # optional, 50 by default
The rule says which documents of the collection belong to this machine —
a property of the local database, like [arango.restore].protected, which is
why it lives outside the dump/restore profiles. Everything that cannot be read
is refused before anything is written ; see preserveFilters().
Tags
Table of Contents
Properties
- $preserves : array<string|int, mixed>
- The declared rules, from the `[arango.preserves]` config section.
Methods
- initializeArangoPreserves() : static
- Captures the `[arango.preserves]` config section from the init array.
- preserveCount() : int
- Runs a query that returns a single number, and returns it.
- preserveFilters() : array<string, PreserveFilter>
- The compiled rules of the requested collections, keyed and sorted by name.
- preserveFilter() : PreserveFilter
- Validates one `[arango.preserves.<collection>]` rule and compiles it.
Properties
$preserves
The declared rules, from the `[arango.preserves]` config section.
protected
array<string|int, mixed>
$preserves
= []
Methods
initializeArangoPreserves()
Captures the `[arango.preserves]` config section from the init array.
public
initializeArangoPreserves([array<string|int, mixed> $init = [] ]) : static
Parameters
- $init : array<string|int, mixed> = []
Return values
staticpreserveCount()
Runs a query that returns a single number, and returns it.
protected
preserveCount(Database $db, AqlQuery $query) : int
Parameters
Return values
intpreserveFilters()
The compiled rules of the requested collections, keyed and sorted by name.
protected
preserveFilters([array<int, string> $only = [] ]) : array<string, PreserveFilter>
Parameters
- $only : array<int, string> = []
-
The collections named on the command line ; empty means every declared rule.
Tags
Return values
array<string, PreserveFilter>preserveFilter()
Validates one `[arango.preserves.<collection>]` rule and compiles it.
private
preserveFilter(string $collection, mixed $definition) : PreserveFilter
Parameters
- $collection : string
-
The collection the rule is declared for.
- $definition : mixed
-
The rule as the configuration gives it.