File Download Service

Đang mở
#24 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
25/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
rails, ruby
Lĩnh vực
api, backend

Hướng nghiên cứu

Bắt đầu bằng cách đọc config/storage.yml và config/environments/production.rb, sau đó tìm FileDownloader, ChecksumVerifier, luồng đính kèm của ActiveStorage và model TopicFile. Công việc được xem là hoàn tất khi các lượt tải xuống có thể tiếp tục từ các tệp chưa hoàn chỉnh, lỗi checksum thực hiện việc dọn dẹp và thử lại, bộ nhớ cục bộ được cấu hình để sử dụng ngoại tuyến, đồng thời các yêu cầu dọn dẹp và sao lưu của TopicFile được giải quyết.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

cross-app sync

GET /api/v1/files/{id} with resume support

  • Create FileDownloader service:
class FileDownloader
  def download(file_id, expected_checksum:, resume_from: 0)
    # Downloads to temp file
    # Supports Range header for resume
    # Returns path to downloaded file
  end
end
  • Download to temp directory (tmp/downloads/)
  • Track partial download progress for resume capability
  • Return downloaded file path for attachment

Verify downloaded files match manifest checksums

  • Create ChecksumVerifier service:
class ChecksumVerifier
  def verify!(file_path, expected_sha256)
    actual = Digest::SHA256.file(file_path).hexdigest
    expected = expected_sha256.delete_prefix("sha256:")
    raise ChecksumMismatchError unless actual == expected
  end
end
  • Consider using MD5 since active storage uses MD5 for checksums
  • Integrate verification before ActiveStorage attachment
  • On mismatch: delete file, retry download (up to 3 attempts)

Ensure proper ActiveStorage setup for offline operation

  • Verify config/storage.yml uses local disk:
    local:
    service: Disk
    root: <%= Rails.root.join("storage") %>
  • Set in config/environments/production.rb:
    config.active_storage.service = :local
  • Configure blob cleanup: old blobs purged when TopicFile destroyed
  • Add storage/ to backup strategy
Ngôn ngữ chính
HTML
Star
4
Fork
0
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của rubyforgood/skillrx-beacon

Tất cả issue của rubyforgood/skillrx-beacon

Issue tương tự

Thêm issue về Backend & API Design

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.