DataStoreLockUtils
Pure reading and writing of the session-lock envelope a DataStore keeps under the lock field.
DataStoreLockHelper owns the live path, where the lock is only ever touched by the session that holds it. Tooling needs the other path: inspect or clear the lock on a key belonging to a player who is not in this server, through a raw datastore write with no session at all. Both go through here so there is one definition of the envelope.
Functions
deserializeSessionData
DataStoreLockUtils.deserializeSessionData(sessionData: any) → LockedSessionData?Reads session data back out of whatever the datastore returned, rejecting anything malformed.
deserializeLockData
DataStoreLockUtils.deserializeLockData(lockData: any) → LockData?Reads a lock envelope back out of whatever the datastore returned.
readLock
DataStoreLockUtils.readLock(data: any--
the raw value stored at the key
) → LockData?Reads the lock off a whole stored profile.
createLockData
DataStoreLockUtils.createLockData(sessionData: LockedSessionData,lastUpdateTime: number?--
defaults to now
) → LockDataBuilds the envelope a session writes to claim the key.
withLock
DataStoreLockUtils.withLock(data: any,--
the raw value stored at the key
lockData: LockData?) → anyReturns a copy of the profile with the lock set to lockData, or cleared when it is nil.
toHumanReadable
DataStoreLockUtils.toHumanReadable(lockData: LockData?) → stringRenders a lock for a human reading command output.