Page Speed Optimization Libraries  1.13.35.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | List of all members
net_instaweb::RewriteOptions::ExperimentSpec Class Reference

#include "rewrite_options.h"

Classes

struct  AlternateOriginDomainSpec
 

Public Member Functions

 ExperimentSpec (const StringPiece &spec, const RewriteOptions *options, MessageHandler *handler)
 
 ExperimentSpec (int id)
 
virtual ExperimentSpecClone ()
 Return a ExperimentSpec with all the same information as this one.
 
bool is_valid () const
 
int id () const
 Accessors.
 
int percent () const
 
const GoogleStringga_id () const
 
int slot () const
 
RewriteLevel rewrite_level () const
 
FilterSet enabled_filters () const
 
FilterSet disabled_filters () const
 
OptionSet filter_options () const
 
bool matches_device_type (UserAgentMatcher::DeviceType type) const
 
bool use_default () const
 
GoogleString ToString () const
 
void ApplyAlternateOriginsToDomainLawyer (DomainLawyer *domain_lawyer, MessageHandler *handler) const
 Mutate the origin domains in DomainLawyer with alternate_origin_domains_.
 

Protected Types

typedef std::bitset
< net_instaweb::UserAgentMatcher::kEndOfDeviceType
DeviceTypeBitSet
 

Protected Member Functions

void Merge (const ExperimentSpec &spec)
 

Static Protected Member Functions

static bool ParseDeviceTypeBitSet (const StringPiece &in, DeviceTypeBitSet *out, MessageHandler *handler)
 
static bool LooksLikeValidHost (const StringPiece &s)
 
static bool ParseAlternateOriginDomain (const StringPiece &in, AlternateOriginDomainSpec *out, MessageHandler *handler)
 
static void CombineQuotedHostPort (StringPieceVector *vec, size_t first_pos, GoogleString *combined_container)
 
static GoogleString QuoteHostPort (const GoogleString &in)
 

Detailed Description

This class is a separate subset of options for running an experiment. These options can be specified by a spec string that looks like: "id=<number greater than 0>;level=<rewrite level>="">;enabled= <comma-separated-list of filters to enable>;disabled= <comma-separated-list of filters to disable>;options= <comma-separated-list of option=value pairs to set>.

Constructor & Destructor Documentation

net_instaweb::RewriteOptions::ExperimentSpec::ExperimentSpec ( const StringPiece &  spec,
const RewriteOptions options,
MessageHandler handler 
)

Creates a ExperimentSpec parsed from spec. If spec doesn't have an id, then id_ will be set to experiment::kExperimentNotSet. These ExperimentSpecs will then be rejected by AddExperimentSpec().

net_instaweb::RewriteOptions::ExperimentSpec::ExperimentSpec ( int  id)
explicit

Creates a ExperimentSpec with id_=id. All other variables are initialized to 0. This is primarily used for setting up the control and for cloning.

Member Function Documentation

static void net_instaweb::RewriteOptions::ExperimentSpec::CombineQuotedHostPort ( StringPieceVector *  vec,
size_t  first_pos,
GoogleString combined_container 
)
staticprotected

Combine consecutive entries in a StringPieceVector such that [ a, b, "host, port" ] can be turned into [ a, b, host:port ]. Inspects vec[first_pos] and vec[first_pos + 1]. If they appear to be a quoted tuple, will replace vec[first_pos] with a combined value and vec[first_pos + 1] will be removed, ie: vec will reduce in size by 1. combined_container is used as the underlying storage for the combined string, if necessary.

static bool net_instaweb::RewriteOptions::ExperimentSpec::LooksLikeValidHost ( const StringPiece &  s)
staticprotected

Simple check that 's' is not obviously an invalid host. Used to avoid problems when a port number is accidentally placed in a host field.

void net_instaweb::RewriteOptions::ExperimentSpec::Merge ( const ExperimentSpec spec)
protected

Merges a spec into this. This follows the same semantics as RewriteOptions. Specifically, filter/options list get unioned, and vars get overwritten, except ID. In the event of a conflict, e.g. preserve vs extend_cache, *this will take precedence.

static bool net_instaweb::RewriteOptions::ExperimentSpec::ParseAlternateOriginDomain ( const StringPiece &  in,
AlternateOriginDomainSpec out,
MessageHandler handler 
)
staticprotected

Parses the string after an 'alternate_origin_domain' experiment option, returning if it was successfull. If it returns false, the spec is invalid and should be discarded.

static GoogleString net_instaweb::RewriteOptions::ExperimentSpec::QuoteHostPort ( const GoogleString in)
staticprotected

Returns a copy of the input string that will be surrounded by double quotes if the input string contains a colon. This is used to turn host:port into "host:port" when printing an ExperimentSpec.


The documentation for this class was generated from the following file: