Skip to content

SimpleRead

James Carnley edited this page Dec 29, 2023 · 5 revisions

SimpleRead

Reading from /james/:

lastName property

Oldest EAS message "Hello World"

Newest 10 comments

Missing:

  • Protocol overrides
  • Permissions
lastName = efs.read("/james/", "files", "lastName")
lastMessage = efs.read("/james/", "eas_messages", , 1, oldest) // Read one message, start at oldest
comments = efs.read("/james/", "comments", , 10)

Graph functions:
getEdges(arrayStuff)
getProperty(name)

///// Core API
getEdges(node, type, arrayStuff) // See all nodes connected by a certain edge type
getEdgeByIndex(node, type, index, value) // Find a specific node connected by a certain edge type
readProperties(node) // gets data bytes, type, and edition etc
readProperty(node, name) // just gets one property like the raw bytes of data
whatEditionIsThisNode(node)


=Implementing: efs.read("/james/", "properties", "lastName")
=              efs.read(path, edgeType, ?)

//constants for readability
curFolder = 0 // root
typeOfDirectory = 1234
typeOfFiles = 5678
indexTypeOfName = 9384

folderName = parse out "james"
jamesNode = getEdgeByIndex(0, typeOfDirectory, indexTypeOfName, folderName)

fileNameToGet = func arg of "lastName"
fileNode = getEdgeByIndex(jamesNode, typeOfFiles , indexTypeOfName, fileNameToGet)

// for browser, get complex data
propData = readProperties(fileNode)
return { data: propData.data, dataType: propData.dataType, edition: propData.edition }
// for contracts, just get raw bytes
propData = readProperty(fileNode, "data")
return propData









// OLD below

Call EFS.read(path, edgeType, params, editions)
{
    subjectId = nameToEfsId(path, editions)
    edgeId = nameToEfsId(edgeType, editions)

    data = getNode(parentNode, edgeType, lookupValue, lookupType, lookupArgs)

    lastName = getNode(subjectId, "property", "last_name", 'name')

    lastMessage = getNode(subjectId, "eas_messages", "", 'list', [1, oldest])

    return { status: $status, edition: $edition, dataType: $datatype, data: $data }

}
Call EFS.read(efsId, "props", "get", [lastName], editions, system)
{
    sysConfig = system or $user/
    edition = EfsEdition
    propEfsId = edition.resolve(efsId, "lastName")
    propData = edition.get(propEfsId)
    return propData
}




IEfsEdition.sol:
Resolve(parentNode, nameToResolve)
{
    authContract = system.read(parentNode, "auth") // returns 0x123... contract implementing IEfsAuthorization
    if ( authContract.isAuthorized(parentNode, "resolve", nameToResolve) ) {
            return system.read(parentNode.)
    }
}

Reading data from Node:

Clone this wiki locally