Page Speed Optimization Libraries  1.13.35.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
fallback_property_page.h
Go to the documentation of this file.
1 /*
2  * Copyright 2013 Google Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http:///www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
23 
24 #ifndef PAGESPEED_OPT_HTTP_FALLBACK_PROPERTY_PAGE_H_
25 #define PAGESPEED_OPT_HTTP_FALLBACK_PROPERTY_PAGE_H_
26 
31 #include "pagespeed/kernel/cache/cache_interface.h"
33 
34 namespace net_instaweb {
35 
36 class GoogleUrl;
37 
39  public:
41  FallbackPropertyPage(PropertyPage* actual_property_page,
42  PropertyPage* property_page_with_fallback_values);
43  virtual ~FallbackPropertyPage();
44 
47  virtual PropertyValue* GetProperty(
48  const PropertyCache::Cohort* cohort,
49  const StringPiece& property_name);
50 
54  const PropertyCache::Cohort* cohort,
55  const StringPiece& property_name);
56 
59  virtual void UpdateValue(
60  const PropertyCache::Cohort* cohort, const StringPiece& property_name,
61  const StringPiece& value);
62 
65  virtual void WriteCohort(const PropertyCache::Cohort* cohort);
66 
69  const PropertyCache::Cohort* cohort);
70 
73  const PropertyCache::Cohort* cohort);
74 
76  virtual void DeleteProperty(const PropertyCache::Cohort* cohort,
77  const StringPiece& property_name);
78 
79  PropertyPage* actual_property_page() { return actual_property_page_.get(); }
80  PropertyPage* property_page_with_fallback_values() {
81  return property_page_with_fallback_values_.get();
82  }
83 
86  static GoogleString GetFallbackPageUrl(const GoogleUrl& request_url);
87 
89  static bool IsFallbackUrl(const GoogleString& url);
90 
91  private:
92  scoped_ptr<PropertyPage> actual_property_page_;
93  scoped_ptr<PropertyPage> property_page_with_fallback_values_;
94 
95 };
96 
97 }
98 #endif
class GoogleUrl
Definition: google_url.h:58
Abstract interface for implementing a PropertyPage.
Definition: property_cache.h:291
Holds the value & stability-metadata for a property.
Definition: property_cache.h:122
PropertyValue * GetFallbackProperty(const PropertyCache::Cohort *cohort, const StringPiece &property_name)
Definition: property_cache.h:186
static bool IsFallbackUrl(const GoogleString &url)
Returns true if given url is for fallback properties.
virtual void DeleteProperty(const PropertyCache::Cohort *cohort, const StringPiece &property_name)
Deletes a property given the property name from both the pages.
virtual PropertyValue * GetProperty(const PropertyCache::Cohort *cohort, const StringPiece &property_name)
Definition: property_cache.h:323
static GoogleString GetFallbackPageUrl(const GoogleUrl &request_url)
KeyState
Definition: cache_interface.h:34
Definition: scoped_ptr.h:30
std::string GoogleString
PAGESPEED_KERNEL_BASE_STRING_H_.
Definition: string.h:24
virtual CacheInterface::KeyState GetFallbackCacheState(const PropertyCache::Cohort *cohort)
Gets the cache state of the property page with fallback values.
virtual void UpdateValue(const PropertyCache::Cohort *cohort, const StringPiece &property_name, const StringPiece &value)
virtual CacheInterface::KeyState GetCacheState(const PropertyCache::Cohort *cohort)
Gets the cache state for the actual property page.
virtual void WriteCohort(const PropertyCache::Cohort *cohort)
FallbackPropertyPage(PropertyPage *actual_property_page, PropertyPage *property_page_with_fallback_values)
FallbackPropertyPage takes the ownership of both the property pages.
Definition: fallback_property_page.h:38