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

Move locking responsibility from store.go to the container/image/layer stores #1395

Merged
merged 32 commits into from
Oct 18, 2022

Commits on Oct 17, 2022

  1. Copy methods from included interfaces directly into rwContainerStore

    ... so that we can modify/replace them.
    
    Should not change behavior.
    
    Signed-off-by: Miloslav Trmač <mitr@redhat.com>
    mtrmac committed Oct 17, 2022
    Configuration menu
    Copy the full SHA
    749be71 View commit details
    Browse the repository at this point in the history
  2. Replace containerStore.{RLock,Unlock} with {startReading,stopReading}

    This integrates ReloadIfChanges, and makes it clearer that the responsibility
    for maintaining locking details is with the containerStore; we can change it
    in a single place.
    
    Should not change behavior.
    
    Signed-off-by: Miloslav Trmač <mitr@redhat.com>
    mtrmac committed Oct 17, 2022
    Configuration menu
    Copy the full SHA
    243ec61 View commit details
    Browse the repository at this point in the history
  3. Replace containerStore.{Lock,Unlock} with {startWriting,stopWriting}

    This integrates ReloadIfChanges, and makes it clearer that the responsibility
    for maintaining locking details is with the containerStore; we can change it
    in a single place.
    
    Should not change behavior.
    
    Signed-off-by: Miloslav Trmač <mitr@redhat.com>
    mtrmac committed Oct 17, 2022
    Configuration menu
    Copy the full SHA
    dcefc6d View commit details
    Browse the repository at this point in the history
  4. Avoid a warning that is now reported

    Should not change behavior.
    
    Signed-off-by: Miloslav Trmač <mitr@redhat.com>
    mtrmac committed Oct 17, 2022
    Configuration menu
    Copy the full SHA
    607ceb6 View commit details
    Browse the repository at this point in the history
  5. Remove completely unused methods from rwContainerStore

    Exposing the internals of the lock is not necessary, and exposes
    too many implementation details.
    
    Should not change behavior.
    
    Signed-off-by: Miloslav Trmač <mitr@redhat.com>
    mtrmac committed Oct 17, 2022
    Configuration menu
    Copy the full SHA
    a64b85d View commit details
    Browse the repository at this point in the history
  6. Remove unused lockfile forwarders from rwContainerStore API

    The only callers are internal, have them access r.lockfile directly.
    
    Should not change behavior.
    
    Signed-off-by: Miloslav Trmač <mitr@redhat.com>
    mtrmac committed Oct 17, 2022
    Configuration menu
    Copy the full SHA
    409ee3e View commit details
    Browse the repository at this point in the history
  7. Remove Load() and ReloadIfChanged() from rwContainerStore API

    Callers should just use startReading/startWriting.
    
    Should not change behavior.
    
    Signed-off-by: Miloslav Trmač <mitr@redhat.com>
    mtrmac committed Oct 17, 2022
    Configuration menu
    Copy the full SHA
    58f1120 View commit details
    Browse the repository at this point in the history
  8. Remove Save() from rwContainerStore API

    It is done implicitly by all writers already.
    
    Also fix the documentation not to point at an explicit Touch(),
    which is not actually necessary.
    
    Should not change behavior.
    
    Signed-off-by: Miloslav Trmač <mitr@redhat.com>
    mtrmac committed Oct 17, 2022
    Configuration menu
    Copy the full SHA
    4c55fad View commit details
    Browse the repository at this point in the history
  9. Remove Lock/Unlock methods from rwContainerStore

    They are now only used in the constructor, so use a variant
    of startWriting instead.  This code path is not performance-critical,
    so let's share as much code as possible to ensure consistency
    in locking.
    
    Should not change behavior.
    
    Signed-off-by: Miloslav Trmač <mitr@redhat.com>
    mtrmac committed Oct 17, 2022
    Configuration menu
    Copy the full SHA
    b44c193 View commit details
    Browse the repository at this point in the history
  10. Move containerStore.ReloadIfChanged

    ... to be closer to the lock / load set of methods.
    
    Only moves unchanged code, should not change behavior.
    
    Signed-off-by: Miloslav Trmač <mitr@redhat.com>
    mtrmac committed Oct 17, 2022
    Configuration menu
    Copy the full SHA
    adae72b View commit details
    Browse the repository at this point in the history
  11. Copy methods from included interfaces directly into *ImageStore

    ... so that we can modify/replace them.
    
    Should not change behavior.
    
    Signed-off-by: Miloslav Trmač <mitr@redhat.com>
    mtrmac committed Oct 17, 2022
    Configuration menu
    Copy the full SHA
    9844aa3 View commit details
    Browse the repository at this point in the history
  12. Replace imageStore.{RLock,Unlock} with {startReading,stopReading}

    This integrates ReloadIfChanged, and makes it clearer that the responsibility
    for maintaining locking details is with the imageStore; we can change it
    in a single place.
    
    Should not change behavior.
    
    Signed-off-by: Miloslav Trmač <mitr@redhat.com>
    mtrmac committed Oct 17, 2022
    Configuration menu
    Copy the full SHA
    a047bc1 View commit details
    Browse the repository at this point in the history
  13. Replace imageStore.{Lock,Unlock} with {startWriting,stopWriting}

    This integrates ReloadIfChanged, and makes it clearer that the responsibility
    for maintaining locking details is with the imageStore; we can change it
    in a single place.
    
    Should not change behavior.
    
    Signed-off-by: Miloslav Trmač <mitr@redhat.com>
    mtrmac committed Oct 17, 2022
    Configuration menu
    Copy the full SHA
    2f68ba2 View commit details
    Browse the repository at this point in the history
  14. Move the writing lock methods from roImageStore to rwImageStore

    ... for a bit of extra safety. That requires us to be a bit
    more explicit in one of the users.
    
    Should not change behavior.
    
    Signed-off-by: Miloslav Trmač <mitr@redhat.com>
    mtrmac committed Oct 17, 2022
    Configuration menu
    Copy the full SHA
    d312f1d View commit details
    Browse the repository at this point in the history
  15. Remove a completely unused method from roImageStore

    Exposing the internals of the lock is not necessary, and exposes
    too many implementation details.
    
    Should not change behavior.
    
    Signed-off-by: Miloslav Trmač <mitr@redhat.com>
    mtrmac committed Oct 17, 2022
    Configuration menu
    Copy the full SHA
    19659d9 View commit details
    Browse the repository at this point in the history
  16. Remove unused lockfile forwarders from roImageStore API

    The only callers are internal, have them access r.lockfile directly.
    
    Should not change behavior.
    
    Signed-off-by: Miloslav Trmač <mitr@redhat.com>
    mtrmac committed Oct 17, 2022
    Configuration menu
    Copy the full SHA
    77ab6e4 View commit details
    Browse the repository at this point in the history
  17. Remove Load() and ReloadIfChanged() from roImageStore API

    Callers should just use startReading/startWriting.
    
    Should not change behavior.
    
    Signed-off-by: Miloslav Trmač <mitr@redhat.com>
    mtrmac committed Oct 17, 2022
    Configuration menu
    Copy the full SHA
    097e954 View commit details
    Browse the repository at this point in the history
  18. Remove a redundant rwImageStore.Save() call

    rwImageStore.Create() already calls it.
    
    Signed-off-by: Miloslav Trmač <mitr@redhat.com>
    mtrmac committed Oct 17, 2022
    Configuration menu
    Copy the full SHA
    5f6642c View commit details
    Browse the repository at this point in the history
  19. Remove Save() from rwImageStore API

    It is done implicitly by all writers already.
    
    Also fix the documentation not to point at an explicit Touch(),
    which is not actually necessary.
    
    Should not change behavior.
    
    Signed-off-by: Miloslav Trmač <mitr@redhat.com>
    mtrmac committed Oct 17, 2022
    Configuration menu
    Copy the full SHA
    8af42de View commit details
    Browse the repository at this point in the history
  20. Remove Lock/Unlock methods from imageStore

    They are now only used in the constructors, so use a variant
    of startReading/startWriting instead.  This code path is not
    performance-critical, so let's share as much code as possible
    to ensure consistency in locking.
    
    Should not change behavior.
    
    Signed-off-by: Miloslav Trmač <mitr@redhat.com>
    mtrmac committed Oct 17, 2022
    Configuration menu
    Copy the full SHA
    360bfae View commit details
    Browse the repository at this point in the history
  21. Move imageStore.ReloadIfChanged

    ... to be closer to the lock / load set of methods.
    
    Only moves unchanged code, should not change behavior.
    
    Signed-off-by: Miloslav Trmač <mitr@redhat.com>
    mtrmac committed Oct 17, 2022
    Configuration menu
    Copy the full SHA
    8db2532 View commit details
    Browse the repository at this point in the history
  22. Copy methods from included interfaces directly into *LayerStore

    ... so that we can modify/replace them.
    
    Should not change behavior.
    
    Signed-off-by: Miloslav Trmač <mitr@redhat.com>
    mtrmac committed Oct 17, 2022
    Configuration menu
    Copy the full SHA
    d5b48be View commit details
    Browse the repository at this point in the history
  23. Replace layerStore.{RLock,Unlock} with {startReading,stopReading}

    This integrates ReloadIfChanged, and makes it clearer that the responsibility
    for maintaining locking details is with the layerStore; we can change it
    in a single place.
    
    Should not change behavior.
    
    Signed-off-by: Miloslav Trmač <mitr@redhat.com>
    mtrmac committed Oct 17, 2022
    Configuration menu
    Copy the full SHA
    c4089b6 View commit details
    Browse the repository at this point in the history
  24. Replace layerStore.{Lock,Unlock} with {startWriting,stopWriting}

    This integrates ReloadIfChanged, and makes it clearer that the responsibility
    for maintaining locking details is with the layerStore; we can change it
    in a single place.
    
    Should not change behavior.
    
    Signed-off-by: Miloslav Trmač <mitr@redhat.com>
    mtrmac committed Oct 17, 2022
    Configuration menu
    Copy the full SHA
    f9678cd View commit details
    Browse the repository at this point in the history
  25. Move the writing lock methods from roLayerStore to rwLayerStore

    ... for a bit of extra safety.
    
    Should not change behavior.
    
    Signed-off-by: Miloslav Trmač <mitr@redhat.com>
    mtrmac committed Oct 17, 2022
    Configuration menu
    Copy the full SHA
    c935245 View commit details
    Browse the repository at this point in the history
  26. Remove a completely unused method from roLayerStore

    Exposing the internals of the lock is not necessary, and exposes
    too many implementation details.
    
    Should not change behavior.
    
    Signed-off-by: Miloslav Trmač <mitr@redhat.com>
    mtrmac committed Oct 17, 2022
    Configuration menu
    Copy the full SHA
    124e526 View commit details
    Browse the repository at this point in the history
  27. Remove unused lockfile forwarders from roLayerStore API

    The only callers are internal, have them access r.lockfile directly.
    
    Should not change behavior.
    
    Signed-off-by: Miloslav Trmač <mitr@redhat.com>
    mtrmac committed Oct 17, 2022
    Configuration menu
    Copy the full SHA
    5791a56 View commit details
    Browse the repository at this point in the history
  28. Remove Modified() from the roLayerStore API

    It is an internal helper for ReloadIfChanged, with
    no external users.
    
    Should not change behavior.
    
    Signed-off-by: Miloslav Trmač <mitr@redhat.com>
    mtrmac committed Oct 17, 2022
    Configuration menu
    Copy the full SHA
    ee97086 View commit details
    Browse the repository at this point in the history
  29. Remove Load() and ReloadIfChanged() from roLayerStore API

    Callers should just use startReading/startWriting.
    
    Signed-off-by: Miloslav Trmač <mitr@redhat.com>
    mtrmac committed Oct 17, 2022
    Configuration menu
    Copy the full SHA
    328ccce View commit details
    Browse the repository at this point in the history
  30. Remove Save() from rwLayerStore API

    It is done implicitly by all writers already.
    
    Also fix the documentation not to point at an explicit Touch(),
    which is not actually necessary.
    
    Should not change behavior.
    
    Signed-off-by: Miloslav Trmač <mitr@redhat.com>
    mtrmac committed Oct 17, 2022
    Configuration menu
    Copy the full SHA
    d2defdb View commit details
    Browse the repository at this point in the history
  31. Remove Lock/Unlock methods from layerStore

    They are now only used in the constructors, so use a variant
    of startReading/startWriting instead.  This code path is not
    performance-critical, so let's share as much code as possible
    to ensure consistency in locking.
    
    Should not change behavior.
    
    Signed-off-by: Miloslav Trmač <mitr@redhat.com>
    mtrmac committed Oct 17, 2022
    Configuration menu
    Copy the full SHA
    dbe5fe3 View commit details
    Browse the repository at this point in the history
  32. Move layerStore.{ReloadIfChanged,Modified}

    .. to be closer to the lock / load set of methods.
    
    Only moves unchanged code, should not change behavior.
    
    Signed-off-by: Miloslav Trmač <mitr@redhat.com>
    mtrmac committed Oct 17, 2022
    Configuration menu
    Copy the full SHA
    d0ad132 View commit details
    Browse the repository at this point in the history