RakNet
4.0
|
Performs Post() and Get() operations on CloudMemoryServer. More...
#include <CloudClient.h>
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. | |
![]() | |
virtual void | OnAttach (void) |
Called when the interface is attached. | |
virtual void | OnDetach (void) |
Called when the interface is detached. | |
virtual void | Update (void) |
Update is called every time a packet is checked for . | |
virtual void | OnRakPeerStartup (void) |
Called when RakPeer is initialized. | |
virtual void | OnRakPeerShutdown (void) |
Called when RakPeer is shutdown. | |
virtual void | OnClosedConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason) |
virtual void | OnNewConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming) |
virtual void | OnFailedConnectionAttempt (Packet *packet, PI2_FailedConnectionAttemptReason failedConnectionAttemptReason) |
virtual bool | UsesReliabilityLayer (void) const |
virtual void | OnDirectSocketSend (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress) |
virtual void | OnDirectSocketReceive (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress) |
virtual void | OnReliabilityLayerNotification (const char *errorMessage, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress, bool isError) |
virtual void | OnInternalPacket (InternalPacket *internalPacket, unsigned frameNumber, SystemAddress remoteSystemAddress, RakNet::TimeMS time, int isSend) |
virtual void | OnAck (unsigned int messageNumber, SystemAddress remoteSystemAddress, RakNet::TimeMS time) |
virtual void | OnPushBackPacket (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress) |
Protected Member Functions | |
PluginReceiveResult | OnReceive (Packet *packet) |
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.
|
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.
[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 |
Call this when you get ID_CLOUD_GET_RESPONSE If callback or allocator are 0, the default callbacks passed to SetDefaultCallbacks() are used.
[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 |
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.
[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. |
|
protectedvirtual |
OnReceive is called for every packet.
[in] | packet | the packet that is being returned to the user |
Reimplemented from RakNet::PluginInterface2.
|
virtual |
Call this when you get ID_CLOUD_SUBSCRIPTION_NOTIFICATION If callback or allocator are 0, the default callbacks passed to SetDefaultCallbacks() are used.
[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 |
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.
[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 |
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
[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 |
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
[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 |
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.
[in] | _allocator | An instance of CloudAllocator |
[in] | _callback | An instance of CloudClientCallback |