The OceanStore Project
OceanStore HelloWorld HOWTO by Hakim Weatherspoon, Chiu Wah Kelvin So, and Jason Lee |
A client sends a message to more than one unique server. Then servers print out the messages, "Hello! How are you" and send a response "Great! The weather is wonderful today!" The client prints out the response. After all the responses have been received, client exits.
HelloWorldServer
s publish DDPublishReqHelloWorldClient
locates and sends msg to 3 different HelloWorldServer
by sending a HelloWorldLocateMsg
. HelloWorldServer
s which have received a HelloWorldLocateMsg
prints out the message and send back a response to HelloWorldClient
using HelloWorldRouteMsg
.HelloWorldClient
listens for HelloWorldRouteMsg
and prints out the message. After receving HelloWorldRouteMsg
from 3 different HelloWorldServer, HelloWorldClient exits.
HelloWorldServer
, you will need to understand how do DDLocateMsg, DDQuery, and DDQueryState work.
DDLocateMsg
is sent to root of GUID. On the way to the root, there can be intermediate nodes that DDLocateMsg
goes through. At each of the intermediate nodes, Router will run the DDLocateMsg's query on all the pointer(included GUID and the tag) if GUID of the pointers matches the DDLocateMsg's GUID. If DDQueryResultMatch is returned by the query and DDLocateMsg's forward is true, then the DDLocateMsg will get forward to the GUID object. If DDQueryResultMatch is returned and DDLocateMsg's forward is false, then the DDLocateMsg will not forward to the GUID object. If DDQueryResultNoMatch, then the DDLocateMsg will not forward to the GUID object. In DDQueryResultMatch, there is an option to stop the DDLocateMsg or not before getting to the root. HelloWorldQueryState
just need to maintain a set of servers GUID that has been queried. If the size of the set = 3, then query will return DDQueryResultMatch with stop = true. and the DDLocateMsg will be stopped. More detail in the next section.HelloWorldQueryState
HelloWorldQuery
HelloWorldQueryState
HelloWorldQueryState
implements DDQueryState.HelloWorldQuery
bp_guid
in the query method is the pointer to one of the serversHelloWorldQueryState
HelloWorldQueryState
before, return DDQueryResultMatch(m, helloWorldQueryState.size() == helloWorldQueryState.numberOfRequestServers())
HelloWorldClient
HelloWorldLocateMsg
, include HelloWorldQueryState
, instead of null in step1, as one of the input for instantiating HelloWorldLocateMsg
. HelloWorldRouteMsg
from 3 different serversHelloWorldServers0
- HelloWorldServers9
Click here to go to HelloWorld Exercise step3.