Page Speed Optimization Libraries
1.13.35.1
|
#include "resource_namer.h"
Public Member Functions | |
bool | Decode (const StringPiece &encoded_string, int hash_length, int signature_length) |
Encoding and decoding in various formats. More... | |
bool | DecodeIgnoreHashAndSignature (StringPiece encoded_string) |
GoogleString | Encode () const |
GoogleString | EncodeIdName () const |
int | EventualSize (const Hasher &hasher, int signature_length) const |
Note: there is no need at this time to decode the name key. More... | |
StringPiece | id () const |
Simple getters. | |
StringPiece | options () const |
StringPiece | name () const |
StringPiece | hash () const |
StringPiece | ext () const |
StringPiece | experiment () const |
StringPiece | signature () const |
bool | has_experiment () const |
bool | has_options () const |
void | set_id (const StringPiece &p) |
Simple setters. | |
void | set_options (const StringPiece &opts) |
void | set_name (const StringPiece &n) |
void | set_hash (const StringPiece &h) |
void | set_ext (const StringPiece &e) |
void | set_experiment (const StringPiece &e) |
void | set_signature (const StringPiece &s) |
void | ClearHash () |
Other setter-like operations. | |
void | CopyFrom (const ResourceNamer &other) |
GoogleString | PrettyName () const |
Utility functions. More... | |
Static Public Attributes | |
static const int | kOverhead |
Encapsulates the naming of resource URL leafs. The class holds the context of a single resource, and is not intended for re-use. We could, of course, add a Clear(), but it is a stateful class.
bool net_instaweb::ResourceNamer::Decode | ( | const StringPiece & | encoded_string, |
int | hash_length, | ||
int | signature_length | ||
) |
Encoding and decoding in various formats.
Decodes an entire resource name (NAME.pagespeed[.EXPT].ID.HASH[|SIG].EXT), placing the result in the fields in this encoder.
bool net_instaweb::ResourceNamer::DecodeIgnoreHashAndSignature | ( | StringPiece | encoded_string | ) |
Calls Decode() passing values of -1, -1 for hash and signature lengths. Hash and signature outputs from this must not be used.
GoogleString net_instaweb::ResourceNamer::Encode | ( | ) | const |
Encodes the fields in this encoder into an absolute url, with the trailing portion "NAME.pagespeed[.(EXPT|PsolOpts)].ID.HASH[.SIG].EXT".
GoogleString net_instaweb::ResourceNamer::EncodeIdName | ( | ) | const |
Encode a key that can used to do a lookup based on an id and the name. This key can be used to find the hash-code for a resource within the origin TTL.
The 'id' is a short code indicating which Instaweb rewriter was used to generate the resource.
int net_instaweb::ResourceNamer::EventualSize | ( | const Hasher & | hasher, |
int | signature_length | ||
) | const |
Note: there is no need at this time to decode the name key.
Eventual length of name. Gets eventual hash length from passed in hasher and signature_length. Needed by RewriteDriver to check that filenames aren't too long.
|
inline |
Utility functions.
Name suitable for debugging and logging
|
inline |
|
static |
This determines the overhead imposed on each URL by the ResourceNamer syntax, such as separators.