Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pbdagreader: use FSNode instead of protobuf structure #5189

Merged
merged 2 commits into from
Jul 16, 2018
Merged

pbdagreader: use FSNode instead of protobuf structure #5189

merged 2 commits into from
Jul 16, 2018

Commits on Jul 6, 2018

  1. pbdagreader: use FSNode instead of protobuf structure

    Focus on the UnixFS layer and avoid explicit references to protocol buffers
    format (used to serialize objects of that layer). Use the `unixfs.FSNode`
    structure which it abstracts from the `unixfs.pb.Data` format.
    
    Replace `PBDagReader` field `ftpb.Data` with `ft.FSNode`, renaming it to `file`
    (which is the type of UnixFS object represented in the reader) and changing its
    comment removing the "cached" reference, as this structure is not used here as a
    cache (`PBDagReader` doesn't modify the DAG, it's read-only). Also, removed
    unused `ProtoNode` field to avoid confusions, as it would normally be present if
    the `FSNode` was in fact used as a cache of the contents of the `ProtoNode`.
    
    An example of the advantage of shifting the focus from the format to the UnixFS
    layer is dropping the of use `len(pb.Blocksizes)` in favor of the more clear
    `NumChildren()` abstraction.
    
    Added `BlockSize()` accessor.
    
    License: MIT
    Signed-off-by: Lucas Molas <schomatis@gmail.com>
    schomatis committed Jul 6, 2018
    Configuration menu
    Copy the full SHA
    acb9e23 View commit details
    Browse the repository at this point in the history
  2. unixfs: remove Get prefix from FSNode accessors

    See https://golang.org/doc/effective_go.html#Getters.
    
    License: MIT
    Signed-off-by: Lucas Molas <schomatis@gmail.com>
    schomatis committed Jul 6, 2018
    Configuration menu
    Copy the full SHA
    18361d3 View commit details
    Browse the repository at this point in the history