27 #ifndef Hypertable_Lib_Schema_h
28 #define Hypertable_Lib_Schema_h
43 #include <unordered_map>
185 const std::string
render_xml(
bool with_ids=
false);
202 const std::string
render_hql(
const std::string &table_name);
295 if (get_deleted || iter->second->get_deleted() ==
false)
296 return (iter->second);
471 #endif // Hypertable_Lib_Schema_h
ColumnFamilyOptions m_cf_defaults
Default column family options.
void set_version(int32_t version)
Sets version number.
int32_t get_group_commit_interval()
Gets group commit interval.
CstrColumnFamilyMap m_column_family_map
std::string String
A String is simply a typedef to std::string.
void validate()
Validates schema and reconstructs data structures.
std::vector< AccessGroupSpec * > AccessGroupSpecs
Vector of AccessGroupSpec pointers.
int32_t get_version() const
Gets version number.
AccessGroupSpec * get_access_group(const char *name)
void rename_column_family(const String &old_name, const String &new_name)
Renames a column family.
Program options handling.
Column family specification.
PageArena memory allocator for STL classes.
Specification for column family options.
The PageArenaAllocator is a STL allocator based on PageArena.
ColumnFamilySpecs m_column_families
&Column family specifications
std::map< int32_t, ColumnFamilySpec * > m_column_family_id_map
Map of column family specifications (key == ID)
void set_access_group_defaults(const AccessGroupOptions &defaults)
Sets default access group options.
std::map< const char *, AccessGroupSpec *, LtCstr, CstrAlloc > CstrAccessGroupMap
Map of access group specifications.
Specification for access group options.
Represents a set of table parts (sub-tables).
ColumnFamilySpecs & get_column_families()
Returns reference to column family vector.
AccessGroupSpecs & get_access_groups()
Returns reference to access group vector.
CstrAccessGroupMap m_access_group_map
std::map< const char *, ColumnFamilySpec *, LtCstr, CstrAlloc > CstrColumnFamilyMap
Map of column family specifications (key == name)
void drop_column_family(const String &name)
Drops column family.
TableParts get_table_parts()
Gets table parts.
ColumnFamilySpec * get_column_family(const char *name)
bool access_group_exists(const std::string &name) const
Checks if access group exists.
AccessGroupSpec * get_access_group(const std::string &name)
Gets an access group specification given its name.
AccessGroupOptions m_ag_defaults
Default access group options.
STL Strict Weak Ordering for comparing c-style strings.
int32_t m_version
Version number.
The PageArena allocator is simple and fast, avoiding individual mallocs/frees.
AccessGroupOptions & access_group_defaults()
Returns reference to default access group options.
void set_generation(int64_t generation)
Sets generation.
Access group specification.
bool clear_generation_if_changed(Schema &original)
Clears generation if different than original.
int64_t get_generation() const
Gets generation.
static Schema * new_instance(const std::string &buf)
Creates schema object from XML schema string.
void set_column_family_defaults(const ColumnFamilyOptions &defaults)
Sets default column family options.
ColumnFamilySpec * get_column_family(int32_t id, bool get_deleted=false)
Gets a column family specification given its ID.
void add_access_group(AccessGroupSpec *ag)
Adds access group specification.
ColumnFamilySpec * get_column_family(const std::string &name)
Gets a column family specification given its name.
Declarations for AccessGroupSpec.
AccessGroupSpecs m_access_groups
Access group specifications.
bool column_family_exists(int32_t id, bool get_deleted=false) const
Checks if column family exists.
std::vector< bool > m_counter_mask
Bitmask describing which column families are counters.
ColumnFamilyOptions & column_family_defaults()
Returns reference to default column family options.
void merge_table_defaults(ColumnFamilySpec *cf_spec)
Merges default column family options into a column family spec.
void clear_generation()
Clears generation values.
const std::string render_hql(const std::string &table_name)
Renders schema as HQL CREATE TABLE statement.
void set_group_commit_interval(int32_t interval)
Sets group commit interval.
AccessGroupSpec * replace_access_group(AccessGroupSpec *new_ag)
Replaces access group specification.
PageArenaAllocator< const char * > CstrAlloc
int32_t get_max_column_family_id()
Gets the maximum column family ID.
std::shared_ptr< Schema > SchemaPtr
Smart pointer to Schema.
int32_t m_group_commit_interval
Group commit interval.
std::vector< ColumnFamilySpec * > ColumnFamilySpecs
Vector of ColumnFamilySpec pointers.
Schema()
Default constructor.
int64_t m_generation
Generation.
String extensions and helpers: sets, maps, append operators etc.
ColumnFamilySpec * remove_column_family(const std::string &name)
Removes column family.
bool column_is_counter(int id)
Checks if column is a counter column.
const std::string render_xml(bool with_ids=false)
Renders schema in XML format.
Declarations for ColumnFamilySpec.
void update_generation(int64_t generation)
Updates generation and assigns column family IDs.
Declarations for TableParts.