Update DB API documentation
Change-Id: I27caec92d3155a8e5f02a0b848bb4b1f6e254dd2
This commit is contained in:
parent
1a4fb587c6
commit
07750acd2c
@ -43,7 +43,9 @@ class DbApi(object):
|
|||||||
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
def delete_table(self, table):
|
def delete_table(self, table):
|
||||||
"""Delete a table
|
"""Delete a table. Delete all items in the table.
|
||||||
|
Reading any key from the table without re-creating it should
|
||||||
|
raise an exception.
|
||||||
|
|
||||||
:param table: table name
|
:param table: table name
|
||||||
:type table: string
|
:type table: string
|
||||||
@ -52,13 +54,17 @@ class DbApi(object):
|
|||||||
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
def get_key(self, table, key, topic=None):
|
def get_key(self, table, key, topic=None):
|
||||||
"""Get the value of a specific key in a table
|
"""Get the value of a specific key in a table. If the key does not
|
||||||
|
exist, raise a DBKeyNotFound error.
|
||||||
|
|
||||||
|
topic is an optional value which may be used to optimise the search
|
||||||
|
for the key.
|
||||||
|
|
||||||
:param table: table name
|
:param table: table name
|
||||||
:type table: string
|
:type table: string
|
||||||
:param key: key name
|
:param key: key name
|
||||||
:type key: string
|
:type key: string
|
||||||
:param topic: topic for key
|
:param topic: optional topic to aid in key lookup
|
||||||
:type topic: string
|
:type topic: string
|
||||||
:returns: string - the key value
|
:returns: string - the key value
|
||||||
:raises DragonflowException.DBKeyNotFound: if key not found
|
:raises DragonflowException.DBKeyNotFound: if key not found
|
||||||
@ -66,7 +72,11 @@ class DbApi(object):
|
|||||||
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
def set_key(self, table, key, value, topic=None):
|
def set_key(self, table, key, value, topic=None):
|
||||||
"""Set a specific key in a table with value
|
"""Set a specific key in a table with value. If the key does not
|
||||||
|
exist, the implementation may either:
|
||||||
|
1. Raise a DBLeyNotFound error
|
||||||
|
2. Create the key as if create_key was called.
|
||||||
|
Exactly one of these two option must be implemented
|
||||||
|
|
||||||
:param table: table name
|
:param table: table name
|
||||||
:type table: string
|
:type table: string
|
||||||
@ -74,10 +84,11 @@ class DbApi(object):
|
|||||||
:type key: string
|
:type key: string
|
||||||
:param value: value to set for the key
|
:param value: value to set for the key
|
||||||
:type value: string
|
:type value: string
|
||||||
:param topic: topic for key
|
:param topic: optional topic to aid in key lookup
|
||||||
:type topic: string
|
:type topic: string
|
||||||
:returns: None
|
:returns: None
|
||||||
:raises DragonflowException.DBKeyNotFound: if key not found
|
:raises DragonflowException.DBKeyNotFound: if key not found, and was
|
||||||
|
not created
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
@ -90,20 +101,21 @@ class DbApi(object):
|
|||||||
:type key: string
|
:type key: string
|
||||||
:param value: value to set for the created key
|
:param value: value to set for the created key
|
||||||
:type value: string
|
:type value: string
|
||||||
:param topic: topic for key
|
:param topic: optional topic to aid in key lookup
|
||||||
:type topic: string
|
:type topic: string
|
||||||
:returns: None
|
:returns: None
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
def delete_key(self, table, key, topic=None):
|
def delete_key(self, table, key, topic=None):
|
||||||
"""Delete a specific key from a table
|
"""Delete a specific key from a table. If the key does not exist,
|
||||||
|
raise a DBKeyNotFound error.
|
||||||
|
|
||||||
:param table: table name
|
:param table: table name
|
||||||
:type table: string
|
:type table: string
|
||||||
:param key: key name
|
:param key: key name
|
||||||
:type key: string
|
:type key: string
|
||||||
:param topic: topic for key
|
:param topic: optional topic to aid in key lookup
|
||||||
:type topic: string
|
:type topic: string
|
||||||
:returns: None
|
:returns: None
|
||||||
:raises DragonflowException.DBKeyNotFound: if key not found
|
:raises DragonflowException.DBKeyNotFound: if key not found
|
||||||
@ -111,26 +123,26 @@ class DbApi(object):
|
|||||||
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
def get_all_entries(self, table, topic=None):
|
def get_all_entries(self, table, topic=None):
|
||||||
"""Returns a list of all table entries values
|
"""Returns a list of all table entries values. If the table does
|
||||||
|
not exist, or is empty, return an empty list.
|
||||||
|
|
||||||
:param table: table name
|
:param table: table name
|
||||||
:type table: string
|
:type table: string
|
||||||
:param topic: get only entries matching this topic
|
:param topic: get only entries matching this topic
|
||||||
:type topic: string
|
:type topic: string
|
||||||
:returns: list of values
|
:returns: list of values
|
||||||
:raises DragonflowException.DBKeyNotFound: if key not found
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
def get_all_keys(self, table, topic=None):
|
def get_all_keys(self, table, topic=None):
|
||||||
"""Returns a list of all table entries keys
|
"""Returns a list of all table entries keys. If the table does not
|
||||||
|
exist, or is empty, return an empty list.
|
||||||
|
|
||||||
:param table: table name
|
:param table: table name
|
||||||
:type table: string
|
:type table: string
|
||||||
:param topic: get all keys matching this topic
|
:param topic: get all keys matching this topic
|
||||||
:type topic: string
|
:type topic: string
|
||||||
:returns: list of keys
|
:returns: list of keys
|
||||||
:raises DragonflowException.DBKeyNotFound: if key not found
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
|
Loading…
Reference in New Issue
Block a user