provider/ydb

Classes

YdbClient

Members

static, constant _broadcastYdbCUConfConfirmed

Call this when user confid was confirmed by host

static, constant _broadcastYdbCUConfCreated

Call this when update was created by this user and confid was created

static, constant _broadcastYdbRemoteOffsetConfirmed

static, constant _broadcastYdbRemoteOffsetReceived

Call this when remote update is received (thus host has increased, but not confirmed, the offset)

static, constant _broadcastYdbSyncFromServer

Call this when sync confirmed by host

static, constant _broadcastYdbSyncingRoomsToServer

Call this when a subscription is created

static, constant clear

Remove a db namespace. Call this to remove any persisted data. Make sure to close active sessions. TODO: destroy active ydbClient sessions / throw if a session is still active

static, constant confirmClient

The host confirms that it received and persisted an update. The update can be safely removed from CU. It is necessary to call this function in case that the client disconnected before the host could send writeHostUnconfirmedByClient.

static, constant confirmSubscription

Set the initial room data. Overwrites initial data if there is any!

static, constant createSub

static, constant createTransaction

Create a new IDBTransaction accessing all object stores. Normally we should care that we can access object stores in parallel. But this is not possible in ydb-client since at least two object stores are requested in every IDB change.

static, constant createUpdate

static, constant createYdbClient

static, constant get

Factory function. Get a ydb instance that connects to url, and uses dbNamespace as indexeddb namespace. Create if it does not exist yet.

static, constant getRoomData

Get all data from idb, including unconfirmed updates. TODO: include updates in CU

static, constant getRoomDataWithoutCU

Get all data from idb, excluding unconfirmed updates. TODO: include updates in CU

static, constant getRoomMetas

Get all meta information for all rooms.

static, constant getUnconfirmedUpdates

Get all updates that are not yet confirmed by host.

static, constant openDB

static, constant publishAll

Publish to all, including self

static, constant publishRoomData

static, constant readMessage

static, constant send

static, constant subscribeRoomData

static, constant update

static, constant writeClientUnconfirmed

Write an update to the db after the client created it. This update is not yet received by the host. This function returns a client confirmation number. The confirmation number must be send to the host so it can identify the update, and we can move the update to HU when it is confirmed (@see writeHostUnconfirmedByClient)

static, constant writeConfirmedByHost

The host confirms that it persisted updates up until (including) offset. updates may be moved from HU to Co.

static, constant writeHostUnconfirmed

The host broadcasts an update created by another client. It assures that the update will eventually be persisted with offset. Calling this function does not imply that the update was persisted by the host. In case of mismatching room session ids the updates in HU will be sent to the server.

static, constant writeHostUnconfirmedByClient

The host confirms that it received and broadcasted an update sent from this client. Calling this method does not confirm that the update has been persisted by the server.

Other clients will receive an update with writeHostUnconfirmed. Since this client created the update, it only receives a confirmation. So we can simply move the update from CU to HU.

inner, constant datasubs :Map.<string, Set.<function()>>

inner, constant ydbinstances :Set.<any>

Set of Ydb instances

Methods

inner checkTestClients(…testClients)

Check if tsclient has all data in dataset

Parameters:
Name Type Attributes Description
testClients YdbTestClient <repeatable>

inner decodeHUKey(key) → {RoomAndOffset}

Parameters:
Name Type Description
key HUTableKey
Returns:
RoomAndOffset

inner encodeHUKey(room, offset) → {HUTableKey}

Parameters:
Name Type Description
room string
offset number
Returns:
HUTableKey

inner encodeMetaValue(rsid, offset) → {ArrayBuffer}

Parameters:
Name Type Description
rsid number

room session id

offset number
Returns:
ArrayBuffer

inner getStoreCo(t) → {IDBObjectStore}

Get 'confirmed' store from transaction

Parameters:
Name Type Description
t IDBTransaction
Returns:
IDBObjectStore

inner getStoreCU(t) → {IDBObjectStore}

Get 'client-unconfirmed' store from transaction

Parameters:
Name Type Description
t IDBTransaction
Returns:
IDBObjectStore

inner getStoreHU(t) → {IDBObjectStore}

Get 'host-unconfirmed' store from transaction

Parameters:
Name Type Description
t IDBTransaction
Returns:
IDBObjectStore

inner getStoreUS(t) → {IDBObjectStore}

Get unconfirmed-subscriptions store from transaction

Parameters:
Name Type Description
t IDBTransaction
Returns:
IDBObjectStore

async, inner getTestClient(name) → {Promise.<YdbTestClient>}

Parameters:
Name Type Description
name string
Returns:
Promise.<YdbTestClient>

inner initWS(ydb, ws)

Initialize WebSocket connection. Try to reconnect on error/disconnect.

Parameters:
Name Type Description
ydb YdbClient
ws WebSocket

inner update(client)

Create an update. We use an increasing message counter so each update is unique.

Parameters:
Name Type Description
client YdbTestClient

Type Definitions

HUTableKey

Array of length 2: [string, number]

RoomAndOffset

Properties:
Name Type Description
room string
offset number

Received offsets (including offsets that are not yet confirmed)

RoomMeta

Properties:
Name Type Description
room string
rsid number

Room session id

offset number

Received offsets (including offsets that are not yet confirmed)

RoomState

Properties:
Name Type Description
rsid number

room session id, -1 if unknown (created locally)

offset number

By server, -1 if unknown

cOffset number

current offset by client

Sub

Properties:
Name Type Description
room string

room name

rsid number

room session id

offset number

SubDef

Properties:
Name Type Description
room string
offset number
rsid number

SyncState

Properties:
Name Type Description
upsynced boolean

True if all local updates have been sent to the server and the server confirmed that it received the update

downsynced boolean

True if the current session subscribed to the room, the server confirmed the subscription, and the initial data was received

persisted boolean

True if the server confirmed that it persisted all published data

provider/ydb

Classes

YdbClient

Members

static, constant _broadcastYdbCUConfConfirmed

Call this when user confid was confirmed by host

static, constant _broadcastYdbCUConfCreated

Call this when update was created by this user and confid was created

static, constant _broadcastYdbRemoteOffsetConfirmed

static, constant _broadcastYdbRemoteOffsetReceived

Call this when remote update is received (thus host has increased, but not confirmed, the offset)

static, constant _broadcastYdbSyncFromServer

Call this when sync confirmed by host

static, constant _broadcastYdbSyncingRoomsToServer

Call this when a subscription is created

static, constant clear

Remove a db namespace. Call this to remove any persisted data. Make sure to close active sessions. TODO: destroy active ydbClient sessions / throw if a session is still active

static, constant confirmClient

The host confirms that it received and persisted an update. The update can be safely removed from CU. It is necessary to call this function in case that the client disconnected before the host could send writeHostUnconfirmedByClient.

static, constant confirmSubscription

Set the initial room data. Overwrites initial data if there is any!

static, constant createSub

static, constant createTransaction

Create a new IDBTransaction accessing all object stores. Normally we should care that we can access object stores in parallel. But this is not possible in ydb-client since at least two object stores are requested in every IDB change.

static, constant createUpdate

static, constant createYdbClient

static, constant get

Factory function. Get a ydb instance that connects to url, and uses dbNamespace as indexeddb namespace. Create if it does not exist yet.

static, constant getRoomData

Get all data from idb, including unconfirmed updates. TODO: include updates in CU

static, constant getRoomDataWithoutCU

Get all data from idb, excluding unconfirmed updates. TODO: include updates in CU

static, constant getRoomMetas

Get all meta information for all rooms.

static, constant getUnconfirmedUpdates

Get all updates that are not yet confirmed by host.

static, constant openDB

static, constant publishAll

Publish to all, including self

static, constant publishRoomData

static, constant readMessage

static, constant send

static, constant subscribeRoomData

static, constant update

static, constant writeClientUnconfirmed

Write an update to the db after the client created it. This update is not yet received by the host. This function returns a client confirmation number. The confirmation number must be send to the host so it can identify the update, and we can move the update to HU when it is confirmed (@see writeHostUnconfirmedByClient)

static, constant writeConfirmedByHost

The host confirms that it persisted updates up until (including) offset. updates may be moved from HU to Co.

static, constant writeHostUnconfirmed

The host broadcasts an update created by another client. It assures that the update will eventually be persisted with offset. Calling this function does not imply that the update was persisted by the host. In case of mismatching room session ids the updates in HU will be sent to the server.

static, constant writeHostUnconfirmedByClient

The host confirms that it received and broadcasted an update sent from this client. Calling this method does not confirm that the update has been persisted by the server.

Other clients will receive an update with writeHostUnconfirmed. Since this client created the update, it only receives a confirmation. So we can simply move the update from CU to HU.

inner, constant datasubs :Map.<string, Set.<function()>>

inner, constant ydbinstances :Set.<any>

Set of Ydb instances

Methods

inner checkTestClients(…testClients)

Check if tsclient has all data in dataset

Parameters:
Name Type Attributes Description
testClients YdbTestClient <repeatable>

inner decodeHUKey(key) → {RoomAndOffset}

Parameters:
Name Type Description
key HUTableKey
Returns:
RoomAndOffset

inner encodeHUKey(room, offset) → {HUTableKey}

Parameters:
Name Type Description
room string
offset number
Returns:
HUTableKey

inner encodeMetaValue(rsid, offset) → {ArrayBuffer}

Parameters:
Name Type Description
rsid number

room session id

offset number
Returns:
ArrayBuffer

inner getStoreCo(t) → {IDBObjectStore}

Get 'confirmed' store from transaction

Parameters:
Name Type Description
t IDBTransaction
Returns:
IDBObjectStore

inner getStoreCU(t) → {IDBObjectStore}

Get 'client-unconfirmed' store from transaction

Parameters:
Name Type Description
t IDBTransaction
Returns:
IDBObjectStore

inner getStoreHU(t) → {IDBObjectStore}

Get 'host-unconfirmed' store from transaction

Parameters:
Name Type Description
t IDBTransaction
Returns:
IDBObjectStore

inner getStoreUS(t) → {IDBObjectStore}

Get unconfirmed-subscriptions store from transaction

Parameters:
Name Type Description
t IDBTransaction
Returns:
IDBObjectStore

async, inner getTestClient(name) → {Promise.<YdbTestClient>}

Parameters:
Name Type Description
name string
Returns:
Promise.<YdbTestClient>

inner initWS(ydb, ws)

Initialize WebSocket connection. Try to reconnect on error/disconnect.

Parameters:
Name Type Description
ydb YdbClient
ws WebSocket

inner update(client)

Create an update. We use an increasing message counter so each update is unique.

Parameters:
Name Type Description
client YdbTestClient

Type Definitions

HUTableKey

Array of length 2: [string, number]

RoomAndOffset

Properties:
Name Type Description
room string
offset number

Received offsets (including offsets that are not yet confirmed)

RoomMeta

Properties:
Name Type Description
room string
rsid number

Room session id

offset number

Received offsets (including offsets that are not yet confirmed)

RoomState

Properties:
Name Type Description
rsid number

room session id, -1 if unknown (created locally)

offset number

By server, -1 if unknown

cOffset number

current offset by client

Sub

Properties:
Name Type Description
room string

room name

rsid number

room session id

offset number

SubDef

Properties:
Name Type Description
room string
offset number
rsid number

SyncState

Properties:
Name Type Description
upsynced boolean

True if all local updates have been sent to the server and the server confirmed that it received the update

downsynced boolean

True if the current session subscribed to the room, the server confirmed the subscription, and the initial data was received

persisted boolean

True if the server confirmed that it persisted all published data

provider/ydb

Classes

YdbClient

Members

static, constant _broadcastYdbCUConfConfirmed

Call this when user confid was confirmed by host

static, constant _broadcastYdbCUConfCreated

Call this when update was created by this user and confid was created

static, constant _broadcastYdbRemoteOffsetConfirmed

static, constant _broadcastYdbRemoteOffsetReceived

Call this when remote update is received (thus host has increased, but not confirmed, the offset)

static, constant _broadcastYdbSyncFromServer

Call this when sync confirmed by host

static, constant _broadcastYdbSyncingRoomsToServer

Call this when a subscription is created

static, constant clear

Remove a db namespace. Call this to remove any persisted data. Make sure to close active sessions. TODO: destroy active ydbClient sessions / throw if a session is still active

static, constant confirmClient

The host confirms that it received and persisted an update. The update can be safely removed from CU. It is necessary to call this function in case that the client disconnected before the host could send writeHostUnconfirmedByClient.

static, constant confirmSubscription

Set the initial room data. Overwrites initial data if there is any!

static, constant createSub

static, constant createTransaction

Create a new IDBTransaction accessing all object stores. Normally we should care that we can access object stores in parallel. But this is not possible in ydb-client since at least two object stores are requested in every IDB change.

static, constant createUpdate

static, constant createYdbClient

static, constant get

Factory function. Get a ydb instance that connects to url, and uses dbNamespace as indexeddb namespace. Create if it does not exist yet.

static, constant getRoomData

Get all data from idb, including unconfirmed updates. TODO: include updates in CU

static, constant getRoomDataWithoutCU

Get all data from idb, excluding unconfirmed updates. TODO: include updates in CU

static, constant getRoomMetas

Get all meta information for all rooms.

static, constant getUnconfirmedUpdates

Get all updates that are not yet confirmed by host.

static, constant openDB

static, constant publishAll

Publish to all, including self

static, constant publishRoomData

static, constant readMessage

static, constant send

static, constant subscribeRoomData

static, constant update

static, constant writeClientUnconfirmed

Write an update to the db after the client created it. This update is not yet received by the host. This function returns a client confirmation number. The confirmation number must be send to the host so it can identify the update, and we can move the update to HU when it is confirmed (@see writeHostUnconfirmedByClient)

static, constant writeConfirmedByHost

The host confirms that it persisted updates up until (including) offset. updates may be moved from HU to Co.

static, constant writeHostUnconfirmed

The host broadcasts an update created by another client. It assures that the update will eventually be persisted with offset. Calling this function does not imply that the update was persisted by the host. In case of mismatching room session ids the updates in HU will be sent to the server.

static, constant writeHostUnconfirmedByClient

The host confirms that it received and broadcasted an update sent from this client. Calling this method does not confirm that the update has been persisted by the server.

Other clients will receive an update with writeHostUnconfirmed. Since this client created the update, it only receives a confirmation. So we can simply move the update from CU to HU.

inner, constant datasubs :Map.<string, Set.<function()>>

inner, constant ydbinstances :Set.<any>

Set of Ydb instances

Methods

inner checkTestClients(…testClients)

Check if tsclient has all data in dataset

Parameters:
Name Type Attributes Description
testClients YdbTestClient <repeatable>

inner decodeHUKey(key) → {RoomAndOffset}

Parameters:
Name Type Description
key HUTableKey
Returns:
RoomAndOffset

inner encodeHUKey(room, offset) → {HUTableKey}

Parameters:
Name Type Description
room string
offset number
Returns:
HUTableKey

inner encodeMetaValue(rsid, offset) → {ArrayBuffer}

Parameters:
Name Type Description
rsid number

room session id

offset number
Returns:
ArrayBuffer

inner getStoreCo(t) → {IDBObjectStore}

Get 'confirmed' store from transaction

Parameters:
Name Type Description
t IDBTransaction
Returns:
IDBObjectStore

inner getStoreCU(t) → {IDBObjectStore}

Get 'client-unconfirmed' store from transaction

Parameters:
Name Type Description
t IDBTransaction
Returns:
IDBObjectStore

inner getStoreHU(t) → {IDBObjectStore}

Get 'host-unconfirmed' store from transaction

Parameters:
Name Type Description
t IDBTransaction
Returns:
IDBObjectStore

inner getStoreUS(t) → {IDBObjectStore}

Get unconfirmed-subscriptions store from transaction

Parameters:
Name Type Description
t IDBTransaction
Returns:
IDBObjectStore

async, inner getTestClient(name) → {Promise.<YdbTestClient>}

Parameters:
Name Type Description
name string
Returns:
Promise.<YdbTestClient>

inner initWS(ydb, ws)

Initialize WebSocket connection. Try to reconnect on error/disconnect.

Parameters:
Name Type Description
ydb YdbClient
ws WebSocket

inner update(client)

Create an update. We use an increasing message counter so each update is unique.

Parameters:
Name Type Description
client YdbTestClient

Type Definitions

HUTableKey

Array of length 2: [string, number]

RoomAndOffset

Properties:
Name Type Description
room string
offset number

Received offsets (including offsets that are not yet confirmed)

RoomMeta

Properties:
Name Type Description
room string
rsid number

Room session id

offset number

Received offsets (including offsets that are not yet confirmed)

RoomState

Properties:
Name Type Description
rsid number

room session id, -1 if unknown (created locally)

offset number

By server, -1 if unknown

cOffset number

current offset by client

Sub

Properties:
Name Type Description
room string

room name

rsid number

room session id

offset number

SubDef

Properties:
Name Type Description
room string
offset number
rsid number

SyncState

Properties:
Name Type Description
upsynced boolean

True if all local updates have been sent to the server and the server confirmed that it received the update

downsynced boolean

True if the current session subscribed to the room, the server confirmed the subscription, and the initial data was received

persisted boolean

True if the server confirmed that it persisted all published data

provider/ydb

Classes

YdbClient

Members

static, constant _broadcastYdbCUConfConfirmed

Call this when user confid was confirmed by host

static, constant _broadcastYdbCUConfCreated

Call this when update was created by this user and confid was created

static, constant _broadcastYdbRemoteOffsetConfirmed

static, constant _broadcastYdbRemoteOffsetReceived

Call this when remote update is received (thus host has increased, but not confirmed, the offset)

static, constant _broadcastYdbSyncFromServer

Call this when sync confirmed by host

static, constant _broadcastYdbSyncingRoomsToServer

Call this when a subscription is created

static, constant clear

Remove a db namespace. Call this to remove any persisted data. Make sure to close active sessions. TODO: destroy active ydbClient sessions / throw if a session is still active

static, constant confirmClient

The host confirms that it received and persisted an update. The update can be safely removed from CU. It is necessary to call this function in case that the client disconnected before the host could send writeHostUnconfirmedByClient.

static, constant confirmSubscription

Set the initial room data. Overwrites initial data if there is any!

static, constant createSub

static, constant createTransaction

Create a new IDBTransaction accessing all object stores. Normally we should care that we can access object stores in parallel. But this is not possible in ydb-client since at least two object stores are requested in every IDB change.

static, constant createUpdate

static, constant createYdbClient

static, constant get

Factory function. Get a ydb instance that connects to url, and uses dbNamespace as indexeddb namespace. Create if it does not exist yet.

static, constant getRoomData

Get all data from idb, including unconfirmed updates. TODO: include updates in CU

static, constant getRoomDataWithoutCU

Get all data from idb, excluding unconfirmed updates. TODO: include updates in CU

static, constant getRoomMetas

Get all meta information for all rooms.

static, constant getUnconfirmedUpdates

Get all updates that are not yet confirmed by host.

static, constant openDB

static, constant publishAll

Publish to all, including self

static, constant publishRoomData

static, constant readMessage

static, constant send

static, constant subscribeRoomData

static, constant update

static, constant writeClientUnconfirmed

Write an update to the db after the client created it. This update is not yet received by the host. This function returns a client confirmation number. The confirmation number must be send to the host so it can identify the update, and we can move the update to HU when it is confirmed (@see writeHostUnconfirmedByClient)

static, constant writeConfirmedByHost

The host confirms that it persisted updates up until (including) offset. updates may be moved from HU to Co.

static, constant writeHostUnconfirmed

The host broadcasts an update created by another client. It assures that the update will eventually be persisted with offset. Calling this function does not imply that the update was persisted by the host. In case of mismatching room session ids the updates in HU will be sent to the server.

static, constant writeHostUnconfirmedByClient

The host confirms that it received and broadcasted an update sent from this client. Calling this method does not confirm that the update has been persisted by the server.

Other clients will receive an update with writeHostUnconfirmed. Since this client created the update, it only receives a confirmation. So we can simply move the update from CU to HU.

inner, constant datasubs :Map.<string, Set.<function()>>

inner, constant ydbinstances :Set.<any>

Set of Ydb instances

Methods

inner checkTestClients(…testClients)

Check if tsclient has all data in dataset

Parameters:
Name Type Attributes Description
testClients YdbTestClient <repeatable>

inner decodeHUKey(key) → {RoomAndOffset}

Parameters:
Name Type Description
key HUTableKey
Returns:
RoomAndOffset

inner encodeHUKey(room, offset) → {HUTableKey}

Parameters:
Name Type Description
room string
offset number
Returns:
HUTableKey

inner encodeMetaValue(rsid, offset) → {ArrayBuffer}

Parameters:
Name Type Description
rsid number

room session id

offset number
Returns:
ArrayBuffer

inner getStoreCo(t) → {IDBObjectStore}

Get 'confirmed' store from transaction

Parameters:
Name Type Description
t IDBTransaction
Returns:
IDBObjectStore

inner getStoreCU(t) → {IDBObjectStore}

Get 'client-unconfirmed' store from transaction

Parameters:
Name Type Description
t IDBTransaction
Returns:
IDBObjectStore

inner getStoreHU(t) → {IDBObjectStore}

Get 'host-unconfirmed' store from transaction

Parameters:
Name Type Description
t IDBTransaction
Returns:
IDBObjectStore

inner getStoreUS(t) → {IDBObjectStore}

Get unconfirmed-subscriptions store from transaction

Parameters:
Name Type Description
t IDBTransaction
Returns:
IDBObjectStore

async, inner getTestClient(name) → {Promise.<YdbTestClient>}

Parameters:
Name Type Description
name string
Returns:
Promise.<YdbTestClient>

inner initWS(ydb, ws)

Initialize WebSocket connection. Try to reconnect on error/disconnect.

Parameters:
Name Type Description
ydb YdbClient
ws WebSocket

inner update(client)

Create an update. We use an increasing message counter so each update is unique.

Parameters:
Name Type Description
client YdbTestClient

Type Definitions

HUTableKey

Array of length 2: [string, number]

RoomAndOffset

Properties:
Name Type Description
room string
offset number

Received offsets (including offsets that are not yet confirmed)

RoomMeta

Properties:
Name Type Description
room string
rsid number

Room session id

offset number

Received offsets (including offsets that are not yet confirmed)

RoomState

Properties:
Name Type Description
rsid number

room session id, -1 if unknown (created locally)

offset number

By server, -1 if unknown

cOffset number

current offset by client

Sub

Properties:
Name Type Description
room string

room name

rsid number

room session id

offset number

SubDef

Properties:
Name Type Description
room string
offset number
rsid number

SyncState

Properties:
Name Type Description
upsynced boolean

True if all local updates have been sent to the server and the server confirmed that it received the update

downsynced boolean

True if the current session subscribed to the room, the server confirmed the subscription, and the initial data was received

persisted boolean

True if the server confirmed that it persisted all published data

provider/ydb

Classes

YdbClient

Members

static, constant _broadcastYdbCUConfConfirmed

Call this when user confid was confirmed by host

static, constant _broadcastYdbCUConfCreated

Call this when update was created by this user and confid was created

static, constant _broadcastYdbRemoteOffsetConfirmed

static, constant _broadcastYdbRemoteOffsetReceived

Call this when remote update is received (thus host has increased, but not confirmed, the offset)

static, constant _broadcastYdbSyncFromServer

Call this when sync confirmed by host

static, constant _broadcastYdbSyncingRoomsToServer

Call this when a subscription is created

static, constant clear

Remove a db namespace. Call this to remove any persisted data. Make sure to close active sessions. TODO: destroy active ydbClient sessions / throw if a session is still active

static, constant confirmClient

The host confirms that it received and persisted an update. The update can be safely removed from CU. It is necessary to call this function in case that the client disconnected before the host could send writeHostUnconfirmedByClient.

static, constant confirmSubscription

Set the initial room data. Overwrites initial data if there is any!

static, constant createSub

static, constant createTransaction

Create a new IDBTransaction accessing all object stores. Normally we should care that we can access object stores in parallel. But this is not possible in ydb-client since at least two object stores are requested in every IDB change.

static, constant createUpdate

static, constant createYdbClient

static, constant get

Factory function. Get a ydb instance that connects to url, and uses dbNamespace as indexeddb namespace. Create if it does not exist yet.

static, constant getRoomData

Get all data from idb, including unconfirmed updates. TODO: include updates in CU

static, constant getRoomDataWithoutCU

Get all data from idb, excluding unconfirmed updates. TODO: include updates in CU

static, constant getRoomMetas

Get all meta information for all rooms.

static, constant getUnconfirmedUpdates

Get all updates that are not yet confirmed by host.

static, constant openDB

static, constant publishAll

Publish to all, including self

static, constant publishRoomData

static, constant readMessage

static, constant send

static, constant subscribeRoomData

static, constant update

static, constant writeClientUnconfirmed

Write an update to the db after the client created it. This update is not yet received by the host. This function returns a client confirmation number. The confirmation number must be send to the host so it can identify the update, and we can move the update to HU when it is confirmed (@see writeHostUnconfirmedByClient)

static, constant writeConfirmedByHost

The host confirms that it persisted updates up until (including) offset. updates may be moved from HU to Co.

static, constant writeHostUnconfirmed

The host broadcasts an update created by another client. It assures that the update will eventually be persisted with offset. Calling this function does not imply that the update was persisted by the host. In case of mismatching room session ids the updates in HU will be sent to the server.

static, constant writeHostUnconfirmedByClient

The host confirms that it received and broadcasted an update sent from this client. Calling this method does not confirm that the update has been persisted by the server.

Other clients will receive an update with writeHostUnconfirmed. Since this client created the update, it only receives a confirmation. So we can simply move the update from CU to HU.

inner, constant datasubs :Map.<string, Set.<function()>>

inner, constant ydbinstances :Set.<any>

Set of Ydb instances

Methods

inner checkTestClients(…testClients)

Check if tsclient has all data in dataset

Parameters:
Name Type Attributes Description
testClients YdbTestClient <repeatable>

inner decodeHUKey(key) → {RoomAndOffset}

Parameters:
Name Type Description
key HUTableKey
Returns:
RoomAndOffset

inner encodeHUKey(room, offset) → {HUTableKey}

Parameters:
Name Type Description
room string
offset number
Returns:
HUTableKey

inner encodeMetaValue(rsid, offset) → {ArrayBuffer}

Parameters:
Name Type Description
rsid number

room session id

offset number
Returns:
ArrayBuffer

inner getStoreCo(t) → {IDBObjectStore}

Get 'confirmed' store from transaction

Parameters:
Name Type Description
t IDBTransaction
Returns:
IDBObjectStore

inner getStoreCU(t) → {IDBObjectStore}

Get 'client-unconfirmed' store from transaction

Parameters:
Name Type Description
t IDBTransaction
Returns:
IDBObjectStore

inner getStoreHU(t) → {IDBObjectStore}

Get 'host-unconfirmed' store from transaction

Parameters:
Name Type Description
t IDBTransaction
Returns:
IDBObjectStore

inner getStoreUS(t) → {IDBObjectStore}

Get unconfirmed-subscriptions store from transaction

Parameters:
Name Type Description
t IDBTransaction
Returns:
IDBObjectStore

async, inner getTestClient(name) → {Promise.<YdbTestClient>}

Parameters:
Name Type Description
name string
Returns:
Promise.<YdbTestClient>

inner initWS(ydb, ws)

Initialize WebSocket connection. Try to reconnect on error/disconnect.

Parameters:
Name Type Description
ydb YdbClient
ws WebSocket

inner update(client)

Create an update. We use an increasing message counter so each update is unique.

Parameters:
Name Type Description
client YdbTestClient

Type Definitions

HUTableKey

Array of length 2: [string, number]

RoomAndOffset

Properties:
Name Type Description
room string
offset number

Received offsets (including offsets that are not yet confirmed)

RoomMeta

Properties:
Name Type Description
room string
rsid number

Room session id

offset number

Received offsets (including offsets that are not yet confirmed)

RoomState

Properties:
Name Type Description
rsid number

room session id, -1 if unknown (created locally)

offset number

By server, -1 if unknown

cOffset number

current offset by client

Sub

Properties:
Name Type Description
room string

room name

rsid number

room session id

offset number

SubDef

Properties:
Name Type Description
room string
offset number
rsid number

SyncState

Properties:
Name Type Description
upsynced boolean

True if all local updates have been sent to the server and the server confirmed that it received the update

downsynced boolean

True if the current session subscribed to the room, the server confirmed the subscription, and the initial data was received

persisted boolean

True if the server confirmed that it persisted all published data

provider/ydb

Classes

YdbClient

Members

static, constant _broadcastYdbCUConfConfirmed

Call this when user confid was confirmed by host

static, constant _broadcastYdbCUConfCreated

Call this when update was created by this user and confid was created

static, constant _broadcastYdbRemoteOffsetConfirmed

static, constant _broadcastYdbRemoteOffsetReceived

Call this when remote update is received (thus host has increased, but not confirmed, the offset)

static, constant _broadcastYdbSyncFromServer

Call this when sync confirmed by host

static, constant _broadcastYdbSyncingRoomsToServer

Call this when a subscription is created

static, constant clear

Remove a db namespace. Call this to remove any persisted data. Make sure to close active sessions. TODO: destroy active ydbClient sessions / throw if a session is still active

static, constant confirmClient

The host confirms that it received and persisted an update. The update can be safely removed from CU. It is necessary to call this function in case that the client disconnected before the host could send writeHostUnconfirmedByClient.

static, constant confirmSubscription

Set the initial room data. Overwrites initial data if there is any!

static, constant createSub

static, constant createTransaction

Create a new IDBTransaction accessing all object stores. Normally we should care that we can access object stores in parallel. But this is not possible in ydb-client since at least two object stores are requested in every IDB change.

static, constant createUpdate

static, constant createYdbClient

static, constant get

Factory function. Get a ydb instance that connects to url, and uses dbNamespace as indexeddb namespace. Create if it does not exist yet.

static, constant getRoomData

Get all data from idb, including unconfirmed updates. TODO: include updates in CU

static, constant getRoomDataWithoutCU

Get all data from idb, excluding unconfirmed updates. TODO: include updates in CU

static, constant getRoomMetas

Get all meta information for all rooms.

static, constant getUnconfirmedUpdates

Get all updates that are not yet confirmed by host.

static, constant openDB

static, constant publishAll

Publish to all, including self

static, constant publishRoomData

static, constant readMessage

static, constant send

static, constant subscribeRoomData

static, constant update

static, constant writeClientUnconfirmed

Write an update to the db after the client created it. This update is not yet received by the host. This function returns a client confirmation number. The confirmation number must be send to the host so it can identify the update, and we can move the update to HU when it is confirmed (@see writeHostUnconfirmedByClient)

static, constant writeConfirmedByHost

The host confirms that it persisted updates up until (including) offset. updates may be moved from HU to Co.

static, constant writeHostUnconfirmed

The host broadcasts an update created by another client. It assures that the update will eventually be persisted with offset. Calling this function does not imply that the update was persisted by the host. In case of mismatching room session ids the updates in HU will be sent to the server.

static, constant writeHostUnconfirmedByClient

The host confirms that it received and broadcasted an update sent from this client. Calling this method does not confirm that the update has been persisted by the server.

Other clients will receive an update with writeHostUnconfirmed. Since this client created the update, it only receives a confirmation. So we can simply move the update from CU to HU.

inner, constant datasubs :Map.<string, Set.<function()>>

inner, constant ydbinstances :Set.<any>

Set of Ydb instances

Methods

inner checkTestClients(…testClients)

Check if tsclient has all data in dataset

Parameters:
Name Type Attributes Description
testClients YdbTestClient <repeatable>

inner decodeHUKey(key) → {RoomAndOffset}

Parameters:
Name Type Description
key HUTableKey
Returns:
RoomAndOffset

inner encodeHUKey(room, offset) → {HUTableKey}

Parameters:
Name Type Description
room string
offset number
Returns:
HUTableKey

inner encodeMetaValue(rsid, offset) → {ArrayBuffer}

Parameters:
Name Type Description
rsid number

room session id

offset number
Returns:
ArrayBuffer

inner getStoreCo(t) → {IDBObjectStore}

Get 'confirmed' store from transaction

Parameters:
Name Type Description
t IDBTransaction
Returns:
IDBObjectStore

inner getStoreCU(t) → {IDBObjectStore}

Get 'client-unconfirmed' store from transaction

Parameters:
Name Type Description
t IDBTransaction
Returns:
IDBObjectStore

inner getStoreHU(t) → {IDBObjectStore}

Get 'host-unconfirmed' store from transaction

Parameters:
Name Type Description
t IDBTransaction
Returns:
IDBObjectStore

inner getStoreUS(t) → {IDBObjectStore}

Get unconfirmed-subscriptions store from transaction

Parameters:
Name Type Description
t IDBTransaction
Returns:
IDBObjectStore

async, inner getTestClient(name) → {Promise.<YdbTestClient>}

Parameters:
Name Type Description
name string
Returns:
Promise.<YdbTestClient>

inner initWS(ydb, ws)

Initialize WebSocket connection. Try to reconnect on error/disconnect.

Parameters:
Name Type Description
ydb YdbClient
ws WebSocket

inner update(client)

Create an update. We use an increasing message counter so each update is unique.

Parameters:
Name Type Description
client YdbTestClient

Type Definitions

HUTableKey

Array of length 2: [string, number]

RoomAndOffset

Properties:
Name Type Description
room string
offset number

Received offsets (including offsets that are not yet confirmed)

RoomMeta

Properties:
Name Type Description
room string
rsid number

Room session id

offset number

Received offsets (including offsets that are not yet confirmed)

RoomState

Properties:
Name Type Description
rsid number

room session id, -1 if unknown (created locally)

offset number

By server, -1 if unknown

cOffset number

current offset by client

Sub

Properties:
Name Type Description
room string

room name

rsid number

room session id

offset number

SubDef

Properties:
Name Type Description
room string
offset number
rsid number

SyncState

Properties:
Name Type Description
upsynced boolean

True if all local updates have been sent to the server and the server confirmed that it received the update

downsynced boolean

True if the current session subscribed to the room, the server confirmed the subscription, and the initial data was received

persisted boolean

True if the server confirmed that it persisted all published data

provider/ydb

Classes

YdbClient

Members

static, constant _broadcastYdbCUConfConfirmed

Call this when user confid was confirmed by host

static, constant _broadcastYdbCUConfCreated

Call this when update was created by this user and confid was created

static, constant _broadcastYdbRemoteOffsetConfirmed

static, constant _broadcastYdbRemoteOffsetReceived

Call this when remote update is received (thus host has increased, but not confirmed, the offset)

static, constant _broadcastYdbSyncFromServer

Call this when sync confirmed by host

static, constant _broadcastYdbSyncingRoomsToServer

Call this when a subscription is created

static, constant clear

Remove a db namespace. Call this to remove any persisted data. Make sure to close active sessions. TODO: destroy active ydbClient sessions / throw if a session is still active

static, constant confirmClient

The host confirms that it received and persisted an update. The update can be safely removed from CU. It is necessary to call this function in case that the client disconnected before the host could send writeHostUnconfirmedByClient.

static, constant confirmSubscription

Set the initial room data. Overwrites initial data if there is any!

static, constant createSub

static, constant createTransaction

Create a new IDBTransaction accessing all object stores. Normally we should care that we can access object stores in parallel. But this is not possible in ydb-client since at least two object stores are requested in every IDB change.

static, constant createUpdate

static, constant createYdbClient

static, constant get

Factory function. Get a ydb instance that connects to url, and uses dbNamespace as indexeddb namespace. Create if it does not exist yet.

static, constant getRoomData

Get all data from idb, including unconfirmed updates. TODO: include updates in CU

static, constant getRoomDataWithoutCU

Get all data from idb, excluding unconfirmed updates. TODO: include updates in CU

static, constant getRoomMetas

Get all meta information for all rooms.

static, constant getUnconfirmedUpdates

Get all updates that are not yet confirmed by host.

static, constant openDB

static, constant publishAll

Publish to all, including self

static, constant publishRoomData

static, constant readMessage

static, constant send

static, constant subscribeRoomData

static, constant update

static, constant writeClientUnconfirmed

Write an update to the db after the client created it. This update is not yet received by the host. This function returns a client confirmation number. The confirmation number must be send to the host so it can identify the update, and we can move the update to HU when it is confirmed (@see writeHostUnconfirmedByClient)

static, constant writeConfirmedByHost

The host confirms that it persisted updates up until (including) offset. updates may be moved from HU to Co.

static, constant writeHostUnconfirmed

The host broadcasts an update created by another client. It assures that the update will eventually be persisted with offset. Calling this function does not imply that the update was persisted by the host. In case of mismatching room session ids the updates in HU will be sent to the server.

static, constant writeHostUnconfirmedByClient

The host confirms that it received and broadcasted an update sent from this client. Calling this method does not confirm that the update has been persisted by the server.

Other clients will receive an update with writeHostUnconfirmed. Since this client created the update, it only receives a confirmation. So we can simply move the update from CU to HU.

inner, constant datasubs :Map.<string, Set.<function()>>

inner, constant ydbinstances :Set.<any>

Set of Ydb instances

Methods

inner checkTestClients(…testClients)

Check if tsclient has all data in dataset

Parameters:
Name Type Attributes Description
testClients YdbTestClient <repeatable>

inner decodeHUKey(key) → {RoomAndOffset}

Parameters:
Name Type Description
key HUTableKey
Returns:
RoomAndOffset

inner encodeHUKey(room, offset) → {HUTableKey}

Parameters:
Name Type Description
room string
offset number
Returns:
HUTableKey

inner encodeMetaValue(rsid, offset) → {ArrayBuffer}

Parameters:
Name Type Description
rsid number

room session id

offset number
Returns:
ArrayBuffer

inner getStoreCo(t) → {IDBObjectStore}

Get 'confirmed' store from transaction

Parameters:
Name Type Description
t IDBTransaction
Returns:
IDBObjectStore

inner getStoreCU(t) → {IDBObjectStore}

Get 'client-unconfirmed' store from transaction

Parameters:
Name Type Description
t IDBTransaction
Returns:
IDBObjectStore

inner getStoreHU(t) → {IDBObjectStore}

Get 'host-unconfirmed' store from transaction

Parameters:
Name Type Description
t IDBTransaction
Returns:
IDBObjectStore

inner getStoreUS(t) → {IDBObjectStore}

Get unconfirmed-subscriptions store from transaction

Parameters:
Name Type Description
t IDBTransaction
Returns:
IDBObjectStore

async, inner getTestClient(name) → {Promise.<YdbTestClient>}

Parameters:
Name Type Description
name string
Returns:
Promise.<YdbTestClient>

inner initWS(ydb, ws)

Initialize WebSocket connection. Try to reconnect on error/disconnect.

Parameters:
Name Type Description
ydb YdbClient
ws WebSocket

inner update(client)

Create an update. We use an increasing message counter so each update is unique.

Parameters:
Name Type Description
client YdbTestClient

Type Definitions

HUTableKey

Array of length 2: [string, number]

RoomAndOffset

Properties:
Name Type Description
room string
offset number

Received offsets (including offsets that are not yet confirmed)

RoomMeta

Properties:
Name Type Description
room string
rsid number

Room session id

offset number

Received offsets (including offsets that are not yet confirmed)

RoomState

Properties:
Name Type Description
rsid number

room session id, -1 if unknown (created locally)

offset number

By server, -1 if unknown

cOffset number

current offset by client

Sub

Properties:
Name Type Description
room string

room name

rsid number

room session id

offset number

SubDef

Properties:
Name Type Description
room string
offset number
rsid number

SyncState

Properties:
Name Type Description
upsynced boolean

True if all local updates have been sent to the server and the server confirmed that it received the update

downsynced boolean

True if the current session subscribed to the room, the server confirmed the subscription, and the initial data was received

persisted boolean

True if the server confirmed that it persisted all published data