• Kirill Smelkov's avatar
    X review feedback on newapi · 7e1f11bc
    Kirill Smelkov authored
    - add nodefs package overview; in particular describe what inode is so
      that there is no confusion about its meaning.
    
    - Draftly implement Lookup / Forget. They work not under global
      rawBridge.mu and still there should be no race of Lookup / Forget due to
      careful locking of inode -> (inode, ichild) + retrying.
      Add description of Forget semantic and what happens when we receive
      forget for a directory for which children are not forgotten yet.
    
      ( it is too late here now and I did not checked the implementation with
        a fresh head. I thought that it is better to release current state
        for discussion as I likely won't be able to work on newapi for at
        least another week )
    
    - use atomics in DefaultNode setInode/inode; see Lookup and
      corresponding description nearby DefaultNode.setInode for why it is
      needed.
    
    - inode.{lookupCount,nodeID} are now protected not by global
      rawBridge.mu, but instead by inode.mu .
    
    - change Node operation to return Nodes, not Inode. In particulare
      Node.Lookup should now return Node. Inodes are internal index of
      nodefs VFS (see package description) and we should not load filesystem
      implementations to think about them where we can. Also it makes a
      more closed interface when filesystem works in terms it nodes
      completely. Also this way we offload filesystems for caring about
      tricky details of how to create inode for a hardlinked entry (see
      Lookup for details which handles about it)
    
    - Remove Node.Inode -> nodefs.InodeOf(Node). this way there will be no
      possibility to override Node.Inode and we can specify InodeOf semantic
      exactly in API docs.
    
    - unlockNodes: sort is not needed
    
    - lock/unlock Nodes: avoid duplicates (e.g. there can be duplicates if dir/a and
      dir/b are hardlinks to the same file. If we don't avoid duplicates lockNodes will deadlock)
    
    - made some other edits, part of them not complete...
    7e1f11bc
inode.go 7.97 KB