Package io.pravega.client.tables
Class TableKey<KeyT>
- java.lang.Object
-
- io.pravega.client.tables.TableKey<KeyT>
-
- Type Parameters:
KeyT
- Type of the Key.
public class TableKey<KeyT> extends java.lang.Object
AKeyValueTable
Key with aVersion
.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description KeyT
getKey()
The Key.Version
getVersion()
The Version.static <KeyT> TableKey<KeyT>
notExists(KeyT key)
Creates a newTableKey
with a version that indicates the key must not exist.java.lang.String
toString()
static <KeyT> TableKey<KeyT>
unversioned(KeyT key)
Creates a newTableKey
with no specific version.static <KeyT> TableKey<KeyT>
versioned(KeyT key, Version version)
Creates a newTableKey
with a specific version.
-
-
-
Method Detail
-
unversioned
public static <KeyT> TableKey<KeyT> unversioned(KeyT key)
Creates a newTableKey
with no specific version. When used withKeyValueTable.removeAll(java.lang.String, java.lang.Iterable<io.pravega.client.tables.TableKey<KeyT>>)
, thisTableKey
will be treated as an unconditional removal.- Type Parameters:
KeyT
- Key Type.- Parameters:
key
- The Key.- Returns:
- An unversioned
TableKey
(version set toVersion.NO_VERSION
).
-
notExists
public static <KeyT> TableKey<KeyT> notExists(KeyT key)
Creates a newTableKey
with a version that indicates the key must not exist. When used withKeyValueTable.removeAll(java.lang.String, java.lang.Iterable<io.pravega.client.tables.TableKey<KeyT>>)
, thisTableKey
will be treated conditional removal.By itself, this is not a useful scenario (removing a key conditioned on it not existing in the first place doesn't make much sense). However, when used in combination with other removals (
KeyValueTable.removeAll(java.lang.String, java.lang.Iterable<io.pravega.client.tables.TableKey<KeyT>>)
accepts multipleTableKey
s), this can be used to condition the entire batch on a particularTableKey
's inexistence (i.e., only perform these removals iff a certainTableKey
is not present).- Type Parameters:
KeyT
- Key Type- Parameters:
key
- The Key.- Returns:
- A
TableKey
with a version set toVersion.NOT_EXISTS
.
-
versioned
public static <KeyT> TableKey<KeyT> versioned(KeyT key, Version version)
Creates a newTableKey
with a specific version. When used withKeyValueTable.removeAll(java.lang.String, java.lang.Iterable<io.pravega.client.tables.TableKey<KeyT>>)
, thisTableKey
will be treated as a conditional removal, conditioned on the Key existing and having the specified version.- Type Parameters:
KeyT
- Key Type.- Parameters:
key
- The Key.version
- The Version.- Returns:
- A
TableKey
.
-
getKey
@NonNull public KeyT getKey()
The Key.- Returns:
- The Key.
-
getVersion
public Version getVersion()
The Version. If null, any updates for this Key will be unconditional. SeeKeyValueTable
for details on conditional updates.- Returns:
- Version associated with the key.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-