1#include "mysql/psi/psi_table.h"
2#include "my_inttypes.h"
3#include "my_config.h"
4typedef unsigned char uchar;
5typedef signed char int8;
6typedef unsigned char uint8;
7typedef short int16;
8typedef unsigned short uint16;
9typedef int int32;
10typedef unsigned int uint32;
11typedef unsigned long long int ulonglong;
12typedef long long int longlong;
13typedef longlong int64;
14typedef ulonglong uint64;
15typedef unsigned long long my_ulonglong;
16typedef intptr_t intptr;
17typedef ulonglong my_off_t;
18typedef ptrdiff_t my_ptrdiff_t;
19typedef int myf;
20#include "my_macros.h"
21#include "my_psi_config.h"
22#include "my_sharedlib.h"
23#include "mysql/components/services/psi_table_bits.h"
24struct TABLE_SHARE;
25struct PSI_table_locker;
26typedef struct PSI_table_locker PSI_table_locker;
27enum PSI_table_io_operation {
28  PSI_TABLE_FETCH_ROW = 0,
29  PSI_TABLE_WRITE_ROW = 1,
30  PSI_TABLE_UPDATE_ROW = 2,
31  PSI_TABLE_DELETE_ROW = 3
32};
33typedef enum PSI_table_io_operation PSI_table_io_operation;
34struct PSI_table_locker_state {
35  unsigned int m_flags;
36  enum PSI_table_io_operation m_io_operation;
37  struct PSI_table *m_table;
38  struct PSI_table_share *m_table_share;
39  struct PSI_thread *m_thread;
40  unsigned long long m_timer_start;
41  unsigned long long (*m_timer)(void);
42  void *m_wait;
43  unsigned int m_index;
44};
45typedef struct PSI_table_locker_state PSI_table_locker_state;
46struct PSI_table_share;
47typedef struct PSI_table_share PSI_table_share;
48struct PSI_table;
49typedef struct PSI_table PSI_table;
50enum PSI_table_lock_operation {
51  PSI_TABLE_LOCK = 0,
52  PSI_TABLE_EXTERNAL_LOCK = 1
53};
54typedef enum PSI_table_lock_operation PSI_table_lock_operation;
55typedef struct PSI_table_share *(*get_table_share_v1_t)(
56    bool temporary, struct TABLE_SHARE *share);
57typedef void (*release_table_share_v1_t)(struct PSI_table_share *share);
58typedef void (*drop_table_share_v1_t)(bool temporary, const char *schema_name,
59                                      int schema_name_length,
60                                      const char *table_name,
61                                      int table_name_length);
62typedef struct PSI_table *(*open_table_v1_t)(struct PSI_table_share *share,
63                                             const void *identity);
64typedef void (*unbind_table_v1_t)(struct PSI_table *table);
65typedef PSI_table *(*rebind_table_v1_t)(PSI_table_share *share,
66                                        const void *identity, PSI_table *table);
67typedef void (*close_table_v1_t)(struct TABLE_SHARE *server_share,
68                                 struct PSI_table *table);
69typedef struct PSI_table_locker *(*start_table_io_wait_v1_t)(
70    struct PSI_table_locker_state *state, struct PSI_table *table,
71    enum PSI_table_io_operation op, unsigned int index, const char *src_file,
72    unsigned int src_line);
73typedef void (*end_table_io_wait_v1_t)(struct PSI_table_locker *locker,
74                                       unsigned long long numrows);
75typedef struct PSI_table_locker *(*start_table_lock_wait_v1_t)(
76    struct PSI_table_locker_state *state, struct PSI_table *table,
77    enum PSI_table_lock_operation op, unsigned long flags, const char *src_file,
78    unsigned int src_line);
79typedef void (*end_table_lock_wait_v1_t)(struct PSI_table_locker *locker);
80typedef void (*unlock_table_v1_t)(struct PSI_table *table);
81struct PSI_table_bootstrap {
82  void *(*get_interface)(int version);
83};
84typedef struct PSI_table_bootstrap PSI_table_bootstrap;
85struct PSI_table_service_v1 {
86  get_table_share_v1_t get_table_share;
87  release_table_share_v1_t release_table_share;
88  drop_table_share_v1_t drop_table_share;
89  open_table_v1_t open_table;
90  unbind_table_v1_t unbind_table;
91  rebind_table_v1_t rebind_table;
92  close_table_v1_t close_table;
93  start_table_io_wait_v1_t start_table_io_wait;
94  end_table_io_wait_v1_t end_table_io_wait;
95  start_table_lock_wait_v1_t start_table_lock_wait;
96  end_table_lock_wait_v1_t end_table_lock_wait;
97  unlock_table_v1_t unlock_table;
98};
99typedef struct PSI_table_service_v1 PSI_table_service_t;
100extern PSI_table_service_t *psi_table_service;
101