]> git.ipfire.org Git - thirdparty/squid.git/blame - src/adaptation/ServiceGroups.h
Bug #2459 fix, access logging enhancements, ICAP logging and retries support:
[thirdparty/squid.git] / src / adaptation / ServiceGroups.h
CommitLineData
62c7f90e
AR
1#ifndef SQUID_ADAPTATION__SERVICE_GROUPS_H
2#define SQUID_ADAPTATION__SERVICE_GROUPS_H
3
8e57fe25
AR
4#include "SquidString.h"
5#include "Array.h"
62c7f90e
AR
6#include "adaptation/forward.h"
7
26ac0430
AJ
8namespace Adaptation
9{
62c7f90e
AR
10
11// Interface for grouping adaptation services together.
12// Specific groups differ in how the first and the next services are selected
13class ServiceGroup
14{
15public:
16 typedef Vector<String> Store;
17 typedef Store::iterator iterator;
18 typedef String Id;
19
20 // Information sufficient to iterate services stored in the group,
21 // grouped together to simplify initial/sequentialServices interfaces.
26ac0430 22 // The iterators point back to
62c7f90e
AR
23 struct Loop {
24 Loop(const iterator &b, const iterator &e): begin(b), end(e) {}
b6b637eb
AR
25 iterator begin;
26 iterator end;
27 };
62c7f90e
AR
28
29public:
30 ServiceGroup(const String &aKind);
31 virtual ~ServiceGroup();
32
33 virtual void parse();
34 virtual void finalize(); // called after all are parsed
35
36 virtual Loop initialServices() = 0;
37 // TODO: virtual Loop sequentialServices() = 0;
38
39public:
40 String kind;
41 Id id;
42 Store services;
43};
44
45// a group of equivalent services; one service per set is usually used
46class ServiceSet: public ServiceGroup
47{
48public:
49 ServiceSet();
50 virtual Loop initialServices();
51};
52
53// corner case: a group consisting of one service
54class SingleService: public ServiceGroup
55{
56public:
57 SingleService(const String &aServiceKey);
58 virtual Loop initialServices();
59};
60
61// TODO: a group of services that must be used one after another
62// class ServiceChain: public ServiceGroup
63
64
65typedef Vector<Adaptation::ServiceGroup*> Groups;
66extern Groups &AllGroups();
67extern ServiceGroup *FindGroup(const ServiceGroup::Id &id);
68
69
70} // namespace Adaptation
71
72#endif /* SQUID_ADAPTATION__SERVICE_GROUPS_H */
73