Interface IProvidesCloudStorage
Defines the API for a Cloud Data Storage Provider This functionality provider is responsible for providing key/value cloud storage
Namespace: Unity.MARS.Companion.CloudStorage
Syntax
public interface IProvidesCloudStorage : IFunctionalityProvider
Methods
CancelAllRequests()
Cancel all currently active requests
Declaration
void CancelAllRequests()
CancelRequest(RequestHandle)
Cancel a request with the given request handle
Declaration
void CancelRequest(RequestHandle handle)
Parameters
Type | Name | Description |
---|---|---|
RequestHandle | handle | The handle to the request, which was returned by the method which initiated it |
CloudLoadAsync(String, Action<Boolean, Int64, Byte[]>, ProgressCallback, Int32)
Load from the cloud asynchronously the byte array which was saved with a known key
Declaration
RequestHandle CloudLoadAsync(string key, Action<bool, long, byte[]> callback, ProgressCallback progress = null, int timeout = null)
Parameters
Type | Name | Description |
---|---|---|
String | key | String that uniquely identifies this instance of the type |
Action<Boolean, Int64, Byte[]> | callback | A callback which returns whether the operation was successful, as well as the response code and byte array if it was. If the operation failed, the byte array will contain the error string |
ProgressCallback | progress | Called every frame while the request is in progress with two 0-1 values indicating upload and download progress, respectively |
Int32 | timeout | The timeout duration (in seconds) for this request |
Returns
Type | Description |
---|---|
RequestHandle | A handle to the request which can be used to cancel it |
CloudLoadAsync(String, Action<Boolean, Int64, String>, ProgressCallback, Int32)
Load from the cloud asynchronously the data of an object which was saved with a known key
Declaration
RequestHandle CloudLoadAsync(string key, Action<bool, long, string> callback, ProgressCallback progress = null, int timeout = null)
Parameters
Type | Name | Description |
---|---|---|
String | key | String that uniquely identifies this instance of the type. |
Action<Boolean, Int64, String> | callback | A callback which returns whether the operation was successful, as well as the response code and serialized string of the object if it was |
ProgressCallback | progress | Called every frame while the request is in progress with two 0-1 values indicating upload and download progress, respectively |
Int32 | timeout | The timeout duration (in seconds) for this request |
Returns
Type | Description |
---|---|
RequestHandle | A handle to the request which can be used to cancel it |
CloudLoadTextureAsync(String, LoadTextureCallback, ProgressCallback, Int32)
Load a texture asynchronously from cloud storage
Declaration
RequestHandle CloudLoadTextureAsync(string key, LoadTextureCallback callback, ProgressCallback progress = null, int timeout = null)
Parameters
Type | Name | Description |
---|---|---|
String | key | String that uniquely identifies this instance of the type. |
LoadTextureCallback | callback | A callback which returns whether the operation was successful, as well as the response payload if it was. If the operation failed, the byte array will contain the error string |
ProgressCallback | progress | Called every frame while the request is in progress with two 0-1 values indicating upload and download progress, respectively |
Int32 | timeout | The timeout duration (in seconds) for this request |
Returns
Type | Description |
---|---|
RequestHandle | A handle to the request which can be used to cancel it |
CloudSaveAsync(String, Byte[], Action<Boolean, Int64, String>, ProgressCallback, Int32)
Save to the cloud asynchronously data in a byte array with a specified key
Declaration
RequestHandle CloudSaveAsync(string key, byte[] bytes, Action<bool, long, string> callback = null, ProgressCallback progress = null, int timeout = null)
Parameters
Type | Name | Description |
---|---|---|
String | key | String that uniquely identifies this instance of the type. |
Byte[] | bytes | Bytes array of the object being saved |
Action<Boolean, Int64, String> | callback | A callback when the asynchronous call is done to show whether it was successful, with the response code and string |
ProgressCallback | progress | Called every frame while the request is in progress with two 0-1 values indicating upload and download progress, respectively |
Int32 | timeout | The timeout duration (in seconds) for this request |
Returns
Type | Description |
---|---|
RequestHandle | A handle to the request which can be used to cancel it |
CloudSaveAsync(String, String, Action<Boolean, Int64, String>, ProgressCallback, Int32)
Save to the cloud asynchronously the data of an object of a certain type with a specified key
Declaration
RequestHandle CloudSaveAsync(string key, string serializedObject, Action<bool, long, string> callback = null, ProgressCallback progress = null, int timeout = null)
Parameters
Type | Name | Description |
---|---|---|
String | key | String that uniquely identifies this instance of the type. |
String | serializedObject | String serialization of the object being saved. |
Action<Boolean, Int64, String> | callback | A callback when the asynchronous call is done to show whether it was successful, with the response code and string |
ProgressCallback | progress | Called every frame while the request is in progress with two 0-1 values indicating upload and download progress, respectively |
Int32 | timeout | The timeout duration (in seconds) for this request |
Returns
Type | Description |
---|---|
RequestHandle | A handle to the request which can be used to cancel it |
GetProjectIdentifier()
Get the current project identifier
Declaration
string GetProjectIdentifier()
Returns
Type | Description |
---|---|
String | The current project identifier |
LoadLocalTextureAsync(String, LoadTextureCallback, ProgressCallback, Int32)
Load a texture asynchronously from local storage
Declaration
RequestHandle LoadLocalTextureAsync(string path, LoadTextureCallback callback, ProgressCallback progress = null, int timeout = null)
Parameters
Type | Name | Description |
---|---|---|
String | path | Path to the texture. |
LoadTextureCallback | callback | A callback which returns whether the operation was successful, as well as the response payload if it was. If the operation failed, the byte array will contain the error string |
ProgressCallback | progress | Called every frame while the request is in progress with two 0-1 values indicating upload and download progress, respectively |
Int32 | timeout | The timeout duration (in seconds) for this request |
Returns
Type | Description |
---|---|
RequestHandle | A handle to the request which can be used to cancel it |
SetProjectIdentifier(String)
Set the current project identifier
Declaration
void SetProjectIdentifier(string id)
Parameters
Type | Name | Description |
---|---|---|
String | id | The project identifier to set |