public class DummyRecordSerde extends java.lang.Object implements SerDe<DummyRecord>
Constructor and Description |
---|
DummyRecordSerde() |
Modifier and Type | Method and Description |
---|---|
DummyRecord |
deserializeEdit(java.io.DataInputStream in,
java.util.Map<java.lang.Object,DummyRecord> currentVersion,
int version)
Reads an Edit Record from the given
DataInputStream and merges
that edit with the current version of the record, returning the new,
merged version. |
DummyRecord |
deserializeRecord(java.io.DataInputStream in,
int version)
Reads a Record from the given
DataInputStream and returns this
record. |
java.lang.String |
getLocation(DummyRecord record)
Returns the external location of the given record; this is used when a
record is moved away from WALI or is being re-introduced to WALI.
|
java.lang.Object |
getRecordIdentifier(DummyRecord record)
Returns the unique ID for the given record
|
UpdateType |
getUpdateType(DummyRecord record)
Returns the UpdateType for the given record
|
int |
getVersion()
Returns the version that this SerDe will use when writing.
|
void |
serializeEdit(DummyRecord previousState,
DummyRecord record,
java.io.DataOutputStream out)
Serializes an Edit Record to the log via the given
DataOutputStream . |
void |
serializeRecord(DummyRecord record,
java.io.DataOutputStream out)
Serializes a Record in a form suitable for a Snapshot via the given
DataOutputStream . |
void |
setThrowIOEAfterNSerializeEdits(int n) |
void |
setThrowOOMEAfterNSerializeEdits(int n) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
close, readHeader, writeHeader
public void serializeEdit(DummyRecord previousState, DummyRecord record, java.io.DataOutputStream out) throws java.io.IOException
SerDe
Serializes an Edit Record to the log via the given
DataOutputStream
.
serializeEdit
in interface SerDe<DummyRecord>
previousState
- previous staterecord
- new stateout
- stream to write tojava.io.IOException
- if fail during writepublic void serializeRecord(DummyRecord record, java.io.DataOutputStream out) throws java.io.IOException
SerDe
Serializes a Record in a form suitable for a Snapshot via the given
DataOutputStream
.
serializeRecord
in interface SerDe<DummyRecord>
record
- to serializeout
- to write tojava.io.IOException
- if failed to writepublic DummyRecord deserializeRecord(java.io.DataInputStream in, int version) throws java.io.IOException
SerDe
Reads a Record from the given DataInputStream
and returns this
record. If no data is available, returns null
.
deserializeRecord
in interface SerDe<DummyRecord>
in
- stream to read fromversion
- the version of the SerDe that was used to serialize the
recordjava.io.IOException
- failure readingpublic java.lang.Object getRecordIdentifier(DummyRecord record)
SerDe
getRecordIdentifier
in interface SerDe<DummyRecord>
record
- to obtain identifier forpublic UpdateType getUpdateType(DummyRecord record)
SerDe
getUpdateType
in interface SerDe<DummyRecord>
record
- to retrieve update type forpublic DummyRecord deserializeEdit(java.io.DataInputStream in, java.util.Map<java.lang.Object,DummyRecord> currentVersion, int version) throws java.io.IOException
SerDe
Reads an Edit Record from the given DataInputStream
and merges
that edit with the current version of the record, returning the new,
merged version. If the Edit Record indicates that the entity was deleted,
must return a Record with an UpdateType of UpdateType.DELETE
.
This method must never return null
.
deserializeEdit
in interface SerDe<DummyRecord>
in
- to deserialize fromcurrentVersion
- an unmodifiable map of Record ID's to the
current state of that recordversion
- the version of the SerDe that was used to serialize the
edit recordjava.io.IOException
- if failure readingpublic int getVersion()
SerDe
getVersion
in interface SerDe<DummyRecord>
public void setThrowIOEAfterNSerializeEdits(int n)
public void setThrowOOMEAfterNSerializeEdits(int n)
public java.lang.String getLocation(DummyRecord record)
SerDe
UpdateType.SWAP_OUT
that indicates a Location of
file://tmp/external1 and can then be re-introduced to WALI by updating
WALI with a record of type UpdateType.CREATE
that indicates a
Location of file://tmp/external1getLocation
in interface SerDe<DummyRecord>
record
- to get location of