Skip to content
This repository has been archived by the owner on Jun 26, 2023. It is now read-only.

Various refactorings #36

Merged
merged 12 commits into from
Dec 19, 2018
Merged

Various refactorings #36

merged 12 commits into from
Dec 19, 2018

Commits on Dec 17, 2018

  1. add a child structure

    Unify the `string`/`ipld.Node` information a parent has about its children when
    updating a modified entry. This will be used to simplify the code around the
    `childCloser` interface and related logic.
    schomatis committed Dec 17, 2018
    Configuration menu
    Copy the full SHA
    32ca97a View commit details
    Browse the repository at this point in the history
  2. use new child structure

    Use newly introduced `child` structure whenever the logically tied
    `string`/`ipld.Node` pair was used to represent a child entry in a
    directory operation.
    schomatis committed Dec 17, 2018
    Configuration menu
    Copy the full SHA
    54062f4 View commit details
    Browse the repository at this point in the history
  3. rename the childCloser interface

    Rename the `childCloser` interface to `mutableParent` to better reflect the fact
    that the structures that implement it (`Directory` and `Root`) have the function
    of parents in the MFS hierarchy. Rename also the method of the interface from
    `closeChild` to `updateChildEntry` shifting the focus away from in which
    circumstance is the method being called (when closing a child) to actually what
    operation is being performed by the method (updating an entry in the parent to
    the new content).
    schomatis committed Dec 17, 2018
    Configuration menu
    Copy the full SHA
    e87a272 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    ef5e119 View commit details
    Browse the repository at this point in the history
  5. move Republisher to a separate file

    Extract the `Republisher` structure and related logic from `system.go` (leaving
    that file mainly with the `Root` logic, and hence now renamed as `root.go`) to a
    new `repub.go` file. Even though the MFS root has support for republishing
    updates the logic behind those two structures is mostly decoupled, that should
    be reflected in the source code organization.
    schomatis committed Dec 17, 2018
    Configuration menu
    Copy the full SHA
    8539b81 View commit details
    Browse the repository at this point in the history
  6. remove Sync from FileDescriptor

    Remove the `Sync()` method from the `FileDescriptor` and also its
    implementation.
    
    Two different undocumented methods in `FileDescriptor` are offered to update the
    state of the MFS: `Flush()` and `Sync()`, both calling `updateChildEntry`. The
    only difference (the user is not aware of) is that one sets the `fullSync`
    argument and the other doesn't, that is, one does a full update of the
    filesystem and the other just updates the parent directory.
    
    This current situation is not clear to the consumer who may use one desiring the
    effect of the other. As a precautionary measure while redesigning the MFS API
    one method is removed to simplify its usage. The `Sync()` was chosen as the less
    "safe" alternative which didn't do a full update of the MFS and also doesn't
    seem to be used in the `go-ipfs` repository (the main consumer of the `mfs`
    package).
    schomatis committed Dec 17, 2018
    Configuration menu
    Copy the full SHA
    2f52311 View commit details
    Browse the repository at this point in the history
  7. unify the caches in Directory

    Unify the two caches in `Directory` that discriminated between files and
    directories (`files` and `childDirs`) into a single `entriesCache` since that
    distinction wasn't used anywhere and made the code unnecessarily more complex.
    schomatis committed Dec 17, 2018
    Configuration menu
    Copy the full SHA
    925c0a8 View commit details
    Browse the repository at this point in the history

Commits on Dec 19, 2018

  1. document republisher logic

    Document the `Republisher` code in `repub.go` according to the explanation in
    ipfs/kubo#5092 (comment). Erring on
    the side of verbosity since this has been a part of the code with very little
    review up until now.
    schomatis committed Dec 19, 2018
    Configuration menu
    Copy the full SHA
    0abe769 View commit details
    Browse the repository at this point in the history
  2. rename all Republisher receivers

    Unify all the `Republisher` receivers names to `rp` (avoiding `r` to distinguish
    it from the `Root` receivers).
    schomatis committed Dec 19, 2018
    Configuration menu
    Copy the full SHA
    4809106 View commit details
    Browse the repository at this point in the history
  3. rename the mutableParent interface to just parent

    The name `mutableParent` signals "this is a mutable parent, there are immutable
    versions".
    schomatis committed Dec 19, 2018
    Configuration menu
    Copy the full SHA
    d1471da View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    25dd99b View commit details
    Browse the repository at this point in the history
  5. unexport AddUnixFSChild

    schomatis committed Dec 19, 2018
    Configuration menu
    Copy the full SHA
    6c4a00a View commit details
    Browse the repository at this point in the history