Page Speed Optimization Libraries  1.13.35.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
property_store.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 
21 #ifndef PAGESPEED_OPT_HTTP_PROPERTY_STORE_H_
22 #define PAGESPEED_OPT_HTTP_PROPERTY_STORE_H_
23 
30 
31 namespace net_instaweb {
32 
33 class AbstractMutex;
34 class PropertyCacheValues;
35 class PropertyValueProtobuf;
36 class Statistics;
37 class Timer;
38 
42  public:
44  PropertyStore();
45  virtual ~PropertyStore();
46 
56  virtual void Get(
57  const GoogleString& url,
58  const GoogleString& options_signature_hash,
59  const GoogleString& cache_key_suffix,
60  const PropertyCache::CohortVector& cohort_list,
61  PropertyPage* page,
62  BoolCallback* done,
63  AbstractPropertyStoreGetCallback** callback) = 0;
64 
69  virtual void Put(
70  const GoogleString& url,
71  const GoogleString& options_signature_hash,
72  const GoogleString& cache_key_suffix,
73  const PropertyCache::Cohort* cohort,
74  const PropertyCacheValues* values,
75  BoolCallback* done) = 0;
76 
80  bool enable_get_cancellation() { return enable_get_cancellation_; }
81  void set_enable_get_cancellation(bool x) { enable_get_cancellation_ = x; }
82 
88  virtual GoogleString Name() const = 0;
89 
90  private:
91  bool enable_get_cancellation_;
92 
93 };
94 
109  public:
112  AbstractMutex* mutex,
113  PropertyPage* page,
114  bool is_cancellable,
115  BoolCallback* done,
116  Timer* timer);
117  virtual ~PropertyStoreGetCallback();
118 
119  static void InitStats(Statistics* statistics);
120 
123  virtual void FastFinishLookup();
125  virtual void DeleteWhenDone();
131  const PropertyCache::Cohort* cohort,
132  const PropertyValueProtobuf& pcache_value,
133  int64 min_write_timestamp_ms);
134 
137  void Done(bool success);
138 
139  protected:
140  AbstractMutex* mutex() { return mutex_.get(); }
141  PropertyPage* page() { return page_; }
142 
143  private:
145  PropertyPage* page_;
146  const bool is_cancellable_;
147  BoolCallback* done_;
148  bool delete_when_done_;
149  bool done_called_;
150  Timer* timer_;
151  int64 fast_finish_time_ms_;
152 
153 
154 };
155 
156 }
157 #endif
virtual GoogleString Name() const =0
virtual void Get(const GoogleString &url, const GoogleString &options_signature_hash, const GoogleString &cache_key_suffix, const PropertyCache::CohortVector &cohort_list, PropertyPage *page, BoolCallback *done, AbstractPropertyStoreGetCallback **callback)=0
Definition: property_cache.h:186
Definition: property_store.h:41
Base class for implementations of monitoring statistics.
Definition: statistics.h:342
bool enable_get_cancellation()
Definition: property_store.h:80
Abstract interface for implementing a mutex.
Definition: abstract_mutex.h:28
Definition: abstract_property_store_get_callback.h:31
Definition: property_cache.h:323
Definition: scoped_ptr.h:30
Definition: property_store.h:108
std::string GoogleString
PAGESPEED_KERNEL_BASE_STRING_H_.
Definition: string.h:24
bool AddPropertyValueProtobufToPropertyPage(const PropertyCache::Cohort *cohort, const PropertyValueProtobuf &pcache_value, int64 min_write_timestamp_ms)
Timer interface, made virtual so it can be mocked for tests.
Definition: timer.h:27
virtual void DeleteWhenDone()
Deletes the callback after done finishes.
virtual void Put(const GoogleString &url, const GoogleString &options_signature_hash, const GoogleString &cache_key_suffix, const PropertyCache::Cohort *cohort, const PropertyCacheValues *values, BoolCallback *done)=0
Definition: callback.h:44