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

cold_data: Store multiple uri for a single file. #137

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

cold_data: Store multiple uri for a single file. #137

wants to merge 1 commit into from

Conversation

psaiz
Copy link
Contributor

@psaiz psaiz commented Jan 30, 2025

Adding a new class inheriting from FileObject that allows two urls for an entry. It also calculates the availability of a file (depending if the hot url has a value`), and for a record, which goes through all the files in that record.

The availability for a record is defined with the following formula:

If the record has no files, and it has the field 'distribution.availability':
    avl = record.distribution.availability #At the moment, this is used for ondemand
if the record has files:
   if all the files are in the same state:
       avl = record.file[0].availability. # If all the files are online, or all ondemand
   else
      avl = 'sample files'

@psaiz psaiz requested a review from zzacharo January 30, 2025 17:24
@psaiz psaiz force-pushed the cold branch 2 times, most recently from e59ea41 to ca99478 Compare January 31, 2025 10:08
@psaiz psaiz mentioned this pull request Feb 3, 2025
f.delete()
elif "type" in file and file["type"] == "index.txt":
# The txt indexes should be ignored. Just delete the file
f.delete()
else:
real_files.append(file)
try:
obj = ObjectVersion.create(record.bucket, filename, _file_id=f.id)
obj = FileObjectCold.create(record.bucket, filename, f.id)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From #138

Suggested change
obj = FileObjectCold.create(record.bucket, filename, f.id)
obj = FileObjectCold.create_version(record.bucket, filename, f.id)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant