summaryrefslogtreecommitdiff
path: root/sql/handler.h
diff options
context:
space:
mode:
authorunknown <bell@sanja.is.com.ua>2006-06-01 21:47:15 +0300
committerunknown <bell@sanja.is.com.ua>2006-06-01 21:47:15 +0300
commit1101cda353093dc3c22e214452b8a98ad452f2c3 (patch)
tree4372d3e7e74132ed1045d118bbc3390670b40809 /sql/handler.h
parenta04d9fa947ec5fc22368c15d7c6c7ba47898405f (diff)
downloadmariadb-git-1101cda353093dc3c22e214452b8a98ad452f2c3.tar.gz
interface for transaction log management added to handlerton
iterators creation interface added to handlerton sql/ha_berkeley.cc: added new methods sql/ha_federated.cc: added new methods sql/ha_heap.cc: added new methods sql/ha_innodb.cc: added new methods sql/ha_myisam.cc: added new methods sql/ha_myisammrg.cc: added new methods sql/ha_ndbcluster.cc: added new methods sql/ha_partition.cc: added new methods sql/handler.cc: added new methods spelling fixed examples of functions for new interface added sql/handler.h: transaction logs management interface added general iterator creatioin interface added sql/log.cc: added new methods storage/archive/ha_archive.cc: added new methods storage/blackhole/ha_blackhole.cc: added new methods storage/csv/ha_tina.cc: added new methods storage/example/ha_example.cc: added new methods
Diffstat (limited to 'sql/handler.h')
-rw-r--r--sql/handler.h83
1 files changed, 83 insertions, 0 deletions
diff --git a/sql/handler.h b/sql/handler.h
index afee6bb9f8d..4bc4f8b0c68 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -461,6 +461,72 @@ typedef bool (stat_print_fn)(THD *thd, const char *type, uint type_len,
const char *status, uint status_len);
enum ha_stat_type { HA_ENGINE_STATUS, HA_ENGINE_LOGS, HA_ENGINE_MUTEX };
+/* Transaction log maintains type definitions */
+enum log_status
+{
+ HA_LOG_STATUS_FREE= 0, /* log is free and can be deleted */
+ HA_LOG_STATUS_INUSE= 1, /* log can't be deleted because it is in use */
+ HA_LOG_STATUS_NOSUCHLOG= 2 /* no such log (can't be returned by
+ the log iterator status) */
+};
+/*
+ Function for signaling that the log file changed its state from
+ LOG_STATUS_INUSE to LOG_STATUS_FREE
+
+ Now it do nothing, will be implemented as part of new transaction
+ log management for engines.
+ TODO: implement the function.
+*/
+void signal_log_not_needed(struct handlerton, char *log_file);
+/*
+ Data of transaction log iterator.
+*/
+struct handler_log_file_data {
+ LEX_STRING filename;
+ enum log_status status;
+};
+
+
+enum handler_iterator_type
+{
+ /* request of transaction log iterator */
+ HA_TRANSACTLOG_ITERATOR= 1
+};
+enum handler_create_iterator_result
+{
+ HA_ITERATOR_OK, /* iterator created */
+ HA_ITERATOR_UNSUPPORTED, /* such type of iterator is not supported */
+ HA_ITERATOR_ERROR /* error during iterator creation */
+};
+
+/*
+ Iterator structure. Can be used by handler/handlerton for different purposes.
+
+ Iterator should be created in the way to point "before" the first object
+ it iterate, so next() call move it to the first object or return !=0 if
+ there is nothing to iterate through.
+*/
+struct handler_iterator {
+ /*
+ Moves iterator to next record and return 0 or return !=0
+ if there is no records.
+ iterator_object will be filled by this function if next() returns 0.
+ Content of the iterator_object depend on iterator type.
+ */
+ int (*next)(struct handler_iterator *, void *iterator_object);
+ /*
+ Free resources allocated by iterator, after this call iterator
+ is not usable.
+ */
+ void (*destroy)(struct handler_iterator *);
+ /*
+ Pointer to buffer for the iterator to use.
+ Should be allocated by function which created the iterator and
+ destroied by freed by above "destroy" call
+ */
+ void *buffer;
+};
+
/*
handlerton is a singleton structure - one instance per storage engine -
to provide access to storage engine functionality that works on the
@@ -585,6 +651,23 @@ struct handlerton
const char *query, uint query_length,
const char *db, const char *table_name);
int (*release_temporary_latches)(THD *thd);
+
+ /*
+ Get log status.
+ If log_status is null then the handler do not support transaction
+ log information (i.e. log iterator can't be created).
+ (see example of implementation in handler.cc, TRANS_LOG_MGM_EXAMPLE_CODE)
+
+ */
+ enum log_status (*get_log_status)(char *log);
+
+ /*
+ Iterators creator.
+ Presence of the pointer should be checked before using
+ */
+ enum handler_create_iterator_result
+ (*create_iterator)(enum handler_iterator_type type,
+ struct handler_iterator *fill_this_in);
};
extern const handlerton default_hton;