-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Making HappyBase compact_table() a no-op.
Also fixing some lint related errors (not using arguments and not using self).
- Loading branch information
Showing
2 changed files
with
40 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,10 +52,12 @@ | |
_BASE_DISABLE = 'Cloud Bigtable has no concept of enabled / disabled tables.' | ||
_DISABLE_DELETE_MSG = ('The disable argument should not be used in ' | ||
'delete_table(). ') + _BASE_DISABLE | ||
_ENABLE_MSG = 'Connection.enable_table() was called, but ' + _BASE_DISABLE | ||
_DISABLE_MSG = 'Connection.disable_table() was called, but ' + _BASE_DISABLE | ||
_IS_ENABLED_MSG = ('Connection.is_table_enabled() was called, but ' + | ||
_BASE_DISABLE) | ||
_ENABLE_TMPL = 'Connection.enable_table(%r) was called, but ' + _BASE_DISABLE | ||
_DISABLE_TMPL = 'Connection.disable_table(%r) was called, but ' + _BASE_DISABLE | ||
_IS_ENABLED_TMPL = ('Connection.is_table_enabled(%r) was called, but ' + | ||
_BASE_DISABLE) | ||
_COMPACT_TMPL = ('Connection.compact_table(%r, major=%r) was called, but the ' | ||
'Cloud Bigtable API does not support compacting a table.') | ||
This comment has been minimized.
Sorry, something went wrong. |
||
|
||
|
||
def _get_instance(timeout=None): | ||
|
@@ -382,7 +384,8 @@ def delete_table(self, name, disable=False): | |
name = self._table_name(name) | ||
_LowLevelTable(name, self._instance).delete() | ||
|
||
def enable_table(self, name): | ||
@staticmethod | ||
def enable_table(name): | ||
"""Enable the specified table. | ||
.. warning:: | ||
|
@@ -393,9 +396,10 @@ def enable_table(self, name): | |
:type name: str | ||
:param name: The name of the table to be enabled. | ||
""" | ||
_WARN(_ENABLE_MSG) | ||
_WARN(_ENABLE_TMPL % (name,)) | ||
|
||
def disable_table(self, name): | ||
@staticmethod | ||
def disable_table(name): | ||
"""Disable the specified table. | ||
.. warning:: | ||
|
@@ -406,9 +410,10 @@ def disable_table(self, name): | |
:type name: str | ||
:param name: The name of the table to be disabled. | ||
""" | ||
_WARN(_DISABLE_MSG) | ||
_WARN(_DISABLE_TMPL % (name,)) | ||
|
||
def is_table_enabled(self, name): | ||
@staticmethod | ||
def is_table_enabled(name): | ||
"""Return whether the specified table is enabled. | ||
.. warning:: | ||
|
@@ -423,22 +428,25 @@ def is_table_enabled(self, name): | |
:rtype: bool | ||
:returns: The value :data:`True` always. | ||
""" | ||
_WARN(_IS_ENABLED_MSG) | ||
_WARN(_IS_ENABLED_TMPL % (name,)) | ||
return True | ||
|
||
def compact_table(self, name, major=False): | ||
@staticmethod | ||
def compact_table(name, major=False): | ||
"""Compact the specified table. | ||
.. warning:: | ||
Cloud Bigtable does not support compacting a table, so this | ||
This comment has been minimized.
Sorry, something went wrong.
mbrukman
Contributor
|
||
method does not work. It is provided simply for compatibility. | ||
method does nothing. It is provided simply for compatibility. | ||
:type name: str | ||
:param name: The name of the table to compact. | ||
:raises: :class:`NotImplementedError <exceptions.NotImplementedError>` | ||
always | ||
:type major: bool | ||
:param major: Whether to perform a major compaction. | ||
""" | ||
raise NotImplementedError('The Cloud Bigtable API does not support ' | ||
'compacting a table.') | ||
_WARN(_COMPACT_TMPL % (name, major)) | ||
|
||
|
||
def _parse_family_option(option): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I would say:
The way it's written suggests that Cloud Bigtable does not actually know how to compact tables.