1
/* Copyright (C) 2003 MySQL AB
2
Copyright (C) 2010 Brian Aker
4
This program is free software; you can redistribute it and/or modify
5
it under the terms of the GNU General Public License as published by
6
the Free Software Foundation; version 2 of the License.
8
This program is distributed in the hope that it will be useful,
9
but WITHOUT ANY WARRANTY; without even the implied warranty of
10
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
GNU General Public License for more details.
13
You should have received a copy of the GNU General Public License
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 */
17
#include "drizzled/field.h"
18
#include "drizzled/field/blob.h"
19
#include "drizzled/field/timestamp.h"
20
#include "plugin/myisam/myisam.h"
21
#include "drizzled/table.h"
22
#include "drizzled/session.h"
23
#include <drizzled/thr_lock.h>
24
#include <drizzled/my_hash.h>
25
#include <drizzled/cursor.h>
35
#include "plugin/archive/ha_archive.h"
43
#ifndef PLUGIN_ARCHIVE_ARCHIVE_ENGINE_H
44
#define PLUGIN_ARCHIVE_ARCHIVE_ENGINE_H
46
/* The file extension */
47
#define ARZ ".arz" // The data file
48
#define ARN ".ARN" // Files used during an optimize call
51
We just implement one additional file extension.
53
static const char *ha_archive_exts[] = {
59
class ArchiveEngine : public drizzled::plugin::StorageEngine
61
typedef std::map<std::string, ArchiveShare*> ArchiveMap;
62
ArchiveMap archive_open_tables;
66
: drizzled::plugin::StorageEngine("ARCHIVE",
67
drizzled::HTON_FILE_BASED |
68
drizzled::HTON_STATS_RECORDS_IS_EXACT |
69
drizzled::HTON_HAS_RECORDS |
70
drizzled::HTON_HAS_DATA_DICTIONARY),
73
table_definition_ext= ARZ;
76
virtual drizzled::Cursor *create(drizzled::TableShare &table,
77
drizzled::memory::Root *mem_root)
79
return new (mem_root) ha_archive(*this, table);
82
const char **bas_ext() const {
83
return ha_archive_exts;
86
int doCreateTable(drizzled::Session *session, const char *table_name,
87
drizzled::Table& table_arg,
88
drizzled::message::Table& proto);
90
int doGetTableDefinition(drizzled::Session& session,
93
const char *table_name,
95
drizzled::message::Table *table_proto);
97
void doGetTableNames(drizzled::CachedDirectory &directory, std::string& , std::set<std::string>& set_of_names);
99
int doDropTable(drizzled::Session&, const std::string table_path);
100
ArchiveShare *findOpenTable(const std::string table_name);
101
void addOpenTable(const std::string &table_name, ArchiveShare *);
102
void deleteOpenTable(const std::string &table_name);
104
uint32_t max_supported_keys() const { return 1; }
105
uint32_t max_supported_key_length() const { return sizeof(uint64_t); }
106
uint32_t max_supported_key_part_length() const { return sizeof(uint64_t); }
108
uint32_t index_flags(enum drizzled::ha_key_alg) const
110
return HA_ONLY_WHOLE_INDEX;
114
#endif /* PLUGIN_ARCHIVE_ARCHIVE_ENGINE_H */