RakNet::CloudClient Class Reference
[CloudComputing]

Performs Post() and Get() operations on CloudMemoryServer. More...

#include <CloudClient.h>

Inheritance diagram for RakNet::CloudClient:

RakNet::PluginInterface2

List of all members.

Public Member Functions

virtual void SetDefaultCallbacks (CloudAllocator *_allocator, CloudClientCallback *_callback)
 Set the default callbacks for OnGetReponse(), OnSubscriptionNotification(), and OnSubscriptionDataDeleted().
virtual void Post (CloudKey *cloudKey, const unsigned char *data, uint32_t dataLengthBytes, RakNetGUID systemIdentifier)
 Uploads data to the cloud.
virtual void Release (DataStructures::List< CloudKey > &keys, RakNetGUID systemIdentifier)
 Releases one or more data previously uploaded with Post().
virtual bool Get (CloudQuery *cloudQuery, RakNetGUID systemIdentifier)
 Gets data from the cloud.
virtual void Unsubscribe (DataStructures::List< CloudKey > &keys, RakNetGUID systemIdentifier)
 Unsubscribe from updates previously subscribed to using Get() with the CloudQuery::subscribeToResults set to true The keys and specificSystems parameters are logically treated as AND when checking subscriptions on the server The overload that does not take specificSystems unsubscribes to all passed keys, regardless of system You cannot unsubscribe specific systems when previously subscribed to updates from any system. To do this, first Unsubscribe() from all systems, and call Get() with the specificSystems parameter explicilty listing the systems you want to subscribe to.
virtual void OnGetReponse (Packet *packet, CloudClientCallback *_callback=0, CloudAllocator *_allocator=0)
 Call this when you get ID_CLOUD_GET_RESPONSE If callback or allocator are 0, the default callbacks passed to SetDefaultCallbacks() are used.
virtual void OnGetReponse (CloudQueryResult *cloudQueryResult, Packet *packet, CloudAllocator *_allocator=0)
 Call this when you get ID_CLOUD_GET_RESPONSE Different form of OnGetReponse that returns to a structure that you pass, instead of using a callback You are responsible for deallocation with this form If allocator is 0, the default callback passed to SetDefaultCallbacks() are used.
virtual void OnSubscriptionNotification (Packet *packet, CloudClientCallback *_callback=0, CloudAllocator *_allocator=0)
 Call this when you get ID_CLOUD_SUBSCRIPTION_NOTIFICATION If callback or allocator are 0, the default callbacks passed to SetDefaultCallbacks() are used.
virtual void OnSubscriptionNotification (bool *wasUpdated, CloudQueryRow *row, Packet *packet, CloudAllocator *_allocator=0)
 Call this when you get ID_CLOUD_SUBSCRIPTION_NOTIFICATION Different form of OnSubscriptionNotification that returns to a structure that you pass, instead of using a callback You are responsible for deallocation with this form If allocator is 0, the default callback passed to SetDefaultCallbacks() are used.
virtual void DeallocateWithDefaultAllocator (CloudQueryResult *cloudQueryResult)
 If you never specified an allocator, and used the non-callback form of OnGetReponse(), deallocate cloudQueryResult with this function.
virtual void DeallocateWithDefaultAllocator (CloudQueryRow *row)
 If you never specified an allocator, and used the non-callback form of OnSubscriptionNotification(), deallocate row with this function.

Protected Member Functions

PluginReceiveResult OnReceive (Packet *packet)


Detailed Description

Performs Post() and Get() operations on CloudMemoryServer.

A CloudClient is a computer connected to one or more servers in a cloud configuration. Operations by one CloudClient can be received and subscribed to by other instances of CloudClient, without those clients being connected, even on different servers.


Member Function Documentation

virtual bool RakNet::CloudClient::Get ( CloudQuery cloudQuery,
RakNetGUID  systemIdentifier 
) [virtual]

Gets data from the cloud.

For a given query containing one or more keys, return data that matches those keys. The values will be returned in the ID_CLOUD_GET_RESPONSE packet, which should be passed to OnGetReponse() and will invoke CloudClientCallback::OnGet() CloudQuery::startingRowIndex is used to skip the first n values that would normally be returned.. CloudQuery::maxRowsToReturn is used to limit the number of rows returned. The number of rows returned may also be limited by CloudServer::SetMaxBytesPerDownload(); CloudQuery::subscribeToResults if set to true, will cause ID_CLOUD_SUBSCRIPTION_NOTIFICATION to be returned to us when any of the keys in the query are updated or are deleted. ID_CLOUD_GET_RESPONSE will be returned even if subscribing to the result list. Only later updates will return ID_CLOUD_SUBSCRIPTION_NOTIFICATION. Calling Get() with CloudQuery::subscribeToResults false, when you are already subscribed, does not remove the subscription. Use Unsubscribe() for this. Resubscribing using the same CloudKey but a different or no specificSystems overwrites the subscribed systems for those keys.

Parameters:
[in] cloudQuery One or more keys, and optional parameters to perform with the Get
[in] systemIdentifier A remote system running CloudServer that we are already connected to.
[in] specificSystems It is possible to get or subscribe to updates only for specific uploading CloudClient instances. Pass the desired instances here. The overload that does not have the specificSystems parameter is treated as subscribing to all updates from all clients.

virtual void RakNet::CloudClient::OnGetReponse ( CloudQueryResult *  cloudQueryResult,
Packet packet,
CloudAllocator _allocator = 0 
) [virtual]

Call this when you get ID_CLOUD_GET_RESPONSE Different form of OnGetReponse that returns to a structure that you pass, instead of using a callback You are responsible for deallocation with this form If allocator is 0, the default callback passed to SetDefaultCallbacks() are used.

Parameters:
[out] cloudQueryResult A pointer to a structure that will be filled out with data
[in] packet Packet structure returned from RakPeerInterface
[in] _allocator Allocator to be used to allocate data. If 0, default is used.

virtual void RakNet::CloudClient::OnGetReponse ( Packet packet,
CloudClientCallback _callback = 0,
CloudAllocator _allocator = 0 
) [virtual]

Call this when you get ID_CLOUD_GET_RESPONSE If callback or allocator are 0, the default callbacks passed to SetDefaultCallbacks() are used.

Parameters:
[in] packet Packet structure returned from RakPeerInterface
[in] _callback Callback to be called from the function containing output parameters. If 0, default is used.
[in] _allocator Allocator to be used to allocate data. If 0, default is used.

PluginReceiveResult RakNet::CloudClient::OnReceive ( Packet packet  )  [protected, virtual]

OnReceive is called for every packet.

Parameters:
[in] packet the packet that is being returned to the user
Returns:
True to allow the game and other plugins to get this message, false to absorb it

Reimplemented from RakNet::PluginInterface2.

virtual void RakNet::CloudClient::OnSubscriptionNotification ( bool *  wasUpdated,
CloudQueryRow *  row,
Packet packet,
CloudAllocator _allocator = 0 
) [virtual]

Call this when you get ID_CLOUD_SUBSCRIPTION_NOTIFICATION Different form of OnSubscriptionNotification that returns to a structure that you pass, instead of using a callback You are responsible for deallocation with this form If allocator is 0, the default callback passed to SetDefaultCallbacks() are used.

Parameters:
[out] wasUpdated If true, the row was updated. If false, it was deleted. result will contain the last value just before deletion
[out] row A pointer to a structure that will be filled out with data
[in] packet Packet structure returned from RakPeerInterface
[in] _allocator Allocator to be used to allocate data. If 0, default is used.

virtual void RakNet::CloudClient::OnSubscriptionNotification ( Packet packet,
CloudClientCallback _callback = 0,
CloudAllocator _allocator = 0 
) [virtual]

Call this when you get ID_CLOUD_SUBSCRIPTION_NOTIFICATION If callback or allocator are 0, the default callbacks passed to SetDefaultCallbacks() are used.

Parameters:
[in] packet Packet structure returned from RakPeerInterface
[in] _callback Callback to be called from the function containing output parameters. If 0, default is used.
[in] _allocator Allocator to be used to allocate data. If 0, default is used.

virtual void RakNet::CloudClient::Post ( CloudKey cloudKey,
const unsigned char *  data,
uint32_t  dataLengthBytes,
RakNetGUID  systemIdentifier 
) [virtual]

Uploads data to the cloud.

Data uploaded to the cloud will be stored by the server sent to, identified by systemIdentifier. As long as you are connected to this server, the data will persist. Queries for that data by the Get() operation will return the RakNetGUID and SystemAddress of the uploader, as well as the data itself. Furthermore, if any clients are subscribed to the particular CloudKey passed, those clients will get update notices that the data has changed Passing data with the same cloudKey more than once will overwrite the prior value. This call will silently fail if CloudServer::SetMaxUploadBytesPerClient() is exceeded

Parameters:
[in] cloudKey Identifies the data being uploaded
[in] data A pointer to data to upload. This pointer does not need to persist past the call
[in] dataLengthBytes The length in bytes of data
[in] systemIdentifier A remote system running CloudServer that we are already connected to.

virtual void RakNet::CloudClient::Release ( DataStructures::List< CloudKey > &  keys,
RakNetGUID  systemIdentifier 
) [virtual]

Releases one or more data previously uploaded with Post().

If a remote system has subscribed to one or more of the keys uploaded, they will get ID_CLOUD_SUBSCRIPTION_NOTIFICATION notifications containing the last value uploaded before deletions

Parameters:
[in] cloudKey Identifies the data to release. It is possible to remove uploads from multiple Post() calls at once.
[in] systemIdentifier A remote system running CloudServer that we are already connected to.

virtual void RakNet::CloudClient::SetDefaultCallbacks ( CloudAllocator _allocator,
CloudClientCallback _callback 
) [virtual]

Set the default callbacks for OnGetReponse(), OnSubscriptionNotification(), and OnSubscriptionDataDeleted().

Pointers to CloudAllocator and CloudClientCallback can be stored by the system if desired. If a callback is not provided to OnGetReponse(), OnSubscriptionNotification(), OnSubscriptionDataDeleted(), the callback passed here will be used instead.

Parameters:
[in] _allocator An instance of CloudAllocator
[in] _callback An instance of CloudClientCallback


The documentation for this class was generated from the following file:

Generated on Wed Feb 1 13:33:47 2012 for RakNet by  doxygen 1.5.7.1