The DataStore API methods.
More...
|
static void | Set (string key, string value, bool global, Action< bool > callback=null) |
| Save the key/value pair in the DataStore. Caution: GameJolt refuses requests with a payload of more than 1MB. The payload is composed of the key, the value and 10 bytes of meta data. Use SetSegmented for data larger than 1MB. More...
|
|
static void | SetSegmented (string key, string value, bool global, Action< bool > callback, Action< int > progress=null, int maxSegmentSize=SoftLimit) |
| Caution: Non atomic operation! Save the key/value pair in the DataStore. This method will split the payload into multiple smaller packages, in order to overcome GameJolts 1MB limit. These packages will be appended via the update operation. If one or more parts are already uploaded and then an error occurs (for e.g. no network connection), this method will stop uploading further packages. If this happens the DataStore might contain incomplete data, therefore you might want to delete the entry or try uploading again. By using the progress callback, you could also try to continue from the last position. More...
|
|
static void | Update (string key, string value, DataStoreOperation operation, bool global, Action< string > callback=null) |
| Update the value for a given key in the DataStore. More...
|
|
static void | Get (string key, bool global, Action< string > callback) |
| Get the value for a given key from the DataStore. More...
|
|
static void | Delete (string key, bool global, Action< bool > callback=null) |
| Delete the key from the DataStore. More...
|
|
static void | GetKeys (bool global, Action< string[]> callback) |
| Gets the list of available keys in the DataStore. More...
|
|
static void | GetKeys (bool global, string pattern, Action< string[]> callback) |
| Gets the list of available keys in the DataStore. More...
|
|
The DataStore API methods.
◆ Delete()
static void GameJolt.API.DataStore.Delete |
( |
string |
key, |
|
|
bool |
global, |
|
|
Action< bool > |
callback = null |
|
) |
| |
|
inlinestatic |
Delete the key from the DataStore.
- Parameters
-
key | The key name. |
global | A boolean indicating whether the key is global (true ) or private to the user (false ). |
callback | A callback function accepting a single parameter, a boolean indicating success. |
◆ Get()
static void GameJolt.API.DataStore.Get |
( |
string |
key, |
|
|
bool |
global, |
|
|
Action< string > |
callback |
|
) |
| |
|
inlinestatic |
Get the value for a given key from the DataStore.
- Parameters
-
key | The key name. |
global | A boolean indicating whether the key is global (true ) or private to the user (false ). |
callback | A callback function accepting a single parameter, the key value. |
◆ GetKeys() [1/2]
static void GameJolt.API.DataStore.GetKeys |
( |
bool |
global, |
|
|
Action< string[]> |
callback |
|
) |
| |
|
inlinestatic |
Gets the list of available keys in the DataStore.
- Parameters
-
global | A boolean indicating whether the keys are global (true ) or private to the user (false ). |
callback | A callback function accepting a single parameter, a list of key names. |
◆ GetKeys() [2/2]
static void GameJolt.API.DataStore.GetKeys |
( |
bool |
global, |
|
|
string |
pattern, |
|
|
Action< string[]> |
callback |
|
) |
| |
|
inlinestatic |
Gets the list of available keys in the DataStore.
- Parameters
-
global | A boolean indicating whether the keys are global (true ) or private to the user (false ). |
pattern | Only keys matching this pattern will be returned. Placeholder character is * |
callback | A callback function accepting a single parameter, a list of key names. |
◆ Set()
static void GameJolt.API.DataStore.Set |
( |
string |
key, |
|
|
string |
value, |
|
|
bool |
global, |
|
|
Action< bool > |
callback = null |
|
) |
| |
|
inlinestatic |
Save the key/value pair in the DataStore. Caution: GameJolt refuses requests with a payload of more than 1MB. The payload is composed of the key, the value and 10 bytes of meta data. Use SetSegmented for data larger than 1MB.
- Parameters
-
key | The key name. |
value | The value to store. |
global | A boolean indicating whether the key is global (true ) or private to the user (false ). |
callback | A callback function accepting a single parameter, a boolean indicating success. |
◆ SetSegmented()
static void GameJolt.API.DataStore.SetSegmented |
( |
string |
key, |
|
|
string |
value, |
|
|
bool |
global, |
|
|
Action< bool > |
callback, |
|
|
Action< int > |
progress = null , |
|
|
int |
maxSegmentSize = SoftLimit |
|
) |
| |
|
inlinestatic |
Caution: Non atomic operation! Save the key/value pair in the DataStore. This method will split the payload into multiple smaller packages, in order to overcome GameJolts 1MB limit. These packages will be appended via the update operation. If one or more parts are already uploaded and then an error occurs (for e.g. no network connection), this method will stop uploading further packages. If this happens the DataStore might contain incomplete data, therefore you might want to delete the entry or try uploading again. By using the progress callback, you could also try to continue from the last position.
- Parameters
-
key | The key name. |
value | The value to store. |
global | A boolean indicating whether the key is global (true ) or private to the user (false ). |
callback | A callback function accepting a single parameter, a boolean indicating success. |
progress | A callback function accepting a single parameter, the number of already uploaded bytes. This callback is called after each successfull segment upload. |
maxSegmentSize | Maximum segment size. The data to upload is split into segments of at most this size. |
◆ Update()
static void GameJolt.API.DataStore.Update |
( |
string |
key, |
|
|
string |
value, |
|
|
DataStoreOperation |
operation, |
|
|
bool |
global, |
|
|
Action< string > |
callback = null |
|
) |
| |
|
inlinestatic |
Update the value for a given key in the DataStore.
- Parameters
-
key | The key name. |
value | The new value to operate with. |
operation | The DataStoreOperation to perform. |
global | A boolean indicating whether the key is global (true ) or private to the user (false ). |
callback | A callback function accepting a single parameter, a the updated key value. |
◆ HardLimit
const int GameJolt.API.DataStore.HardLimit = 16777000 |
GameJolt allows only about 16MB per key-value pair.
◆ KeySizeLimit
const int GameJolt.API.DataStore.KeySizeLimit = SoftLimit - 1024 |
Maximum size for dataset key.
◆ SoftLimit
const int GameJolt.API.DataStore.SoftLimit = 1024 * 1024 - 11 |
GameJolt refuses requests larger than this. In order for an operation to succeed the encoded key length + encoded value length must not be larger than this.
The documentation for this class was generated from the following file:
- D:/Dev/Unity/AssetStore/GameJoltAPI/Assets/Plugins/GameJolt/Scripts/API/DataStore.cs