2
Copyright (C) 2010 Zimin
4
This program is free software; you can redistribute it and/or
5
modify it under the terms of the GNU General Public License
6
as published by the Free Software Foundation; either version 2
7
of the License, or (at your option) any later version.
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
14
You should have received a copy of the GNU General Public License
15
along with this program; if not, write to the Free Software
16
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19
#ifndef PLUGIN_FILESYSTEM_ENGINE_FILESYSTEM_ENGINE_H
20
#define PLUGIN_FILESYSTEM_ENGINE_FILESYSTEM_ENGINE_H
22
#include <drizzled/cursor.h>
23
#include <drizzled/thr_lock.h>
25
#include <boost/scoped_ptr.hpp>
27
#include <sys/types.h>
31
#include "transparent_file.h"
32
#include "formatinfo.h"
33
#include "filesystemlock.h"
35
class FilesystemTableShare
37
FilesystemTableShare();
38
FilesystemTableShare(const FilesystemTableShare &);
39
FilesystemTableShare& operator=(const FilesystemTableShare &);
41
explicit FilesystemTableShare(const std::string name);
42
~FilesystemTableShare();
45
const std::string table_name;
46
bool update_file_opened;
48
pthread_mutex_t mutex;
50
std::vector< std::map<std::string, std::string> > vm;
51
FilesystemLock filesystem_lock;
54
class FilesystemCursor : public drizzled::Cursor
56
FilesystemTableShare *share; /* Shared lock info */
57
boost::scoped_ptr<TransparentFile> file_buff;
59
std::string update_file_name;
62
off_t current_position;
65
uint32_t sql_command_type; /* Type of SQL command to process */
66
/* each slot means an interval in a file which will be deleted later */
67
std::vector< std::pair<off_t, off_t> > slots;
70
FilesystemCursor(drizzled::plugin::StorageEngine &engine, drizzled::Table &table_arg);
76
The name that will be used for display purposes.
78
const char *table_type(void) const { return "FILESYSTEM"; }
81
Called in test_quick_select to determine if indexes should be used.
83
virtual double scan_time() { return (double) (stats.records+stats.deleted) / 20.0+10; }
85
/* The next method will never be called */
86
virtual bool fast_key_read() { return 1;}
87
drizzled::ha_rows estimate_rows_upper_bound() { return HA_POS_ERROR; }
89
int doOpen(const drizzled::identifier::Table &, int, uint32_t);
91
int doStartTableScan(bool scan=1);
92
int rnd_next(unsigned char *);
93
int rnd_pos(unsigned char * , unsigned char *);
94
void position(const unsigned char *);
97
int doInsertRecord(unsigned char * buf);
98
int doUpdateRecord(const unsigned char *, unsigned char *);
99
int doDeleteRecord(const unsigned char *);
101
virtual void get_auto_increment(uint64_t offset, uint64_t increment,
102
uint64_t nb_desired_values,
103
uint64_t *first_value,
104
uint64_t *nb_reserved_values) { (void)offset; (void)increment; (void)nb_desired_values; (void)first_value; (void)nb_reserved_values; }
105
FilesystemTableShare *get_share(const char *table_name);
107
void critical_section_enter();
108
void critical_section_exit();
110
void recordToString(std::string& output);
112
int openUpdateFile();
113
int find_current_row(unsigned char *buf);
116
#endif /* PLUGIN_FILESYSTEM_ENGINE_FILESYSTEM_ENGINE_H */