• Lars Gierth's avatar
    coreapi: make the interfaces path centric · 66af0391
    Lars Gierth authored
    The new coreiface.Path maps a path to the cid.Cid
    resulting from a full path resolution.
    
    The path is internally represented as a go-ipfs/path.Path,
    but that doesn't matter to the outside.
    
    Apart from the path-to-CID mapping, it also aims to hold all
    resolved segment CIDs of the path. Right now it only exposes
    Root(), and only for flat paths a la /ipfs/Qmfoo. In other cases,
    the root is nil.
    
    In the future, resolution will internally use
    go-ipfs/path.Resolver.ResolvePathComponents and thus always return
    the proper resolved segments, via Root(), or a future Segments() func.
    
    - Add coreiface.Path with Cid() and Root().
    - Add CoreAPI.ResolvePath() for getting a coreiface.Path.
    - All functions now expect and return coreiface.Path.
    - Add ParsePath() and ParseCid() for constructing a coreiface.Path.
    - Add coreiface.Node and Link which are simply go-ipld-node.Node and Link.
    - Add CoreAPI.ResolveNode() for getting a Node from a Path.
    
    License: MIT
    Signed-off-by: default avatarLars Gierth <larsg@systemli.org>
    66af0391
interface.go 1.5 KB