diff options
author | unknown <acurtis@xiphis.org> | 2006-04-13 13:49:29 -0700 |
---|---|---|
committer | unknown <acurtis@xiphis.org> | 2006-04-13 13:49:29 -0700 |
commit | 83583111cadd1a411c6a51c1891e7ca5a4e45223 (patch) | |
tree | 7d7b722a3af9812d173de1c5398f625484467670 /storage/archive/ha_archive.h | |
parent | 087cae1a1e5c5681886955c44726bddec2c5d94a (diff) | |
download | mariadb-git-83583111cadd1a411c6a51c1891e7ca5a4e45223.tar.gz |
WL#3201
" Configure support for server plugins "
storage/blackhole/ha_blackhole.h:
Rename: sql/ha_blackhole.h -> storage/blackhole/ha_blackhole.h
BitKeeper/deleted/.del-storage.m4~24bf2fffdaa328ad:
Delete: config/ac-macros/storage.m4
BitKeeper/deleted/.del-ha_archive.m4~a07fac7110b39294:
Delete: config/ac-macros/ha_archive.m4
BitKeeper/deleted/.del-ha_blackhole.m4~8ed06eb91f6420ed:
Delete: config/ac-macros/ha_blackhole.m4
BitKeeper/deleted/.del-ha_example.m4~1dfb268163297708:
Delete: config/ac-macros/ha_example.m4
BitKeeper/deleted/.del-ha_federated.m4~7acddd58286acfd6:
Delete: config/ac-macros/ha_federated.m4
BitKeeper/deleted/.del-ha_innodb.m4~6f141fb5b80c1f39:
Delete: config/ac-macros/ha_innodb.m4
BitKeeper/deleted/.del-ha_partition.m4~bc57067550be5f89:
Delete: config/ac-macros/ha_partition.m4
BitKeeper/deleted/.del-ha_tina.m4~f658506ebbc113ca:
Delete: config/ac-macros/ha_tina.m4
BitKeeper/deleted/.del-handlerton.cc.in~377156e7b06067cc:
Delete: sql/handlerton.cc.in
BitKeeper/deleted/.del-handlerton-win.cc~322a7e59507976df:
Delete: sql/handlerton-win.cc
BUILD/SETUP.sh:
WL#3201
Changes in configure arguments
Makefile.am:
WL#3201
changes in build subst names
config/ac-macros/ha_berkeley.m4:
WL#3201
remove unused variable
Makefile is always made
config/ac-macros/ha_ndbcluster.m4:
WL#3201
remove unused variables
Split big macro
configure.in:
WL#3201
out with storage.m4, in with plugins.m4
change how plugins are declared
include makefiles, remove handlerton.cc, add sql_builtin.cc
include/mysql/plugin.h:
WL#3201
support static and dynamic build - MYSQL_DYNAMIC_PLUGIN
libmysqld/Makefile.am:
WL#3201
Storage engine files still left in sql subdir are not conditionally
compiled. Should move them out soon,
plugin/Makefile.am:
WL#3201
update makefile
plugin/fulltext/Makefile.am:
WL#3201
update makefile
plugin/fulltext/plugin_example.c:
WL#3201
change to mysql_declare_plugin macro
sql/Makefile.am:
WL#3201
Storage engine files still left in sql subdir are not conditionally
compiled. Should move them out soon,
sql/ha_berkeley.cc:
WL#3201
make into a plugin
conditionally compile content
sql/ha_federated.cc:
WL#3201
make into a plugin
conditionally compile content
sql/ha_heap.cc:
WL#3201
make into a plugin
sql/ha_innodb.cc:
WL#3201
make into a plugin
conditionally compile content
sql/ha_myisam.cc:
WL#3201
make into a plugin
sql/ha_myisammrg.cc:
WL#3201
make into a plugin
sql/ha_ndbcluster.cc:
WL#3201
make into a plugin
conditionally compile content
sql/ha_ndbcluster_binlog.cc:
WL#3201
make into a plugin
conditionally compile content
sql/ha_partition.cc:
WL#3201
make into a plugin
conditionally compile content
sql/handler.cc:
WL#3201
Simplify how storage engines are found by db_type
(hopefully we can get rid of it soon)
Code cleanup
sql/handler.h:
WL#3201
new DB_TYPE_FIRST_DYNAMIC
new func ha_finalize_handlerton()
remove ha_register_builtin_plugins()
sql/log.cc:
WL#3201
make into a plugin
sql/mysqld.cc:
WL#3201
remove ha_register_builtin_plugins()
alter init order so that storage engines are initialized before first use
sql/partition_info.cc:
WL#3201
conditionally compile content
sql/sql_delete.cc:
WL#3201
conditionally include ha_innodb.h
sql/sql_plugin.cc:
WL#3201
All compiled in plugins are in mysqld_builtins[]
add funcs for plugin finalization
install builtin plugins on initialization
sql/sql_show.cc:
WL#3201
Fix to use plugin_foreach()
sql/sql_yacc.yy:
WL#3201
SHOW FULL PLUGIN
storage/archive/Makefile.am:
WL#3201
setup as plugin makefile
storage/archive/ha_archive.cc:
WL#3201
Convert into a plugin
storage/archive/ha_archive.h:
WL#3201
azlib.h now in local dir
storage/blackhole/ha_blackhole.cc:
WL#3201
convert into a plugin
storage/csv/Makefile.am:
WL#3201
setup as plugin makefile
storage/csv/ha_tina.cc:
WL#3201
remove conditional compilation on MYSQL_PLUGIN
mysql_declare_plugin macro change
storage/example/Makefile.am:
WL#3201
fix as new-style plugin makefile
storage/example/ha_example.cc:
WL#3201
remove conditional compilation on MYSQL_PLUGIN
mysql_declare_plugin macro change
storage/innobase/Makefile.am:
WL#3201
Lets make life easier and reduce innodb into a single library file
config/ac-macros/plugins.m4:
New BitKeeper file ``config/ac-macros/plugins.m4''
sql/sql_builtin.cc.in:
New BitKeeper file ``sql/sql_builtin.cc.in''
storage/blackhole/Makefile.am:
New BitKeeper file ``storage/blackhole/Makefile.am''
Diffstat (limited to 'storage/archive/ha_archive.h')
-rw-r--r-- | storage/archive/ha_archive.h | 136 |
1 files changed, 136 insertions, 0 deletions
diff --git a/storage/archive/ha_archive.h b/storage/archive/ha_archive.h new file mode 100644 index 00000000000..b64897ff046 --- /dev/null +++ b/storage/archive/ha_archive.h @@ -0,0 +1,136 @@ +/* Copyright (C) 2003 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifdef USE_PRAGMA_INTERFACE +#pragma interface /* gcc class implementation */ +#endif + +#include <zlib.h> +#include "azlib.h" + +/* + Please read ha_archive.cc first. If you are looking for more general + answers on how storage engines work, look at ha_example.cc and + ha_example.h. +*/ + +typedef struct st_archive_share { + char *table_name; + char data_file_name[FN_REFLEN]; + uint table_name_length,use_count; + pthread_mutex_t mutex; + THR_LOCK lock; + File meta_file; /* Meta file we use */ + azio_stream archive_write; /* Archive file we are working with */ + bool dirty; /* Flag for if a flush should occur */ + bool crashed; /* Meta file is crashed */ + ha_rows rows_recorded; /* Number of rows in tables */ + ulonglong auto_increment_value; + ulonglong forced_flushes; + ulonglong mean_rec_length; +} ARCHIVE_SHARE; + +/* + Version for file format. + 1 - Initial Version +*/ +#define ARCHIVE_VERSION 2 + +class ha_archive: public handler +{ + THR_LOCK_DATA lock; /* MySQL lock */ + ARCHIVE_SHARE *share; /* Shared lock info */ + azio_stream archive; /* Archive file we are working with */ + my_off_t current_position; /* The position of the row we just read */ + byte byte_buffer[IO_SIZE]; /* Initial buffer for our string */ + String buffer; /* Buffer used for blob storage */ + ha_rows scan_rows; /* Number of rows left in scan */ + bool delayed_insert; /* If the insert is delayed */ + bool bulk_insert; /* If we are performing a bulk insert */ + const byte *current_key; + uint current_key_len; + uint current_k_offset; + +public: + ha_archive(TABLE_SHARE *table_arg); + ~ha_archive() + { + } + const char *table_type() const { return "ARCHIVE"; } + const char *index_type(uint inx) { return "NONE"; } + const char **bas_ext() const; + ulong table_flags() const + { + return (HA_REC_NOT_IN_SEQ | HA_NOT_EXACT_COUNT | HA_CAN_BIT_FIELD | + HA_FILE_BASED | HA_CAN_INSERT_DELAYED | HA_CAN_GEOMETRY); + } + ulong index_flags(uint idx, uint part, bool all_parts) const + { + return HA_ONLY_WHOLE_INDEX; + } + ulonglong get_auto_increment(); + uint max_supported_keys() const { return 1; } + uint max_supported_key_length() const { return sizeof(ulonglong); } + uint max_supported_key_part_length() const { return sizeof(ulonglong); } + int index_init(uint keynr, bool sorted); + virtual int index_read(byte * buf, const byte * key, + uint key_len, enum ha_rkey_function find_flag); + virtual int index_read_idx(byte * buf, uint index, const byte * key, + uint key_len, enum ha_rkey_function find_flag); + int index_next(byte * buf); + int open(const char *name, int mode, uint test_if_locked); + int close(void); + int write_row(byte * buf); + int real_write_row(byte *buf, azio_stream *writer); + int delete_all_rows(); + int rnd_init(bool scan=1); + int rnd_next(byte *buf); + int rnd_pos(byte * buf, byte *pos); + int get_row(azio_stream *file_to_read, byte *buf); + int read_meta_file(File meta_file, ha_rows *rows, + ulonglong *auto_increment, + ulonglong *forced_flushes); + int write_meta_file(File meta_file, ha_rows rows, + ulonglong auto_increment, + ulonglong forced_flushes, + bool dirty); + ARCHIVE_SHARE *get_share(const char *table_name, TABLE *table, int *rc); + int free_share(ARCHIVE_SHARE *share); + bool auto_repair() const { return 1; } // For the moment we just do this + int read_data_header(azio_stream *file_to_read); + int write_data_header(azio_stream *file_to_write); + void position(const byte *record); + void info(uint); + void update_create_info(HA_CREATE_INFO *create_info); + int create(const char *name, TABLE *form, HA_CREATE_INFO *create_info); + int optimize(THD* thd, HA_CHECK_OPT* check_opt); + int repair(THD* thd, HA_CHECK_OPT* check_opt); + void start_bulk_insert(ha_rows rows); + int end_bulk_insert(); + enum row_type get_row_type() const + { + return ROW_TYPE_COMPRESSED; + } + THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to, + enum thr_lock_type lock_type); + bool is_crashed() const; + int check(THD* thd, HA_CHECK_OPT* check_opt); + bool check_and_repair(THD *thd); +}; + +bool archive_db_init(void); +int archive_db_end(ha_panic_function type); + |