1 |
This is another attempt to prepare the way for including metascan, this |
2 |
time based on a new restriction framework (which has absolutely nothing |
3 |
to do with the one in savior/bcportage) included in the attached and |
4 |
completely undocumented patch (once you get the concept it should be |
5 |
self-explanatory however). |
6 |
It basically consists of three class hierarchies: |
7 |
- dataclasses responsibe for delivering the data to match against |
8 |
- filterclasses implementing the match algorithms |
9 |
- boolean connectors to combine multiple restrictions |
10 |
There is a fourth type called prefilter that can adjust the match |
11 |
algorithm of filter classes (e.g. a Split() class to break multi-value |
12 |
metadata fields up for the string matchers). |
13 |
|
14 |
The filterclasses and connectors implement the same interface for |
15 |
performing the matches, so the most basic application would be: |
16 |
|
17 |
for cpv in cpvlist: |
18 |
if restriction.filter.PartialMatch(data.Metadata(key, db), value).match(cpv): |
19 |
matches.append(cpv) |
20 |
|
21 |
For a more complex application see the patched emerge or metascan2 |
22 |
(at d.g.o/~genone/scripts). |
23 |
|
24 |
A word of warning: I've just written all this code in the past few hours, |
25 |
it is absolutely unoptimized, incomplete and certainly has bugs (none known |
26 |
though). |
27 |
That also means I'm not interested in comments about the code or algorithm |
28 |
yet, as this needs a lot of work and so far I've only done the work to get |
29 |
it working, mainly sending this mail so people can play with it a bit. |
30 |
|
31 |
Marius |
32 |
|
33 |
-- |
34 |
Public Key at http://www.genone.de/info/gpg-key.pub |
35 |
|
36 |
In the beginning, there was nothing. And God said, 'Let there be |
37 |
Light.' And there was still nothing, but you could see a bit better. |