Introducing storage engines
Earlier in this book we covered Information Schema plugins. Although very differently defined, these plugins work a little like partially implemented read-only storage engines. We just have to provide the table layout and fill the rows when queried. With a basic storage engine plugin we have to do exactly the same, but there are many other methods which can be implemented to cover indexes, updates, inserts, and so on.
The storage engine plugins are implemented using two main structures:
A class, inherited from a MySQL class, called
handler
A structure called
handlerton
The handler
class provides the methods that work on a single table such as open(), index_read(), write_row()
, and so on. There can be many objects of the handler
class. The handlerton
object is created only once per storage engine (it is a singleton, thus the name) and provides methods that affect the whole storage engine, such as commit(), savepoint_rollback(), show_status()
, and so...