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

Save advertisements as CAR files #1210

Merged
merged 18 commits into from
Feb 9, 2023
Merged

Save advertisements as CAR files #1210

merged 18 commits into from
Feb 9, 2023

Conversation

gammazero
Copy link
Collaborator

When configured to save advertisements, save advertisements and entries from the datastore as CAR files in the configured directory. The advertisement and its entries are removed from the datastore after they are saved as a CAR file.

If there are existing advertisements saved in the datastore, on startup, save these as CAR files and remove them from the datastore.

Advertisements are not saved when the indexer is frozen.

  • Fetching advertisements and entries from another indexer, or mirror location, will be implemented in a subsequent PR.
  • Saving advertisement CAR files to S3 (or other locations) will be done in a subsequent PR.

@willscott willscott requested a review from masih February 1, 2023 14:48
@codecov-commenter
Copy link

codecov-commenter commented Feb 1, 2023

Codecov Report

Base: 54.31% // Head: 54.35% // Increases project coverage by +0.03% 🎉

Coverage data is based on head (87e043b) compared to base (d574887).
Patch coverage: 58.30% of modified lines in pull request are covered.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1210      +/-   ##
==========================================
+ Coverage   54.31%   54.35%   +0.03%     
==========================================
  Files         151      154       +3     
  Lines       15028    15606     +578     
==========================================
+ Hits         8163     8482     +319     
- Misses       5964     6162     +198     
- Partials      901      962      +61     
Impacted Files Coverage Δ
config/ingest.go 36.53% <ø> (ø)
internal/ingest/ingest.go 67.66% <27.27%> (-1.76%) ⬇️
internal/carwriter/carwriter.go 44.65% <44.65%> (ø)
internal/filestore/filestore.go 66.66% <66.66%> (ø)
internal/filestore/local.go 68.11% <68.11%> (ø)
internal/filestore/s3.go 76.47% <76.47%> (ø)
internal/ingest/linksystem.go 72.72% <100.00%> (ø)
dagsync/p2p/protocol/head/head.go 72.41% <0.00%> (-5.75%) ⬇️
dagsync/dtsync/sync.go 70.22% <0.00%> (-2.25%) ⬇️
... and 2 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

config/ingest.go Outdated Show resolved Hide resolved
config/ingest.go Outdated Show resolved Hide resolved
internal/carwriter/carwriter.go Outdated Show resolved Hide resolved
When configured to save advertisements, save advertisements and entries from the datastore as CAR files in the configured directory. The advertisement and its entries are removed from the datastore after they are saved as a CAR file.

If there are existing advertisements saved in the datastore, on startup, save these as CAR files and remove them from the datastore.

Advertisements are not saved when the indexer is frozen.
…ies CAR

- The CarWriter uses a filestore.Interface to seemlessly support different file store implementations (local filesystem, S3, etc.).
- Separate advertisements and entries into separate CAR files. This allows loading advertisements withing having to load the links, and is useful when an loading ad advertisement whose entries have already been deleted.
- Remove _adv and _mhs file suffixes.
- Add option to overwrite S3 endpoint.
@gammazero gammazero merged commit 2affa9d into main Feb 9, 2023
@gammazero gammazero deleted the save-ad-as-car branch February 9, 2023 17:01
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.

None yet

4 participants