Skip to content

File interface #2005

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

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open

File interface #2005

wants to merge 13 commits into from

Conversation

jmthomas
Copy link
Member

@jmthomas jmthomas commented Apr 5, 2025

No description provided.

Copy link

codecov bot commented Apr 5, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 77.06%. Comparing base (805f3b0) to head (6efeb76).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2005      +/-   ##
==========================================
+ Coverage   76.87%   77.06%   +0.19%     
==========================================
  Files         638      640       +2     
  Lines       47462    47765     +303     
  Branches      754      754              
==========================================
+ Hits        36486    36811     +325     
+ Misses      10893    10871      -22     
  Partials       83       83              
Flag Coverage Δ
python 84.22% <ø> (+0.22%) ⬆️
ruby-api 48.30% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@@ -309,7 +312,7 @@ def handle_received_time_extra_and_data(entry, time_nsec_since_epoch, includes_r
if cbor
extra = CBOR.decode(extra_encoded)
else
extra = JSON.parse(extra_encode, allow_nan: true, create_additions: true)
extra = JSON.parse(extra_encoded, allow_nan: true, create_additions: true)
Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure how we didn't stumble across this bug before

@file = string_io
else
@file = BufferedFile.open(@filename, 'rb')
end
Copy link
Member Author

Choose a reason for hiding this comment

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

Treating the file as a StringIO made all this work as is

@data.replace(@data[@extra[:size]..-1])
@reduction_state = :START
end
end
Copy link
Member Author

Choose a reason for hiding this comment

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

This is the magic @extra that allows this to work across multiple files

if data and data.length > 0
read_interface_base(data, nil)
return data, nil
return data, { filename: @filename, size: data.length }
Copy link
Member Author

@jmthomas jmthomas Apr 7, 2025

Choose a reason for hiding this comment

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

This allows the protocol to know when a file is opened

@reduction_state = :FLAGS_REMOVED
end

if @reduction_state == :FLAGS_REMOVED or (@reduction_state == :SYNC_REMOVED and @mode != 4)
if @reduction_state == :FLAGS_REMOVED
Copy link
Member Author

Choose a reason for hiding this comment

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

I removed references to modes (versions) before COSMOS 4

@jmthomas jmthomas marked this pull request as ready for review April 7, 2025 20:57
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.

2 participants