~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/archive/archive_engine.h

  • Committer: Brian Aker
  • Date: 2010-11-08 18:54:26 UTC
  • mto: (1921.1.1 trunk)
  • mto: This revision was merged to the branch mainline in revision 1916.
  • Revision ID: brian@tangent.org-20101108185426-fymkf2xnelupf11x
Rename lock methods to be style + well make sense.

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
 
13
13
  You should have received a copy of the GNU General Public License
14
14
  along with this program; if not, write to the Free Software
15
 
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
15
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
16
16
 
17
17
#include "drizzled/field.h"
18
18
#include "drizzled/field/blob.h"
31
31
#include <unistd.h>
32
32
#include <zlib.h>
33
33
 
 
34
#include <boost/unordered_map.hpp>
 
35
#include "drizzled/util/string.h"
 
36
 
34
37
#include "azio.h"
35
38
#include "plugin/archive/ha_archive.h"
36
39
 
58
61
 
59
62
class ArchiveEngine : public drizzled::plugin::StorageEngine
60
63
{
61
 
  typedef std::map<std::string, ArchiveShare*> ArchiveMap;
 
64
  typedef boost::unordered_map<std::string, ArchiveShare *, drizzled::util::insensitive_hash, drizzled::util::insensitive_equal_to> ArchiveMap;
62
65
  ArchiveMap archive_open_tables;
63
66
 
 
67
  /* Variables for archive share methods */
 
68
  pthread_mutex_t _mutex;
 
69
 
64
70
public:
65
71
  ArchiveEngine() :
66
72
    drizzled::plugin::StorageEngine("ARCHIVE",
67
 
                                    drizzled::HTON_FILE_BASED |
68
73
                                    drizzled::HTON_STATS_RECORDS_IS_EXACT |
69
74
                                    drizzled::HTON_HAS_RECORDS),
70
75
    archive_open_tables()
71
76
  {
 
77
    pthread_mutex_init(&_mutex, NULL);
72
78
    table_definition_ext= ARZ;
73
79
  }
74
 
 
75
 
  virtual drizzled::Cursor *create(drizzled::TableShare &table,
76
 
                                   drizzled::memory::Root *mem_root)
77
 
  {
78
 
    return new (mem_root) ha_archive(*this, table);
 
80
  ~ArchiveEngine()
 
81
  {
 
82
    pthread_mutex_destroy(&_mutex);
 
83
  }
 
84
 
 
85
  pthread_mutex_t &mutex()
 
86
  {
 
87
    return _mutex;
 
88
  }
 
89
 
 
90
  virtual drizzled::Cursor *create(drizzled::Table &table)
 
91
  {
 
92
    return new ha_archive(*this, table);
79
93
  }
80
94
 
81
95
  const char **bas_ext() const {
84
98
 
85
99
  int doCreateTable(drizzled::Session &session,
86
100
                    drizzled::Table &table_arg,
87
 
                    drizzled::TableIdentifier &identifier,
 
101
                    const drizzled::TableIdentifier &identifier,
88
102
                    drizzled::message::Table& proto);
89
103
 
90
104
  int doGetTableDefinition(drizzled::Session& session,
91
 
                           drizzled::TableIdentifier &identifier,
 
105
                           const drizzled::TableIdentifier &identifier,
92
106
                           drizzled::message::Table &table_message);
93
107
 
94
 
  void doGetTableNames(drizzled::CachedDirectory &directory, drizzled::SchemaIdentifier&, std::set<std::string>& set_of_names);
95
 
 
96
 
  int doDropTable(drizzled::Session&, drizzled::TableIdentifier &identifier);
 
108
  int doDropTable(drizzled::Session&, const drizzled::TableIdentifier &identifier);
97
109
 
98
110
  ArchiveShare *findOpenTable(const std::string table_name);
99
111
  void addOpenTable(const std::string &table_name, ArchiveShare *);
108
120
    return HA_ONLY_WHOLE_INDEX;
109
121
  }
110
122
 
111
 
  bool doDoesTableExist(drizzled::Session&, drizzled::TableIdentifier &identifier);
112
 
  int doRenameTable(drizzled::Session&, drizzled::TableIdentifier &from, drizzled::TableIdentifier &to);
 
123
  bool doDoesTableExist(drizzled::Session&, const drizzled::TableIdentifier &identifier);
 
124
  int doRenameTable(drizzled::Session&, const drizzled::TableIdentifier &from, const drizzled::TableIdentifier &to);
113
125
 
114
126
  void doGetTableIdentifiers(drizzled::CachedDirectory &directory,
115
 
                             drizzled::SchemaIdentifier &schema_identifier,
 
127
                             const drizzled::SchemaIdentifier &schema_identifier,
116
128
                             drizzled::TableIdentifiers &set_of_identifiers);
117
129
};
118
130