Package io.pravega.client.tables.impl
Class TableSegmentEntry
- java.lang.Object
-
- io.pravega.client.tables.impl.TableSegmentEntry
-
public class TableSegmentEntry extends java.lang.Object
Entry in aTableSegment
.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description @NonNull TableSegmentKey
getKey()
ATableSegmentKey
representing the Key of this Table Entry.io.netty.buffer.ByteBuf
getValue()
AByteBuf
representing the contents (value) of this Table Entry.static TableSegmentEntry
notExists(byte[] key, byte[] value)
Creates a newTableSegmentEntry
with a version that indicates the key must not exist.static TableSegmentEntry
notExists(io.netty.buffer.ByteBuf key, io.netty.buffer.ByteBuf value)
Creates a newTableSegmentEntry
with a version that indicates the key must not exist.static TableSegmentEntry
notFound(io.netty.buffer.ByteBuf key)
Creates a newTableSegmentEntry
for a response that indicates it does not exist.static TableSegmentEntry
unversioned(byte[] key, byte[] value)
Creates a newTableSegmentEntry
with no specific version.static TableSegmentEntry
unversioned(io.netty.buffer.ByteBuf key, io.netty.buffer.ByteBuf value)
Creates a newTableSegmentEntry
with no specific version.static TableSegmentEntry
versioned(byte[] key, byte[] value, long version)
Creates a newTableSegmentEntry
with a specific version.static TableSegmentEntry
versioned(io.netty.buffer.ByteBuf key, io.netty.buffer.ByteBuf value, long version)
Creates a newTableSegmentEntry
with a specific version.
-
-
-
Method Detail
-
unversioned
public static TableSegmentEntry unversioned(io.netty.buffer.ByteBuf key, io.netty.buffer.ByteBuf value)
Creates a newTableSegmentEntry
with no specific version. When used withTableSegment.put(io.pravega.client.tables.impl.TableSegmentEntry)
, thisTableSegmentEntry
will be treated as an unconditional update.- Parameters:
key
- AByteBuf
representing the contents of the Table Entry Key.value
- AByteBuf
representing the Table Entry Value.- Returns:
- An unversioned
TableSegmentEntry
.
-
unversioned
public static TableSegmentEntry unversioned(byte[] key, byte[] value)
Creates a newTableSegmentEntry
with no specific version. When used withTableSegment.put(io.pravega.client.tables.impl.TableSegmentEntry)
, thisTableSegmentEntry
will be treated as an unconditional update.- Parameters:
key
- A byte array representing the contents of the Table Key. This will be wrapped in aByteBuf
.value
- A byte array representing the contents Table Entry Value. This will be wrapped in aByteBuf
.- Returns:
- An unversioned
TableSegmentEntry
.
-
versioned
public static TableSegmentEntry versioned(io.netty.buffer.ByteBuf key, io.netty.buffer.ByteBuf value, long version)
Creates a newTableSegmentEntry
with a specific version. When used withTableSegment.put(io.pravega.client.tables.impl.TableSegmentEntry)
, thisTableSegmentEntry
will be treated as a conditional update, conditioned on the key existing and having the specified version.- Parameters:
key
- AByteBuf
representing the contents of the Table Entry Key.value
- AByteBuf
representing the Table Entry Value.version
- The version to set. Consider usingunversioned(io.netty.buffer.ByteBuf, io.netty.buffer.ByteBuf)
,notExists(io.netty.buffer.ByteBuf, io.netty.buffer.ByteBuf)
ornotFound(io.netty.buffer.ByteBuf)
for special-case versions.- Returns:
- A versioned
TableSegmentEntry
.
-
versioned
public static TableSegmentEntry versioned(byte[] key, byte[] value, long version)
Creates a newTableSegmentEntry
with a specific version. When used withTableSegment.put(io.pravega.client.tables.impl.TableSegmentEntry)
, thisTableSegmentEntry
will be treated as a conditional update, conditioned on the key existing and having the specified version.- Parameters:
key
- A byte array representing the contents of the Table Key. This will be wrapped in aByteBuf
.value
- A byte array representing the contents Table Entry Value. This will be wrapped in aByteBuf
.version
- The version to set. Consider usingunversioned(io.netty.buffer.ByteBuf, io.netty.buffer.ByteBuf)
,notExists(io.netty.buffer.ByteBuf, io.netty.buffer.ByteBuf)
ornotFound(io.netty.buffer.ByteBuf)
for special-case versions.- Returns:
- A versioned
TableSegmentEntry
.
-
notExists
public static TableSegmentEntry notExists(io.netty.buffer.ByteBuf key, io.netty.buffer.ByteBuf value)
Creates a newTableSegmentEntry
with a version that indicates the key must not exist. When used withTableSegment.put(io.pravega.client.tables.impl.TableSegmentEntry)
, thisTableSegmentEntry
will be treated as a conditional update, conditioned on the key not existing.- Parameters:
key
- AByteBuf
representing the contents of the Table Entry Key.value
- AByteBuf
representing the Table Entry Value.- Returns:
- A
TableSegmentEntry
with a version set toTableSegmentKeyVersion.NOT_EXISTS
.
-
notExists
public static TableSegmentEntry notExists(byte[] key, byte[] value)
Creates a newTableSegmentEntry
with a version that indicates the key must not exist. When used withTableSegment.put(io.pravega.client.tables.impl.TableSegmentEntry)
, thisTableSegmentEntry
will be treated as a conditional update, conditioned on the key not existing.- Parameters:
key
- A byte array representing the contents of the Table Key. This will be wrapped in aByteBuf
.value
- A byte array representing the contents Table Entry Value. This will be wrapped in aByteBuf
.- Returns:
- A
TableSegmentEntry
with a version set toTableSegmentKeyVersion.NOT_EXISTS
.
-
notFound
public static TableSegmentEntry notFound(io.netty.buffer.ByteBuf key)
Creates a newTableSegmentEntry
for a response that indicates it does not exist. This is usually invoked internally from theTableSegment
implementation to construct the response. ThisTableSegmentEntry
should not be used as an argument forTableSegment.put(io.pravega.client.tables.impl.TableSegmentEntry)
calls.- Parameters:
key
- AByteBuf
representing the contents of the Table Entry Key.- Returns:
- A
TableSegmentEntry
with a version set toTableSegmentKeyVersion.NOT_EXISTS
and agetValue()
set to null.
-
getKey
@NonNull public @NonNull TableSegmentKey getKey()
ATableSegmentKey
representing the Key of this Table Entry.
-
getValue
public io.netty.buffer.ByteBuf getValue()
AByteBuf
representing the contents (value) of this Table Entry. May be null ifgetKey()
indicates that it does not exist.
-
-