Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #ifndef CongestionDB_H_
00036 #define CongestionDB_H_
00037
00038 #include "P_EventSystem.h"
00039 #include "MT_hashtable.h"
00040 #include "ControlMatcher.h"
00041
00042
00043 class CongestionControlRecord;
00044 struct CongestionEntry;
00045
00046 typedef MTHashTable<uint64_t, CongestionEntry *>CongestionTable;
00047 typedef HashTableIteratorState<uint64_t, CongestionEntry *>Iter;
00048
00049
00050
00051 Action *get_congest_entry(Continuation * cont, HttpRequestData * data, CongestionEntry ** ppEntry);
00052 Action *get_congest_list(Continuation * cont, MIOBuffer * buffer, int format = 0);
00053 void remove_all_congested_entry(void);
00054 void remove_congested_entry(uint64_t key);
00055 void remove_congested_entry(char *buf, MIOBuffer * out_buffer);
00056 void revalidateCongestionDB();
00057 void initCongestionDB();
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069 struct CongestRequestParam
00070 {
00071 enum Op_t
00072 {
00073 ADD_RECORD,
00074 REMOVE_RECORD,
00075 REMOVE_ALL_RECORDS,
00076 REVALIDATE_BUCKET
00077 };
00078
00079 CongestRequestParam():m_key(0), m_op(REVALIDATE_BUCKET), m_pEntry(NULL)
00080 {
00081 }
00082
00083 ~CongestRequestParam()
00084 {
00085 }
00086
00087 uint64_t m_key;
00088 Op_t m_op;
00089 CongestionEntry *m_pEntry;
00090
00091 LINK(CongestRequestParam, link);
00092 };
00093
00094
00095 class CongestionDB:public CongestionTable
00096 {
00097 public:
00098 CongestionDB(int tablesize);
00099 ~CongestionDB();
00100 bool congested(uint64_t key);
00101
00102
00103 void addRecord(uint64_t key, CongestionEntry * pEntry);
00104
00105 void removeRecord(uint64_t key);
00106 void removeAllRecords(void);
00107 InkAtomicList *todo_lists;
00108 void RunTodoList(int buckId);
00109 void process(int buckId, CongestRequestParam * param);
00110 void revalidateBucket(int buckId);
00111 };
00112
00113 extern CongestionDB *theCongestionDB;
00114
00115 #endif