• Micaël Bergeron's avatar
    Refactor the uploaders · 594e6a0a
    Micaël Bergeron authored
    I've demoted the ObjectStoreUploader to a concern that is mixed in
    the concrete uploader classes that need to store files in a remote
    object store.
    
    I've been working on making the local -> remote migration working
    first, which has been trivial compared to the remote -> local one.
    
    The current implementation is heavily based on side-effects which
    makes the code brittle and hard to reason about.
    
    The current approach is to store the `store` field in the correct
    `Upload` model once a migration has been done. To retrieve the field
    I use the `has_many :uploads` relationship, with all the paths that
    a certain file may have `uploads.where(path: paths).last`. This as
    the drawback of adding a database query for every upload lookup, but
    I feel that the generalization of this behavior is worth it. We should
    be able to optimize this down the road quite easily.
    594e6a0a
upload_checksum_worker.rb 305 Bytes