ostore.apps.test
Class TapestryHowto.Ping
java.lang.Object
|
+--ostore.tapestry.api.TapestryRouteMsg
|
+--ostore.apps.test.TapestryHowto.Ping
- All Implemented Interfaces:
- QueueElementIF, QuickSerializable
- Enclosing class:
- TapestryHowto
- public static class TapestryHowto.Ping
- extends TapestryRouteMsg
- implements QuickSerializable
One of two Tapestry messages used in this test. I inherit from
TapestryRouteMsg because I'm talking to a specific other node in
OceanStore. If I wanted to talk to any node holding an object with
GUID g, I would use a TapestryLocateMsg instead. Other interesting
Tapestry message types are:
- TapestryMacRouteMsg -- cryptographically guarentees that the
message is from the node it says it's from
- TapestryPrefixRouteMsg -- routes to the node with the GUID which
most closely matches a given GUID; used by the OceanStore
archive to find storage candidates for erasure coded fragments
- TapestryPublishMsg -- advertise that your own node is storing a
given object
- TapestryUnpublishMsg -- stop advertising an object
Refer to the Tapestry javadocs for more details about any of the
above.
Since this class inherits from TapestryRouteMsg, it indirectly
inherits from QuickSerializable and QuickSerializable, meaning that we have
to define three main functions:
- A serialization function, to_bytes, which takes a byte array and
an offset and returns the resulting offset (number of bytes
written plus the original offset)
- A deserialization constructor, which takes a byte array and an
offset and returns the resulting offset (number of bytes read
plus the original offset)
- A digest function, add_to_digest, which works like the
serialization function, but rather than writing everything into
a new array, just passes it on to a digest object. This is used
to compute the hash of messages for use inside Tapestry.
- Finally, there is a legacy function, type_code, which must be
defined but need not be implemented.
See below for details.
seq
public int seq
TapestryHowto.Ping
public TapestryHowto.Ping(SecureHash dest,
int seq)
- A constructor for messages I'm going to send to someone else.
Sets the destination node and sequence number.
TapestryHowto.Ping
public TapestryHowto.Ping(InputBuffer buffer)
- A deserialization constructor. Used by Tapestry on the
receiving node to reproduce the message from its "on-the-wire"
representation.
serialize
public void serialize(OutputBuffer buffer)
- A serialization function. Produces the "on-the-wire"
representation of this object. Must be the inverse of the
deserialization constructor, above, or bad things will happen.
- Specified by:
serialize
in interface QuickSerializable
- Overrides:
serialize
in class TapestryRouteMsg
- Following copied from interface:
ostore.util.QuickSerializable
- Parameters:
buffer
- the output buffer to add the object to
toString
public String toString()
- It's always nice for debugging to define one of these.
- Overrides:
toString
in class Object