~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to client/stats.h

  • Committer: Monty Taylor
  • Date: 2010-04-15 19:14:53 UTC
  • mto: This revision was merged to the branch mainline in revision 1476.
  • Revision ID: mordred@inaugust.com-20100415191453-ril2x8qdo78fny9w
Replaced test_authz with a plugin implementing a hard-coded simple
multi-tennancy policy. The policy describes:
- A root user exists which can do anything
- A user may only see a schema that is named the same has his user name
- A user may see data_dictionary and information_schema (data_dictionary
  required for show databases to work)

This way, we can more clearly test the results of the authorization
interface while providing an optional plugin that is actually useful to some
human.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
 
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 
 *
4
 
 *  Copyright (C) 2010 Vijay Samuel
5
 
 *  Copyright (C) 2008 MySQL
6
 
 *
7
 
 *  This program is free software; you can redistribute it and/or modify
8
 
 *  it under the terms of the GNU General Public License as published by
9
 
 *  the Free Software Foundation; either version 2 of the License, or
10
 
 *  (at your option) any later version.
11
 
 *
12
 
 *  This program is distributed in the hope that it will be useful,
13
 
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 
 *  GNU General Public License for more details.
16
 
 *
17
 
 *  You should have received a copy of the GNU General Public License
18
 
 *  along with this program; if not, write to the Free Software
19
 
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
20
 
 */
21
 
 
22
 
#ifndef CLIENT_STATS_H
23
 
#define CLIENT_STATS_H
24
 
 
25
 
#include "client_priv.h"
26
 
#include <string>
27
 
#include <iostream>
28
 
 
29
 
class Stats 
30
 
{
31
 
public:
32
 
  Stats(long int in_timing,
33
 
        uint32_t in_users,
34
 
        uint32_t in_real_users,
35
 
        uint32_t in_rows,
36
 
        long int in_create_timing,
37
 
        uint64_t in_create_count) :
38
 
    timing(in_timing),
39
 
    users(in_users),
40
 
    real_users(in_real_users),
41
 
    rows(in_rows),
42
 
    create_timing(in_create_timing),
43
 
    create_count(in_create_count)
44
 
  { }
45
 
 
46
 
  Stats() :
47
 
    timing(0),
48
 
    users(0),
49
 
    real_users(0),
50
 
    rows(0),
51
 
    create_timing(0),
52
 
    create_count(0)
53
 
  { }
54
 
 
55
 
  long int getTiming() const
56
 
  {
57
 
    return timing;
58
 
  }
59
 
 
60
 
  uint32_t getUsers() const
61
 
  {
62
 
    return users;
63
 
  }   
64
 
 
65
 
  uint32_t getRealUsers() const
66
 
  {
67
 
    return real_users;
68
 
  }
69
 
 
70
 
  uint64_t getRows() const
71
 
  {
72
 
    return rows;
73
 
  }
74
 
 
75
 
  long int getCreateTiming() const
76
 
  {
77
 
    return create_timing;
78
 
  }
79
 
 
80
 
  uint64_t getCreateCount() const
81
 
  {
82
 
    return create_count;
83
 
  }
84
 
 
85
 
  void setTiming(long int in_timing)
86
 
  {
87
 
  timing= in_timing;
88
 
  }
89
 
 
90
 
  void setUsers(uint32_t in_users)
91
 
  {
92
 
    users= in_users;
93
 
  }
94
 
 
95
 
  void setRealUsers(uint32_t in_real_users)
96
 
  {
97
 
    real_users= in_real_users;
98
 
  }
99
 
 
100
 
  void setRows(uint64_t in_rows)
101
 
  {
102
 
    rows= in_rows;
103
 
  }
104
 
   
105
 
  void setCreateTiming(long int in_create_timing)
106
 
  {
107
 
    create_timing= in_create_timing;
108
 
  }
109
 
 
110
 
  void setCreateCount(uint64_t in_create_count)
111
 
  {
112
 
  create_count= in_create_count;
113
 
  }
114
 
  
115
 
private:
116
 
  long int timing;
117
 
  uint32_t users;
118
 
  uint32_t real_users;
119
 
  uint64_t rows;
120
 
  long int create_timing;
121
 
  uint64_t create_count;
122
 
};
123
 
 
124
 
#endif /* CLIENT_STATS_H */