File: CHANGES.md

package info (click to toggle)
libvmod-selector 2.6.0-5.1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 1,932 kB
  • sloc: ansic: 2,807; makefile: 126; sh: 75; ruby: 36
file content (94 lines) | stat: -rw-r--r-- 3,234 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# Changelog

## Refactoring and breaking changes

The merge ending in commit 15c11469fc403495d9364f3dafec85a032e1bbb9 on
October 16, 2020 introduced breaking changes and a major refactoring
of the VMOD. The highlights are:

- Set initialization in `vcl_init` requires that the `.compile()`
  method is invoked after all of the strings are added. This matches
  the idiom of VMOD re2.

- Some error conditions now invoke VCL failure, whereas previously
  methods returned a "distinguished error" value (such as NULL for a
  backend or string), which meant that incorrect usages could go
  undetected.

- Some means have been added to safeguard against VCL failure.

- Methods that retrieve data from the set now have the `element`
  parameter, which makes it possible to use sets as associative
  arrays (lookup by string).

- The implementations of the `.match()` and `.hasprefix()` methods
  have been refactored, and are considerably faster.

In detail:

### Changed

- `.compile()` is now required in `vcl_init` after adding all strings
  to the set.

- Methods that have the `n` parameter invoke VCL failure if `n` is
  greater than the number of strings in the set. This affects:
  `.matched()`, `.element()`, `.string()`, `.integer()`, `.backend()`,
  `.re_match()` and `.sub()`.

- Methods with the `select` parameter invoke VCL failure when `select`
  is used, and:

  - There was no prior invocation of `.match()` or `hasprefix()`.

  - The previous invocation of `.match()` or `.hasprefix()` failed
    (returned false).

  - `select=UNIQUE` and the previous invocation had more than one
    match.

  - `select=EXACT` and the previous invocation had no exact match.

  - But `.matched()` does *not* invoke VCL failure if `select=UNIQUE`
    or `EXACT` is specified, but their criteria are not
    met. `matched()` just returns `false` in such cases. This makes it
    possible to avoid VCL failure for subsequent uses of the two
    enums.

  Affects: `.matched()`, `.which()`, `.element()`, `.string()`,
  `.integer()`, `.backend()`, `.re_match()` and `.sub()`.

- `.match()` and `.hasprefix()` invoke VCL failure if no strings
  were added to the set.

- `.nmatches()` invokes VCL failure if there was no previous
  invocation of `.match()` or `.hasprefix()` in the same task scope.

- The internal PT implementation (patricia trie), which was used for
  both of `.match()` and `.hasprefix()`, has been replaced with PH
  (perfect hash) for `.match()` and QP (quadbit patricia) for
  `hasprefix()`.

- The implementation-specific stats counters have been replaced. See
  [STATISTICS.md](STATISTICS.md).

### Added

- `.compile()`

- The `allow_overlaps` flag in the set constructor. If set to `false`,
  then VCL load fails if there are strings in the set with common
  prefixes. This is meant to ensure that `select=UNIQUE` can always be
  used safely, for use cases in which common prefixes should not ever
  exist.

- The `element` parameter, for lookups by string. Affects:
  `.matched()`, `.which()`, `.string()`, `.integer()`, `.backend()`,
  `.re_match()` and `.sub()`.

- Benchmark code and test data for PH and QP, see the
  [README](src/tests/bench/README.md).

### Removed

The undocumented `.debug()` method.