net.floodlightcontroller.storage.nosql
Class NoSqlStorageSource
java.lang.Object
net.floodlightcontroller.storage.AbstractStorageSource
net.floodlightcontroller.storage.nosql.NoSqlStorageSource
- All Implemented Interfaces:
- IFloodlightModule, IFloodlightService, IStorageSourceService
- Direct Known Subclasses:
- MemoryStorageSource
public abstract class NoSqlStorageSource
- extends AbstractStorageSource
Fields inherited from class net.floodlightcontroller.storage.AbstractStorageSource |
allTableNames, counterStore, DB_ERROR_EXPLANATION, defaultExecutorService, exceptionHandler, executorService, logger, restApi, STORAGE_DELETE_COUNTER_NAME, STORAGE_QUERY_COUNTER_NAME, STORAGE_UPDATE_COUNTER_NAME |
Method Summary |
IQuery |
createQuery(java.lang.String tableName,
java.lang.String[] columnNameList,
IPredicate predicate,
RowOrdering rowOrdering)
Create a query object representing the given query parameters. |
void |
createTable(java.lang.String tableName,
java.util.Set<java.lang.String> indexedColumns)
Create a new table if one does not already exist with the given name. |
void |
deleteRowImpl(java.lang.String tableName,
java.lang.Object key)
|
protected void |
deleteRowsAndNotify(java.lang.String tableName,
java.util.Set<java.lang.Object> rowKeyList)
|
protected abstract java.util.List<java.util.Map<java.lang.String,java.lang.Object>> |
executeEqualityQuery(java.lang.String tableName,
java.lang.String[] columnNameList,
java.lang.String predicateColumnName,
java.lang.Comparable<?> value)
|
IResultSet |
executeQueryImpl(IQuery query)
|
protected abstract java.util.List<java.util.Map<java.lang.String,java.lang.Object>> |
executeRangeQuery(java.lang.String tableName,
java.lang.String[] columnNameList,
java.lang.String predicateColumnName,
java.lang.Comparable<?> startValue,
boolean startInclusive,
java.lang.Comparable<?> endValue,
boolean endInclusive)
|
protected abstract java.util.Collection<java.util.Map<java.lang.String,java.lang.Object>> |
getAllRows(java.lang.String tableName,
java.lang.String[] columnNameList)
|
protected NoSqlStorageSource.ColumnIndexMode |
getColumnIndexMode(java.lang.String tableName,
java.lang.String columnName)
|
protected abstract java.util.Map<java.lang.String,java.lang.Object> |
getRow(java.lang.String tableName,
java.lang.String[] columnNameList,
java.lang.Object rowKey)
|
IResultSet |
getRowImpl(java.lang.String tableName,
java.lang.Object rowKey)
|
protected java.lang.String |
getTablePrimaryKeyName(java.lang.String tableName)
|
void |
insertRowImpl(java.lang.String tableName,
java.util.Map<java.lang.String,java.lang.Object> values)
|
protected abstract void |
insertRows(java.lang.String tableName,
java.util.List<java.util.Map<java.lang.String,java.lang.Object>> insertRowList)
|
protected void |
insertRowsAndNotify(java.lang.String tableName,
java.util.List<java.util.Map<java.lang.String,java.lang.Object>> insertRowList)
|
protected void |
sendNotification(java.lang.String tableName,
StorageSourceNotification.Action action,
java.util.List<java.util.Map<java.lang.String,java.lang.Object>> rows)
|
protected void |
sendNotification(java.lang.String tableName,
StorageSourceNotification.Action action,
java.util.Set<java.lang.Object> rowKeys)
|
void |
setColumnIndexMode(java.lang.String tableName,
java.lang.String columnName,
NoSqlStorageSource.ColumnIndexMode indexMode)
|
void |
setTablePrimaryKeyName(java.lang.String tableName,
java.lang.String primaryKeyName)
Set the column to be used as the primary key for a table. |
void |
updateMatchingRowsImpl(java.lang.String tableName,
IPredicate predicate,
java.util.Map<java.lang.String,java.lang.Object> values)
|
void |
updateRowImpl(java.lang.String tableName,
java.util.Map<java.lang.String,java.lang.Object> values)
|
void |
updateRowImpl(java.lang.String tableName,
java.lang.Object rowKey,
java.util.Map<java.lang.String,java.lang.Object> values)
|
protected abstract void |
updateRows(java.lang.String tableName,
java.util.Set<java.lang.Object> rowKeys,
java.util.Map<java.lang.String,java.lang.Object> updateColumnMap)
|
protected void |
updateRowsAndNotify(java.lang.String tableName,
java.util.List<java.util.Map<java.lang.String,java.lang.Object>> updateRowList)
|
protected void |
updateRowsAndNotify(java.lang.String tableName,
java.util.Set<java.lang.Object> rowKeys,
java.util.Map<java.lang.String,java.lang.Object> updateRowList)
|
Methods inherited from class net.floodlightcontroller.storage.AbstractStorageSource |
addListener, deleteMatchingRows, deleteMatchingRowsAsync, deleteRow, deleteRowAsync, deleteRows, deleteRowsAsync, deleteRowsImpl, executeQuery, executeQuery, executeQuery, executeQueryAsync, executeQueryAsync, executeQueryAsync, getAllTableNames, getModuleDependencies, getModuleServices, getRow, getRowAsync, getServiceImpls, init, insertRow, insertRowAsync, notifyListeners, notifyListeners, removeListener, saveAsync, setCounterStore, setExceptionHandler, setExecutorService, startUp, updateCounters, updateMatchingRows, updateMatchingRowsAsync, updateRow, updateRow, updateRowAsync, updateRowAsync, updateRows, updateRowsAsync, updateRowsImpl |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
log
protected static org.slf4j.Logger log
DEFAULT_PRIMARY_KEY_NAME
protected static final java.lang.String DEFAULT_PRIMARY_KEY_NAME
- See Also:
- Constant Field Values
NoSqlStorageSource
public NoSqlStorageSource()
createTable
public void createTable(java.lang.String tableName,
java.util.Set<java.lang.String> indexedColumns)
- Description copied from interface:
IStorageSourceService
- Create a new table if one does not already exist with the given name.
- Specified by:
createTable
in interface IStorageSourceService
- Overrides:
createTable
in class AbstractStorageSource
- Parameters:
tableName
- The name of the table to create.indexedColumns
- Which columns should be indexed
setTablePrimaryKeyName
public void setTablePrimaryKeyName(java.lang.String tableName,
java.lang.String primaryKeyName)
- Description copied from interface:
IStorageSourceService
- Set the column to be used as the primary key for a table. This should
be guaranteed to be unique for all of the rows in the table, although the
storage API does not necessarily enforce this requirement. If no primary
key name is specified for a table then the storage API assumes there is
a column named "id" that is used as the primary key. In this case when
a new row is inserted using the storage API and no id is specified
explictly in the row data, the storage API automatically generates a
unique ID (typically a UUID) for the id column. To work across all
possible implementations of the storage API it is safest, though, to
specify the primary key column explicitly.
FIXME: It's sort of a kludge to have to specify the primary key column
here. Ideally there would be some sort of metadata -- perhaps stored
directly in the table, at least in the NoSQL case -- that the
storage API could query to obtain the primary key info.
- Specified by:
setTablePrimaryKeyName
in interface IStorageSourceService
- Specified by:
setTablePrimaryKeyName
in class AbstractStorageSource
- Parameters:
tableName
- The name of the table for which we're setting the keyprimaryKeyName
- The name of column to be used as the primary key
getTablePrimaryKeyName
protected java.lang.String getTablePrimaryKeyName(java.lang.String tableName)
getColumnIndexMode
protected NoSqlStorageSource.ColumnIndexMode getColumnIndexMode(java.lang.String tableName,
java.lang.String columnName)
setColumnIndexMode
public void setColumnIndexMode(java.lang.String tableName,
java.lang.String columnName,
NoSqlStorageSource.ColumnIndexMode indexMode)
createQuery
public IQuery createQuery(java.lang.String tableName,
java.lang.String[] columnNameList,
IPredicate predicate,
RowOrdering rowOrdering)
- Description copied from interface:
IStorageSourceService
- Create a query object representing the given query parameters. The query
object can be passed to executeQuery to actually perform the query and obtain
a result set.
- Specified by:
createQuery
in interface IStorageSourceService
- Specified by:
createQuery
in class AbstractStorageSource
- Parameters:
tableName
- The name of the table to query.columnNameList
- The list of columns to return in the result set.predicate
- The predicate that specifies which rows to return in the result set.rowOrdering
- Specification of order that rows are returned from the result set
returned from executing the query. If the ordering is null, then rows are returned
in an implementation-specific order.
- Returns:
- Query object to be passed to executeQuery.
executeQueryImpl
public IResultSet executeQueryImpl(IQuery query)
- Specified by:
executeQueryImpl
in class AbstractStorageSource
sendNotification
protected void sendNotification(java.lang.String tableName,
StorageSourceNotification.Action action,
java.util.List<java.util.Map<java.lang.String,java.lang.Object>> rows)
sendNotification
protected void sendNotification(java.lang.String tableName,
StorageSourceNotification.Action action,
java.util.Set<java.lang.Object> rowKeys)
insertRowsAndNotify
protected void insertRowsAndNotify(java.lang.String tableName,
java.util.List<java.util.Map<java.lang.String,java.lang.Object>> insertRowList)
insertRowImpl
public void insertRowImpl(java.lang.String tableName,
java.util.Map<java.lang.String,java.lang.Object> values)
- Specified by:
insertRowImpl
in class AbstractStorageSource
updateRowsAndNotify
protected void updateRowsAndNotify(java.lang.String tableName,
java.util.Set<java.lang.Object> rowKeys,
java.util.Map<java.lang.String,java.lang.Object> updateRowList)
updateRowsAndNotify
protected void updateRowsAndNotify(java.lang.String tableName,
java.util.List<java.util.Map<java.lang.String,java.lang.Object>> updateRowList)
updateMatchingRowsImpl
public void updateMatchingRowsImpl(java.lang.String tableName,
IPredicate predicate,
java.util.Map<java.lang.String,java.lang.Object> values)
- Specified by:
updateMatchingRowsImpl
in class AbstractStorageSource
updateRowImpl
public void updateRowImpl(java.lang.String tableName,
java.lang.Object rowKey,
java.util.Map<java.lang.String,java.lang.Object> values)
- Specified by:
updateRowImpl
in class AbstractStorageSource
updateRowImpl
public void updateRowImpl(java.lang.String tableName,
java.util.Map<java.lang.String,java.lang.Object> values)
- Specified by:
updateRowImpl
in class AbstractStorageSource
deleteRowsAndNotify
protected void deleteRowsAndNotify(java.lang.String tableName,
java.util.Set<java.lang.Object> rowKeyList)
deleteRowImpl
public void deleteRowImpl(java.lang.String tableName,
java.lang.Object key)
- Specified by:
deleteRowImpl
in class AbstractStorageSource
getRowImpl
public IResultSet getRowImpl(java.lang.String tableName,
java.lang.Object rowKey)
- Specified by:
getRowImpl
in class AbstractStorageSource
getAllRows
protected abstract java.util.Collection<java.util.Map<java.lang.String,java.lang.Object>> getAllRows(java.lang.String tableName,
java.lang.String[] columnNameList)
getRow
protected abstract java.util.Map<java.lang.String,java.lang.Object> getRow(java.lang.String tableName,
java.lang.String[] columnNameList,
java.lang.Object rowKey)
executeEqualityQuery
protected abstract java.util.List<java.util.Map<java.lang.String,java.lang.Object>> executeEqualityQuery(java.lang.String tableName,
java.lang.String[] columnNameList,
java.lang.String predicateColumnName,
java.lang.Comparable<?> value)
executeRangeQuery
protected abstract java.util.List<java.util.Map<java.lang.String,java.lang.Object>> executeRangeQuery(java.lang.String tableName,
java.lang.String[] columnNameList,
java.lang.String predicateColumnName,
java.lang.Comparable<?> startValue,
boolean startInclusive,
java.lang.Comparable<?> endValue,
boolean endInclusive)
insertRows
protected abstract void insertRows(java.lang.String tableName,
java.util.List<java.util.Map<java.lang.String,java.lang.Object>> insertRowList)
updateRows
protected abstract void updateRows(java.lang.String tableName,
java.util.Set<java.lang.Object> rowKeys,
java.util.Map<java.lang.String,java.lang.Object> updateColumnMap)