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

fix: ipfs dag export uses the CoreAPI and respects the offline flag #7753

Merged
merged 1 commit into from
Nov 24, 2020

Conversation

aschmahmann
Copy link
Contributor

@aschmahmann aschmahmann commented Nov 5, 2020

ipfs dag import/export were directly using the IpfsNode instead of a CoreAPI which meant that --offline doesn't "automatically" work unless we actually do some manual work inside of the code (i.e. cmdenv.GetNode(env) doesn't do anything special with the offline flag).

While we could add some magic there to make this problem less common we could also just move more towards the CoreAPI. This PR attempts that latter.

Note: Draft one has only fixed Export, still need to do Import.

cc @ribasushi

@aschmahmann aschmahmann changed the title [WIP] fix: ipfs dag export uses the CoreAPI and respects the offline flag fix: ipfs dag export uses the CoreAPI and respects the offline flag Nov 5, 2020
Comment on lines 608 to 609
if err != nil &&
!node.IsOnline &&
err == ipld.ErrNotFound {
Copy link
Member

Choose a reason for hiding this comment

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

This seems redundant.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Given that there could be more errors that have nothing to do with being offline (e.g. datastore fetching errors, context cancellations, etc.) and that this was already here doesn't seem like it hurts.

@aschmahmann aschmahmann marked this pull request as ready for review November 24, 2020 18:12
@aschmahmann
Copy link
Contributor Author

Merging since handling import is a little more in depth and we can cover it in a separate PR.

@aschmahmann aschmahmann merged commit 6e82b53 into master Nov 24, 2020
@aschmahmann aschmahmann mentioned this pull request Feb 18, 2021
73 tasks
@gammazero gammazero deleted the fix/dag-import-export-coreapi branch April 14, 2021 18:18
gammazero added a commit that referenced this pull request Aug 13, 2024
This commit introduces initial Mode and ModTime support
for single filesystem files and webfiles.

The ipfs add options --preserve-mode and --preserve-mtime are
used to store the original mode and last modified time of the
file being added, the options --mode, --mtime and --mtime-nsecs
are used to store custom values.

A custom value of 0 is a no-op.

The preserve flags and custom options are mutually exclusive,
if both are provided the custom options take precedence.

Majority of of the code was from #7754 written by kstuart

Replaces #7753

Closes #6920
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.

3 participants