Page Speed Optimization Libraries
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Namespaces | Enumerations | Functions | Variables
critical_finder_support_util.h File Reference
#include "net/instaweb/rewriter/critical_keys.pb.h"
#include "net/instaweb/util/public/property_cache.h"
#include "pagespeed/kernel/base/basictypes.h"
#include "pagespeed/kernel/base/string.h"
#include "pagespeed/kernel/base/string_util.h"
#include "pagespeed/kernel/base/timer.h"

Go to the source code of this file.


struct  net_instaweb::BeaconMetadata


 Unit-test framework for wget fetcher.


enum  BeaconStatus { kDoNotBeacon, kBeaconNoNonce, kBeaconWithNonce }
enum  net_instaweb::CriticalKeysWriteFlags { net_instaweb::kNoRequirementsOnPriorResult = 0, kReplacePriorResult = 1, kRequirePriorSupport = 2, kSkipNonceCheck = 4 }


bool net_instaweb::ValidateAndExpireNonce (int64 now_ms, StringPiece nonce, CriticalKeys *critical_keys)
void net_instaweb::GetCriticalKeysFromProto (int64 support_percentage, const CriticalKeys &critical_keys, StringSet *keys)
void net_instaweb::UpdateCriticalKeys (bool require_prior_support, const StringSet &new_set, int support_value, CriticalKeys *critical_keys)
bool net_instaweb::ShouldBeacon (int64 next_beacon_timestamp_ms, const RewriteDriver &driver)
void net_instaweb::WriteCriticalKeysToPropertyCache (const StringSet &new_keys, StringPiece nonce, int support_interval, CriticalKeysWriteFlags flags, StringPiece property_name, const PropertyCache *cache, const PropertyCache::Cohort *cohort, AbstractPropertyPage *page, MessageHandler *message_handler, Timer *timer)
void net_instaweb::PrepareForBeaconInsertionHelper (CriticalKeys *proto, NonceGenerator *nonce_generator, RewriteDriver *driver, bool using_candidate_key_detection, BeaconMetadata *result)
bool net_instaweb::UpdateCandidateKeys (const StringSet &keys, CriticalKeys *proto, bool clear_rebeacon_timestamp)
bool net_instaweb::IsBeaconDataAvailable (const CriticalKeys &proto)


const int64 net_instaweb::kBeaconTimeoutIntervalMs = Timer::kMinuteMs
const int64 net_instaweb::kHighFreqBeaconCount = 3
const int64 net_instaweb::kLowFreqBeaconMult = 100
const int64 net_instaweb::kNonceExpirationLimit = 5

Detailed Description

This contains some utilities for working with the critical_keys proto, and for updating support values. This is primarily used by CriticalSelectorFinder and CriticalImagesFinder. These finders use the critical_keys proto to store a "support value" for each possible key (image URL or selector name) in the property cache. When a beacon result arrives, the support for each critical key in the result is increased by support_interval. When a new beacon is sent, existing support is decayed by multiplying by support_interval/(support_interval+1) and rounding down. This means that a single key returned with a beacon will be considered critical until support_interval subsequent beacons have been injected. Because support decays exponentially, repeated support for a key in multiple beacon results cause that key to be considered critical longer: two beacon results will expire after somewhat less than twice as long, three after rather less than three times as long, and so forth. This class also handles converting over old protobufs that did not use the support system.