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),
72
table_definition_ext= ARZ;
75
virtual drizzled::Cursor *create(drizzled::TableShare &table,
76
drizzled::memory::Root *mem_root)
78
return new (mem_root) ha_archive(*this, table);
81
const char **bas_ext() const {
82
return ha_archive_exts;
85
int doCreateTable(drizzled::Session &session,
86
drizzled::Table &table_arg,
87
drizzled::TableIdentifier &identifier,
88
drizzled::message::Table& proto);
90
int doGetTableDefinition(drizzled::Session& session,
91
drizzled::TableIdentifier &identifier,
92
drizzled::message::Table &table_message);
94
void doGetTableNames(drizzled::CachedDirectory &directory, drizzled::SchemaIdentifier&, std::set<std::string>& set_of_names);
96
int doDropTable(drizzled::Session&, drizzled::TableIdentifier &identifier);
98
ArchiveShare *findOpenTable(const std::string table_name);
99
void addOpenTable(const std::string &table_name, ArchiveShare *);
100
void deleteOpenTable(const std::string &table_name);
102
uint32_t max_supported_keys() const { return 1; }
103
uint32_t max_supported_key_length() const { return sizeof(uint64_t); }
104
uint32_t max_supported_key_part_length() const { return sizeof(uint64_t); }
106
uint32_t index_flags(enum drizzled::ha_key_alg) const
108
return HA_ONLY_WHOLE_INDEX;
111
bool doDoesTableExist(drizzled::Session&, drizzled::TableIdentifier &identifier);
112
int doRenameTable(drizzled::Session&, drizzled::TableIdentifier &from, drizzled::TableIdentifier &to);
114
void doGetTableIdentifiers(drizzled::CachedDirectory &directory,
115
drizzled::SchemaIdentifier &schema_identifier,
116
drizzled::TableIdentifiers &set_of_identifiers);
119
#endif /* PLUGIN_ARCHIVE_ARCHIVE_ENGINE_H */