Skip to main content

interface IDatastore

(Niantic.Lightship.SharedAR.Datastore.IDatastore)

Overview

Server-backed data storage that is associated with sessions or rooms. Peers can set, update, and delete Key/Value pairs, and have the server notify all other peers in the session when updates occur.

    interface IDatastore: IDisposable {
// events

event DatastoreCallback();

// methods

void SetData(UInt32 requestId, string key, byte[] value);
void GetData(UInt32 requestId, string key);
void DeleteData(UInt32 requestId, string key);
};

Detailed Documentation

Server-backed data storage that is associated with sessions or rooms. Peers can set, update, and delete Key/Value pairs, and have the server notify all other peers in the session when updates occur.

Events

DatastoreCallback

event DatastoreCallback()

Callback to listen to server response or changes This is called either when receiving a response from the own request, or data changed on server side

Methods

SetData

void SetData(UInt32 requestId, string key, byte[] value)

Set/Add data into the server storage asynchronously

    Parameters:

    requestId - ID to distinguish to identify th originated request in callback

    key - Key of the data

    value - Value to set

GetData

void GetData(UInt32 requestId, string key)

Get data from the server storage asynchronously

    Parameters:

    requestId - ID to distinguish to identify th originated request in callback

    key - Key of the data

DeleteData

void DeleteData(UInt32 requestId, string key)

Delete the key-value pair from the server storage asynchronously

    Parameters:

    requestId - ID to distinguish to identify th originated request in callback

    key - Key of the data to delete