]> git.ipfire.org Git - thirdparty/squid.git/commit - src/acl/FilledChecklist.h
Extracted transaction state storage and related checks from ACLChecklist into
authorAlex Rousskov <rousskov@measurement-factory.com>
Sun, 8 Mar 2009 19:41:27 +0000 (13:41 -0600)
committerAlex Rousskov <rousskov@measurement-factory.com>
Sun, 8 Mar 2009 19:41:27 +0000 (13:41 -0600)
commit351fe86d54733fd51afc5acf8d9a7fb3cdc1f028
treeb3f763b90d180791c0fe0ce61c7400994da5f311
parentbcf44a2cdf79dd9b6ac6f0b1bd35b18289cc1de8
Extracted transaction state storage and related checks from ACLChecklist into
ACLFilledChecklist. Context: SourceLayout: acl/, take 1

ACLChecklist contained many data members representing the state of the current
transaction (in a broad sense). These members and related methods depended
on complex types such as HttpRequest and ConnStateData. Any Squid code using
ACLChecklist (and there is a lot of that code) was, hence, dependent on these
types. These dependencies caused, among other things, huge SOURCES lists in
src/Makefile.am, often for trivial targets such as ufsdump and test cases.

ACLChecklist is an abstract class now (to make sure we do not accidentally
create it). ACLChecklist has only one kid: ACLFilledChecklist. The Filled()
global function can be used to cast ACLChecklist* to ACLFilledChecklist*.
Since all ACLChecklist objects have to be ACLFilledChecklist objects, the cast
is fast and safe. The cast allows us to avoid bloating ACLChecklist with
virtual methods that only make sense in ACLFilledChecklist context.

ACLFilledChecklist now contains state-specific members while ACLChecklist
contains basic check list logic. The code that organizes or passes through
ACL checks does not need to be exposed to ACLFilledChecklist and the data
types it depends on.

Furthermore, ACLFilledChecklist should not contain complicated checks either.
It should focus on maintaining the state. The checks should go into specific
ACLs. Otherwise, complex checks cause dependency cycles with higher-level
libraries that provide code for those checks and yet depend on having access
to ACLFilledChecklist to implement specific ACLs. Currently, only the
authenticated() method got moved to auth/Acl.{cc,h} to break the circular
dependency between acl/libs and auth/libs. More work in that direction will
probably be required as we move more src/* code into libraries.

ACLFilledChecklist constructor replaces aclChecklistCreate global. This
simplifies the initiating code of all fast ACL checks: the checks no longer
need to do manual state locking, duplicating aclChecklistCreate code.
src/ACLChecklist.cci [deleted file]
src/acl/Checklist.cc [moved from src/ACLChecklist.cc with 59% similarity]
src/acl/Checklist.h [moved from src/ACLChecklist.h with 73% similarity]
src/acl/FilledChecklist.cc [new file with mode: 0644]
src/acl/FilledChecklist.h [new file with mode: 0644]