1. 17 Sep, 2020 3 commits
  2. 16 Sep, 2020 1 commit
    • Geoff Simmons's avatar
      Extend .matched(), and invoke VCL failure for more error conditions. · 78b0f570
      Geoff Simmons authored
      VCL failure is invoked if:
      - no entries were added to a set
      - a set was not compiled
      - .compile() is called in a VCL sub other than vcl_init
      - a numeric index is out of range (larger than nmembers)
      - the conditions for UNIQUE or EXACT fail
      - associated data to be retrieved (string, backend etc) was not added
      
      If .match() or .hasprefix() are called with a NULL subject, it is
      logged using tag Notice, but is not an error (return value is false).
      This is because it may or may not be intentional to attempt a match
      against an unset header.
      
      The .matched() method now may have a select argument, and works
      similarly to other methods with the f(INT n, ENUM select) signature,
      except that it returns false when the select condition fails, but
      does not invoke VCL failure. This makes it possible to check if
      UNIQUE or EXACT may be used, and avoid VCL failure if desired.
      78b0f570
  3. 13 Sep, 2020 1 commit
  4. 08 Sep, 2020 3 commits
  5. 07 Sep, 2020 9 commits
  6. 04 Sep, 2020 2 commits
  7. 01 Sep, 2020 2 commits
  8. 13 Jun, 2020 6 commits
  9. 05 Jun, 2020 1 commit
  10. 04 Jun, 2020 2 commits
  11. 03 Jun, 2020 2 commits
  12. 02 Jun, 2020 4 commits
  13. 01 Jun, 2020 2 commits
    • Geoff Simmons's avatar
      malloc the temp array used for sorting in .compile(). · 599fb3ac
      Geoff Simmons authored
      For large sets, workspace could be too small.
      599fb3ac
    • Geoff Simmons's avatar
      Implement perfect hashing based on universal hashing. · 278d6968
      Geoff Simmons authored
      Universal hashing has a sounder theoretical basis; in particular, it
      doesn't have the dubious minimum hash table size below which a
      perfect hash may not be possible, and which was set by trial and error.
      
      For nearly all test data, universal hashing performs at least as
      well or better. Especially better for sets with longer strings,
      since the subject string is cast as an array of uint32_t, so the
      hash is computed in fewer operations.
      
      The only exception I've noticed is /usr/share/dict/words, which now
      appears to have more collisions than under the previous approach.
      But it appears likely that this only becomes an issue for sets that
      are much larger than are probable for VCL use cases (in the 100,000
      range), and if all of the sets' elements are tested for matches
      about equally often (whereas real-world usage patterns tend to
      match a subset much more frequently).
      278d6968
  14. 31 May, 2020 2 commits