interface IDatastore (Niantic.Experimental.ARDK.SharedAR.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. More…

interface IDatastore: IDisposable {
    // events

    event KeyValueAdded();
    event KeyValueDeleted();
    event KeyValueUpdated();

    // methods

    Result ClaimOwnership(string key);
    Result DeleteData(string key);
    Result GetData(string key, ref byte[] value);
    Result GetData< T >(string key, ref T value);
    List<string> GetKeys();
    Result SetData(string key, byte[] value);
    Result SetData< T >(string key, T value);
    Result SetLifeCycle(string key, LifeCycleOptions options);
};

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.

Note

This is an experimental feature. Experimental features should not be used in production products as they are subject to breaking changes, not officially supported, and may be deprecated without notice

Events

event KeyValueAdded()

A key was added to the datastore by a peer in the session. Use GetData to get its value

event KeyValueDeleted()

A key was deleted by a peer in the session.

event KeyValueUpdated()

A key was updated by a peer in the session. Use GetData to get its value

Methods

Result ClaimOwnership(string key)

Claim ownership of data specified by the key

Returns:

Result of the operation

Result DeleteData(string key)

Delete the key-value pair from the storage

Parameters:

key

Key of the data

Returns:

Result of the operation

Result GetData(string key, ref byte[] value)

Set data into storage

Parameters:

key

Key of the data

value

Value to set

Returns:

Result of the operation

List<string> GetKeys()

Get list of keys under specified tag

Returns:

List of keys

Result SetData(string key, byte[] value)

Set data into storage

Parameters:

key

Key of the data

value

Value to set

Returns:

Result of the operation

Result SetLifeCycle(string key, LifeCycleOptions options)

Set lifecycle of the data specified by the key

Returns:

Result of the operation