0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
NamespaceCache.h
Go to the documentation of this file.
1 /* -*- c++ -*-
2  * Copyright (C) 2007-2015 Hypertable, Inc.
3  *
4  * This file is part of Hypertable.
5  *
6  * Hypertable is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; version 3 of the
9  * License, or any later version.
10  *
11  * Hypertable is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19  * 02110-1301, USA.
20  */
21 
22 #ifndef Hypertable_Lib_NamespaceCache_h
23 #define Hypertable_Lib_NamespaceCache_h
24 
26 #include <Hypertable/Lib/Schema.h>
29 
31 
32 #include <Common/String.h>
33 
34 #include <memory>
35 #include <mutex>
36 #include <unordered_map>
37 
38 namespace Hypertable {
39 
40  class Client;
41 
43  public:
44 
45  NamespaceCache(PropertiesPtr &props, RangeLocatorPtr &range_locator,
46  ConnectionManagerPtr &conn_manager, Hyperspace::SessionPtr &hyperspace,
47  ApplicationQueueInterfacePtr &app_queue, NameIdMapperPtr &namemap,
48  Lib::Master::ClientPtr &master_client, TableCachePtr &table_cache,
49  uint32_t default_timeout_ms, Client *client);
50 
55  NamespacePtr get(const std::string &name);
56 
61  bool remove(const std::string &name);
62 
63  private:
64  typedef std::unordered_map<String, NamespacePtr> NamespaceMap;
65 
75  uint32_t m_timeout_ms;
77  NamespaceMap m_namespace_map;
79  };
80 
82  typedef std::shared_ptr<NamespaceCache> NamespaceCachePtr;
83 
84 }
85 
86 
87 #endif // Hypertable_Lib_NamespaceCache_h
static std::mutex mutex
Definition: Logger.cc:43
Lib::Master::ClientPtr m_master_client
ConnectionManagerPtr m_conn_manager
RangeLocatorPtr m_range_locator
std::shared_ptr< RangeLocator > RangeLocatorPtr
Smart pointer to RangeLocator.
Definition: RangeLocator.h:198
std::unordered_map< String, NamespacePtr > NamespaceMap
std::shared_ptr< NamespaceCache > NamespaceCachePtr
Smart pointer to NamespaceCache.
Declarations for Schema.
std::shared_ptr< Namespace > NamespacePtr
Shared smart pointer to Namespace.
Definition: Namespace.h:333
std::shared_ptr< Client > ClientPtr
Definition: Client.h:156
std::shared_ptr< Session > SessionPtr
Definition: Session.h:734
NamespaceCache(PropertiesPtr &props, RangeLocatorPtr &range_locator, ConnectionManagerPtr &conn_manager, Hyperspace::SessionPtr &hyperspace, ApplicationQueueInterfacePtr &app_queue, NameIdMapperPtr &namemap, Lib::Master::ClientPtr &master_client, TableCachePtr &table_cache, uint32_t default_timeout_ms, Client *client)
std::shared_ptr< Properties > PropertiesPtr
Definition: Properties.h:447
std::shared_ptr< ApplicationQueueInterface > ApplicationQueueInterfacePtr
Smart pointer to ApplicationQueueInterface.
Hypertable definitions
Hyperspace::SessionPtr m_hyperspace
std::shared_ptr< TableCache > TableCachePtr
Smart pointer to TableCache.
Definition: TableCache.h:103
Entry point to AsyncComm service.
Definition: Comm.h:61
ApplicationQueueInterfacePtr m_app_queue
A String class based on std::string.
Declarations for ApplicationQueueInterface.
std::shared_ptr< ConnectionManager > ConnectionManagerPtr
Smart pointer to ConnectionManager.
std::shared_ptr< NameIdMapper > NameIdMapperPtr
Smart pointer to NameIdMapper.
Definition: NameIdMapper.h:121