00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #pragma once
00023
00024 #include <drizzled/table/instance/base.h>
00025
00026 namespace drizzled
00027 {
00028
00029 class TableShare;
00030 class Session;
00031
00032 namespace identifier { class Table; }
00033
00034 namespace table
00035 {
00036
00037 namespace instance
00038 {
00039
00040 void release(TableShare *share);
00041 void release(TableShare::shared_ptr &share);
00042 void release(const identifier::Table &identifier);
00043
00044
00045 class Shared : public drizzled::TableShare
00046 {
00047 friend void release(TableShare *share);
00048 friend void release(TableShare::shared_ptr &share);
00049
00050 public:
00051 typedef boost::shared_ptr<Shared> shared_ptr;
00052 typedef std::vector <shared_ptr> vector;
00053
00054 Shared(const identifier::Table::Type type_arg,
00055 const identifier::Table &identifier,
00056 char *path_arg= NULL, uint32_t path_length_arg= 0);
00057
00058 Shared(const identifier::Table &identifier, message::schema::shared_ptr schema_message);
00059
00060 Shared(const identifier::Table &identifier);
00061
00062 ~Shared();
00063
00064
00065 void lock()
00066 {
00067 mutex.lock();
00068 }
00069
00070 void unlock()
00071 {
00072 mutex.unlock();
00073 }
00074
00075 static shared_ptr make_shared(Session *session,
00076 const identifier::Table &identifier,
00077 int &in_error);
00078
00079 static shared_ptr foundTableShare(shared_ptr share);
00080
00081 plugin::EventObserverList *getTableObservers()
00082 {
00083 return event_observers;
00084 }
00085
00086 void setTableObservers(plugin::EventObserverList *observers)
00087 {
00088 event_observers= observers;
00089 }
00090
00091 virtual bool is_replicated() const;
00092
00093 private:
00094 boost::mutex mutex;
00095 drizzled::message::schema::shared_ptr _schema;
00096
00097
00098
00099
00100
00101 plugin::EventObserverList *event_observers;
00102
00103 };
00104
00105 }
00106 }
00107 }
00108