MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
table_host_cache.h
Go to the documentation of this file.
1 /* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
2 
3  This program is free software; you can redistribute it and/or modify
4  it under the terms of the GNU General Public License as published by
5  the Free Software Foundation; version 2 of the License.
6 
7  This program is distributed in the hope that it will be useful,
8  but WITHOUT ANY WARRANTY; without even the implied warranty of
9  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  GNU General Public License for more details.
11 
12  You should have received a copy of the GNU General Public License
13  along with this program; if not, write to the Free Software Foundation,
14  51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
15 
16 #ifndef TABLE_HOST_CACHE_H
17 #define TABLE_HOST_CACHE_H
18 
24 #include "pfs_column_types.h"
25 #include "pfs_engine_table.h"
26 
27 class Host_entry;
28 
36 {
38  char m_ip[64];
39  uint m_ip_length;
41  char m_hostname[255];
42  uint m_hostname_length;
76  ulonglong m_count_ssl_errors;
90  ulonglong m_first_seen;
92  ulonglong m_last_seen;
94  ulonglong m_first_error_seen;
96  ulonglong m_last_error_seen;
97 };
98 
101 {
102 public:
105  static PFS_engine_table* create();
106  static int delete_all_rows();
107 
108  virtual int rnd_next();
109  virtual int rnd_pos(const void *pos);
110  virtual void reset_position(void);
111 
112 protected:
113  virtual int read_row_values(TABLE *table,
114  unsigned char *buf,
115  Field **fields,
116  bool read_all);
117 
119 
120 public:
122  {}
123 
124 private:
125  void materialize(THD *thd);
126  static void make_row(Host_entry *entry, row_host_cache *row);
127 
129  static THR_LOCK m_table_lock;
131  static TABLE_FIELD_DEF m_field_def;
132 
133  row_host_cache *m_all_rows;
134  uint m_row_count;
136  row_host_cache *m_row;
138  PFS_simple_index m_pos;
140  PFS_simple_index m_next_pos;
141 };
142 
144 #endif