You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In order to write and read an arbritrary Buffer to the DataStore we need a writeRaw and readRaw methods
Tasks
Create writeRaw implementation
Create readRaw implementation
Write unit tests
rough implementation
/** @param {string} versionId */asyncreadRaw(versionId){const{ coreDiscoveryKey, index }=parseVersionId(versionId)constcore=this.#coreManager.getCoreByDiscoveryKey(coreDiscoveryKey)if(!core)thrownewError('Invalid versionId')constblock=awaitcore.get(index,{wait: false})if(!block)thrownewError('Not Found')returnblock}asyncwriteRaw(buf){const{ length }=awaitthis.#writerCore.append(buf)constindex=length-1constcoreDiscoveryKey=this.#writerCore.discoveryKeyif(!coreDiscoveryKey){thrownewError('Writer core is not ready')}constversionId=getVersionId({ coreDiscoveryKey, index })returnversionId}
The text was updated successfully, but these errors were encountered:
Description
In order to write and read an arbritrary Buffer to the
DataStore
we need awriteRaw
andreadRaw
methodsTasks
writeRaw
implementationreadRaw
implementationrough implementation
The text was updated successfully, but these errors were encountered: