Skip to content

SimpleRead

James Carnley edited this page Dec 19, 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/", "properties", "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)

/////
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

Call EFS.resolve(efsParentId = 0 //rootDir, "/james/") and get efsId
{
    //resolver = (systemParam or $user or "EFSv1") edition of /efs.nameResolver which is contract implementing IEfsResolver
    resolver = system._read(efsParentId, "props", "resolver")
    propEfsId = resolver.resolve(efsId, "/james/") //system in charge of checking permissions
    return efsId
}
Call EFS.read(path, edgeType, params, editions)
{
    subjectId = nameToEfsId(path, editions)
    protoId = nameToEfsId(proto, 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