Package org.apache.bookkeeper.metastore
Interface MetastoreTable
- All Known Subinterfaces:
MetastoreScannableTable
- All Known Implementing Classes:
InMemoryMetastoreTable
public interface MetastoreTable
Metastore Table interface.
-
Field Summary
FieldsModifier and TypeFieldDescription -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close the table.voidGet specified fields of a key.voidGet all fields of a key.voidget(String key, MetastoreWatcher watcher, MetastoreCallback<Versioned<Value>> cb, Object ctx) Get all fields of a key.getName()Get table name.voidopenCursor(Set<String> fields, MetastoreCallback<MetastoreCursor> cb, Object ctx) Open a cursor to loop over all the entries of the table, which returns the specifiedfieldsfor each entry.voidopenCursor(MetastoreCallback<MetastoreCursor> cb, Object ctx) Open a cursor to loop over all the entries of the table, which returns all fields for each entry.voidUpdate a key according to its version.voidRemove a key by its version.
-
Field Details
-
ALL_FIELDS
-
NON_FIELDS
-
-
Method Details
-
getName
String getName()Get table name.- Returns:
- table name
-
get
Get all fields of a key.Return Code:
MSException.Code.OK: success returning the keyMSException.Code.NoKey: no key foundMSException.Code.IllegalOp/MSException.Code.ServiceDown: other issues
- Parameters:
key- Key Namecb- Callback to return all fields of the keyctx- Callback context
-
get
Get all fields of a key.Return Code:
MSException.Code.OK: success returning the keyMSException.Code.NoKey: no key foundMSException.Code.IllegalOp/MSException.Code.ServiceDown: other issues
- Parameters:
key- Key Namewatcher- Watcher object to receive notificationscb- Callback to return all fields of the keyctx- Callback context
-
get
Get specified fields of a key.Return Code:
MSException.Code.OK: success returning the keyMSException.Code.NoKey: no key foundMSException.Code.IllegalOp/MSException.Code.ServiceDown: other issues
- Parameters:
key- Key Namefields- Fields to returncb- Callback to return specified fields of the keyctx- Callback context
-
put
Update a key according to its version.Return Code:
MSException.Code.OK: success updating the keyMSException.Code.BadVersion: failed to update the key due to bad versionMSException.Code.NoKey: no key found to update data, if not providedVersion.NEWMSException.Code.KeyExists: entry exists providingVersion.NEWMSException.Code.IllegalOp/MSException.Code.ServiceDown: other issues
The key is updated only when the version matches its current version. In particular, if the provided version is:
Version.ANY: update the data without comparing its version. Note this usage is not encouraged since it may mess up data consistency.Version.NEW: create the entry if it doesn't exist before; Otherwise returnMSException.Code.KeyExists.
- Parameters:
key- Key Namevalue- Value to update.version- Version specified to update.cb- Callback to return new version after updated.ctx- Callback context
-
remove
Remove a key by its version.The key is removed only when the version matches its current version. If
versionisVersion.ANY, the key would be removed directly.Return Code:
MSException.Code.OK: success updating the keyMSException.Code.NoKey: if the key doesn't exist.MSException.Code.BadVersion: failed to delete the key due to bad versionMSException.Code.IllegalOp/MSException.Code.ServiceDown: other issues
- Parameters:
key- Key Name.version- Version specified to remove.cb- Callback to return all fields of the keyctx- Callback context
-
openCursor
Open a cursor to loop over all the entries of the table, which returns all fields for each entry. The returned cursor doesn't need to guarantee any order, since the underlying might be a hash table or an order table.- Parameters:
cb- Callback to return an opened cursorctx- Callback context
-
openCursor
Open a cursor to loop over all the entries of the table, which returns the specifiedfieldsfor each entry. The returned cursor doesn't need to guarantee any order, since the underlying might be a hash table or an order table.- Parameters:
fields- Fields to selectcb- Callback to return an opened cursorctx- Callback context
-
close
void close()Close the table.
-