~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/catalog/cache.h

  • Committer: Brian Aker
  • Date: 2010-12-03 04:10:23 UTC
  • mto: (2017.3.1 catalogs)
  • mto: This revision was merged to the branch mainline in revision 2073.
  • Revision ID: brian@tangent.org-20101203041023-hd0cwx8jgwcrivck
Big hunk of burning create/drop work.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 
24
24
#include <boost/bind.hpp>
25
25
 
 
26
#include "drizzled/catalog.h"
26
27
#include "drizzled/plugin/catalog.h"
27
28
#include "drizzled/identifier/catalog.h"
28
29
 
 
30
#include <boost/unordered_map.hpp>
 
31
#include <boost/thread/mutex.hpp>
 
32
 
29
33
namespace drizzled {
30
34
 
31
35
namespace generator {
57
61
    cache.rehash(arg);
58
62
  }
59
63
 
60
 
  catalog::Instance::shared_ptr find(const identifier::Catalog &identifier);
61
 
  void erase(const identifier::Catalog &identifier);
62
 
  bool insert(const identifier::Catalog &identifier, catalog::Instance::shared_ptr share);
 
64
  Instance::shared_ptr find(const identifier::Catalog &identifier, catalog::error_t &error);
 
65
  bool exist(const identifier::Catalog &identifier);
 
66
  bool erase(const identifier::Catalog &identifier, catalog::error_t &error);
 
67
  bool insert(const identifier::Catalog &identifier, Instance::shared_ptr instance, catalog::error_t &error);
 
68
  bool lock(const identifier::Catalog &identifier, catalog::error_t &error);
 
69
  bool unlock(const identifier::Catalog &identifier, catalog::error_t &error);
63
70
 
64
71
protected:
65
72
  friend class drizzled::generator::catalog::Cache;
66
73
  friend class drizzled::plugin::Catalog;
67
74
 
68
 
  void CopyFrom(catalog::Instance::vector &vector)
69
 
  {
70
 
    boost::mutex::scoped_lock scopedLock(_mutex);
71
 
 
72
 
    vector.reserve(catalog::Cache::singleton().size());
73
 
 
74
 
    std::transform(cache.begin(),
75
 
                   cache.end(),
76
 
                   std::back_inserter(vector),
77
 
                   boost::bind(&unordered_map::value_type::second, _1) );
78
 
    assert(vector.size() == cache.size());
79
 
  }
 
75
  void copy(catalog::Instance::vector &vector);
80
76
 
81
77
private:
82
78
  typedef boost::unordered_map< identifier::Catalog, catalog::Instance::shared_ptr> unordered_map;