Drizzled Public API Documentation

catalog.h
1 /* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3  *
4  * Copyright (C) 2010 Brian Aker
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program 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 St, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 
22 #pragma once
23 
24 #include <drizzled/plugin/plugin.h>
25 #include <drizzled/identifier.h>
26 #include <drizzled/catalog/instance.h>
27 #include <drizzled/catalog/engine.h>
28 
29 #include <drizzled/visibility.h>
30 
31 namespace drizzled
32 {
33 namespace plugin
34 {
35 
36 /*
37  This object handles the aggregate of all operations for any/all of the Catalog engines.
38 */
39 class DRIZZLED_API Catalog : public Plugin
40 {
41 public:
42  typedef std::vector<Catalog *> vector;
43 
44  explicit Catalog(std::string name_arg) :
45  Plugin(name_arg, "Catalog")
46  {}
47 
48  virtual catalog::Engine::shared_ptr engine()= 0;
49 
50  static bool create(const identifier::Catalog&);
51  static bool create(const identifier::Catalog&, message::catalog::shared_ptr &);
52  static bool drop(const identifier::Catalog&);
53 
54  static bool lock(const identifier::Catalog&);
55  static bool unlock(const identifier::Catalog&);
56 
57  // Required for plugin interface
58  static bool addPlugin(plugin::Catalog *plugin);
59  static void removePlugin(plugin::Catalog *plugin);
60 
61  // Get Meta information
62  static bool exist(const identifier::Catalog&);
63  static void getIdentifiers(identifier::catalog::vector &identifiers);
64  static void getMessages(message::catalog::vector &messages);
65  static message::catalog::shared_ptr getMessage(const identifier::Catalog&);
66 
67  // Get Instance
68  static catalog::Instance::shared_ptr getInstance(const identifier::Catalog&);
69 };
70 
71 } /* namespace plugin */
72 } /* namespace drizzled */
73