Classes
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 testClientsYdbTestClient <repeatable>
-
inner decodeHUKey(key) → {RoomAndOffset}
-
Parameters:
Name Type Description keyHUTableKey Returns:
RoomAndOffset -
inner encodeHUKey(room, offset) → {HUTableKey}
-
Parameters:
Name Type Description roomstring offsetnumber Returns:
HUTableKey -
inner encodeMetaValue(rsid, offset) → {ArrayBuffer}
-
Parameters:
Name Type Description rsidnumber room session id
offsetnumber Returns:
ArrayBuffer -
inner getStoreCo(t) → {IDBObjectStore}
-
Get 'confirmed' store from transaction
Parameters:
Name Type Description tIDBTransaction Returns:
IDBObjectStore -
inner getStoreCU(t) → {IDBObjectStore}
-
Get 'client-unconfirmed' store from transaction
Parameters:
Name Type Description tIDBTransaction Returns:
IDBObjectStore -
inner getStoreHU(t) → {IDBObjectStore}
-
Get 'host-unconfirmed' store from transaction
Parameters:
Name Type Description tIDBTransaction Returns:
IDBObjectStore -
inner getStoreUS(t) → {IDBObjectStore}
-
Get
unconfirmed-subscriptionsstore from transactionParameters:
Name Type Description tIDBTransaction Returns:
IDBObjectStore -
async, inner getTestClient(name) → {Promise.<YdbTestClient>}
-
Parameters:
Name Type Description namestring Returns:
Promise.<YdbTestClient> -
inner initWS(ydb, ws)
-
Initialize WebSocket connection. Try to reconnect on error/disconnect.
Parameters:
Name Type Description ydbYdbClient wsWebSocket -
inner update(client)
-
Create an update. We use an increasing message counter so each update is unique.
Parameters:
Name Type Description clientYdbTestClient
Type Definitions
-
HUTableKey
-
Array of length 2: [string, number]
-
RoomAndOffset
-
Properties:
Name Type Description roomstring offsetnumber Received offsets (including offsets that are not yet confirmed)
-
RoomMeta
-
Properties:
Name Type Description roomstring rsidnumber Room session id
offsetnumber Received offsets (including offsets that are not yet confirmed)
-
RoomState
-
Properties:
Name Type Description rsidnumber room session id, -1 if unknown (created locally)
offsetnumber By server, -1 if unknown
cOffsetnumber current offset by client
-
Sub
-
Properties:
Name Type Description roomstring room name
rsidnumber room session id
offsetnumber -
SubDef
-
Properties:
Name Type Description roomstring offsetnumber rsidnumber -
SyncState
-
Properties:
Name Type Description upsyncedboolean True if all local updates have been sent to the server and the server confirmed that it received the update
downsyncedboolean True if the current session subscribed to the room, the server confirmed the subscription, and the initial data was received
persistedboolean True if the server confirmed that it persisted all published data