17 #ifndef PAGESPEED_SYSTEM_SYSTEM_REWRITE_DRIVER_FACTORY_H_
18 #define PAGESPEED_SYSTEM_SYSTEM_REWRITE_DRIVER_FACTORY_H_
37 namespace net_instaweb {
39 class AbstractSharedMem;
42 class NamedLockManager;
46 class SharedCircularBuffer;
47 class SharedMemStatistics;
48 class StaticAssetManager;
50 class SystemRewriteOptions;
51 class SystemServerContext;
52 class SystemThreadSystem;
54 class UrlAsyncFetcher;
72 StringPiece hostname,
int port);
81 return shared_mem_runtime_.get();
119 virtual void RootInit();
120 virtual void ChildInit();
133 void PostConfig(
const std::vector<SystemServerContext*>& server_contexts,
167 virtual Hasher* NewHasher();
168 virtual Timer* DefaultTimer();
176 GoogleString hostname_identifier() {
return hostname_identifier_; }
182 virtual void StopCacheActivity();
184 SystemCaches* caches() {
return caches_.get(); }
186 virtual void set_message_buffer_size(
int x) {
187 message_buffer_size_ = x;
193 UrlAsyncFetcher*
GetFetcher(SystemRewriteOptions* config);
198 track_original_content_length_ = x;
200 bool track_original_content_length()
const {
201 return track_original_content_length_;
209 list_outstanding_urls_on_error_ = x;
219 void set_static_asset_prefix(StringPiece s) {
220 s.CopyToString(&static_asset_prefix_);
222 const GoogleString& static_asset_prefix() {
return static_asset_prefix_; }
224 int num_rewrite_threads()
const {
return num_rewrite_threads_; }
225 void set_num_rewrite_threads(
int x) { num_rewrite_threads_ = x; }
226 int num_expensive_rewrite_threads()
const {
227 return num_expensive_rewrite_threads_;
229 void set_num_expensive_rewrite_threads(
int x) {
230 num_expensive_rewrite_threads_ = x;
232 bool use_per_vhost_statistics()
const {
233 return use_per_vhost_statistics_;
235 void set_use_per_vhost_statistics(
bool x) {
236 use_per_vhost_statistics_ = x;
238 bool install_crash_handler()
const {
239 return install_crash_handler_;
241 void set_install_crash_handler(
bool x) {
242 install_crash_handler_ = x;
299 virtual void ShutDownMessageHandlers() {}
300 virtual void SetCircularBuffer(SharedCircularBuffer* buffer) {}
328 bool thread_counts_finalized() {
return thread_counts_finalized_; }
343 GoogleString GetFetcherKey(
bool include_slurping_config,
357 StringVector local_shm_stats_segment_names_;
361 bool statistics_frozen_;
362 bool is_root_process_;
371 int message_buffer_size_;
376 bool track_original_content_length_;
377 bool list_outstanding_urls_on_error_;
391 typedef std::map<GoogleString, UrlAsyncFetcher*> FetcherMap;
392 FetcherMap base_fetcher_map_;
393 FetcherMap fetcher_map_;
404 bool use_per_vhost_statistics_;
407 bool install_crash_handler_;
410 bool thread_counts_finalized_;
413 int num_rewrite_threads_;
414 int num_expensive_rewrite_threads_;
416 std::shared_ptr<CentralControllerRpcClient> central_controller_;
virtual void StartController(const SystemRewriteOptions &options)
void PostConfig(const std::vector< SystemServerContext * > &server_contexts, GoogleString *error_message, int *error_index, Statistics **global_statistics)
virtual int LookupThreadLimit()
Definition: system_rewrite_driver_factory.h:260
virtual void ParentOrChildInit()
Definition: static_asset_manager.h:48
bool is_root_process() const
Definition: system_rewrite_driver_factory.h:118
std::set< SystemServerContext * > SystemServerContextSet
Definition: system_rewrite_driver_factory.h:313
SystemRewriteDriverFactory(const ProcessContext &process_context, SystemThreadSystem *thread_system, AbstractSharedMem *shared_mem_runtime, StringPiece hostname, int port)
Definition: named_lock_manager.h:82
virtual void AutoDetectThreadCounts()
Base class for implementations of monitoring statistics.
Definition: statistics.h:342
virtual void SetupCaches(ServerContext *server_context)
Definition: shared_mem_statistics.h:182
WorkerPoolCategory
Definition: rewrite_driver_factory.h:75
virtual void PrepareForkedProcess(const char *name)
void set_track_original_content_length(bool x)
Definition: system_rewrite_driver_factory.h:197
virtual int requests_per_host()
Normally 4, or #threads if that's more.
UrlAsyncFetcher * GetFetcher(SystemRewriteOptions *config)
std::shared_ptr< CentralController > GetCentralController(NamedLockManager *lock_manager) override
Delegate from RewriteDriverFactory to construct CentralController.
A server context with features specific to a psol port on a unix system.
Definition: system_rewrite_driver_factory.h:57
virtual bool IsServerThreaded()
Definition: system_rewrite_driver_factory.h:254
virtual void PrepareControllerProcess()
Definition: system_thread_system.h:32
Definition: system_rewrite_options.h:40
Definition: scoped_ptr.h:30
std::string GoogleString
PAGESPEED_KERNEL_BASE_STRING_H_.
Definition: string.h:24
Definition: abstract_shared_mem.h:86
Definition: queued_worker_pool.h:50
virtual RewriteOptions::OptionSettingResult ParseAndSetOption1(StringPiece option, StringPiece arg, bool process_scope, GoogleString *msg, MessageHandler *handler)
Definition: file_system.h:76
static void InitStats(Statistics *statistics)
virtual void SetupMessageHandlers()
Definition: system_rewrite_driver_factory.h:298
virtual NamedLockManager * DefaultLockManager()
virtual void NonStaticInitStats(Statistics *statistics)=0
Definition: server_context.h:99
Definition: process_context.h:35
void SharedCircularBufferInit(bool is_root)
virtual int max_queue_size()
Definition: system_rewrite_driver_factory.h:215
Statistics * statistics()
Definition: rewrite_driver_factory.h:247
virtual void NameProcess(const char *name)
Set the name of this process, for debugging visibility.
OptionSettingResult
Used for return value of SetOptionFromName.
Definition: rewrite_options.h:813
NonceGenerator * DefaultNonceGenerator()
Creates a HashedNonceGenerator initialized with data from /dev/random.
virtual bool enable_property_cache() const
Hook so implementations may disable the property cache.
Definition: system_rewrite_driver_factory.h:172
Definition: message_handler.h:39
virtual void ShutDownFetchers()
Definition: system_rewrite_driver_factory.h:304
virtual UrlAsyncFetcher * AllocateFetcher(SystemRewriteOptions *config)
Definition: nonce_generator.h:28
virtual QueuedWorkerPool * CreateWorkerPool(WorkerPoolCategory pool, StringPiece name)
Timer interface, made virtual so it can be mocked for tests.
Definition: timer.h:27
SharedMemStatistics * AllocateAndInitSharedMemStatistics(bool local, const StringPiece &name, const SystemRewriteOptions &options)
Creates and ::Initializes a shared memory statistics object.
virtual bool UseBeaconResultsInFilters() const
Definition: system_rewrite_driver_factory.h:247
virtual void InitStaticAssetManager(StaticAssetManager *static_asset_manager)
Initializes the StaticAssetManager.
virtual ServerContext * NewServerContext()
Definition: url_async_fetcher.h:33
void list_outstanding_urls_on_error(bool x)
Definition: system_rewrite_driver_factory.h:208
Definition: rewrite_driver_factory.h:70