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

option to enable automatically pin file when upload #2116

Open
trim21 opened this issue Jun 2, 2023 · 13 comments
Open

option to enable automatically pin file when upload #2116

trim21 opened this issue Jun 2, 2023 · 13 comments
Labels
effort/hours Estimated to take one or several hours kind/discussion Topical discussion; usually not changes to codebase kind/enhancement A net-new feature or improvement to an existing feature kind/maintenance Work required to avoid breaking changes or harm to project's status quo kind/support A question or request for support need/author-input Needs input from the original author need/maintainer-input Needs input from the current maintainer(s) P3 Low: Not priority right now

Comments

@trim21
Copy link

trim21 commented Jun 2, 2023

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

this would behavior like ipfs cli ipfs add --pin=true ...

current file uploaded by webui doesn't get pinned, behavoir like ipfs add --pin=false ..., so I need to pin them manually.

I hope we can add a option/flag to make uploaded file automatily pinned, just like ipfs add --pin=true ...

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

@trim21 trim21 added the need/triage Needs initial labeling and prioritization label Jun 2, 2023
@welcome
Copy link

welcome bot commented Jun 2, 2023

Thank you for submitting your first issue to this repository! A maintainer will be here shortly to triage and review.
In the meantime, please double-check that you have provided all the necessary information to make this process easy! Any information that can help save additional round trips is useful! We currently aim to give initial feedback within two business days. If this does not happen, feel free to leave a comment.
Please keep an eye on how this issue will be labeled, as labels give an overview of priorities, assignments and additional actions requested by the maintainers:

  • "Priority" labels will show how urgent this is for the team.
  • "Status" labels will show if this is ready to be worked on, blocked, or in progress.
  • "Need" labels will indicate if additional input or analysis is required.

Finally, remember to use https://discuss.ipfs.io if you just need general support.

@trim21 trim21 changed the title automatically pin file when upload option to enable automatically pin file when upload Jun 2, 2023
@whizzzkid
Copy link
Contributor

Thanks for submitting this issue @trim21, is the ask here to have a global option to always "pin" files?

Maybe @lidel or @hacdias can elaborate more on this, there seems to be some discussion in this issue: ipfs/ipfs-gui#10 (comment) which seems to indicate that files imported are already implicitly pinned (maybe I'm wrong), I think if that's true, the "pin" feature should just be removed.

@whizzzkid whizzzkid added kind/discussion Topical discussion; usually not changes to codebase kind/enhancement A net-new feature or improvement to an existing feature kind/maintenance Work required to avoid breaking changes or harm to project's status quo need/author-input Needs input from the original author kind/support A question or request for support need/maintainer-input Needs input from the current maintainer(s) P3 Low: Not priority right now effort/hours Estimated to take one or several hours and removed need/triage Needs initial labeling and prioritization labels Jun 6, 2023
@trim21
Copy link
Author

trim21 commented Jun 6, 2023

is the ask here to have a global option to always "pin" files?

yes, option to pin new files when they are uploaded

I think if that's true, the "pin" feature should just be removed.

Then how do users make sure their files won't get GC-ed...

@whizzzkid
Copy link
Contributor

@trim21, just wondering if you have been facing loss of data? A simple way to achieve this could be adding a root folder which has the pin enabled, then adding everything you want pinned in that root folder.

Will that work?

@trim21
Copy link
Author

trim21 commented Jun 15, 2023

just wondering if you have been facing loss of data?

no, I always manully pin them.

A simple way to achieve this could be adding a root folder which has the pin enabled, then adding everything you want pinned in that root folder.

This look a good solution.

So are all files in that folder will get pinned, and when I remove them, they will get GC-ed?

@whizzzkid
Copy link
Contributor

@trim21 that is correct, if that's not the behaviour you experience. I'd like you to share your findings, that'll be a bug in the current implementation and that can be prioritized.

@trim21
Copy link
Author

trim21 commented Jun 22, 2023

Thanks, this's the behaviour I want

@whizzzkid
Copy link
Contributor

Closing this issue as fixed, please feel free to reopen or submit a new issue if you face this again!

@trim21
Copy link
Author

trim21 commented Jul 23, 2023

After some time, I find this is not a valid solution...

If you pin a directory with 2 files, and you upload a new file, the cid of directory will changed, the directory and newly uploaded file are not automatically pin-ed

@trim21
Copy link
Author

trim21 commented Jul 23, 2023

For example, I have a directory called images, it now have 2 files, 1.jpg and 2.jpg

and I can pin directory images, I'm actually pinning cid1, for example QmWVi3AM6mzfCD8gdVLfyuM6QJEzEbq1b34dkSwRsMuE2K
image

But when I upload a new image, the content of directory changed, therefore the cid of directory also changed, and the new directory(which has the same name) is not pinned anymore, which mean I have to pin this directory again.

image

And when I pin it, I'm actually pinning cid2, for example Qmf4KCLrm2SCzCFkxFUt6c5QzNAW63W2xf6ghEj432XSrg

(funny enough, when I remove the newly added file, I can see the directory is pinned again)

So the suggestion doesn't fix this issue, I still have to pin the file I uploaded.

@trim21
Copy link
Author

trim21 commented Jul 23, 2023

@whizzzkid can you re-open this issue?

@whizzzkid
Copy link
Contributor

@trim21 ok yes I see what you mean, apologies, reopening this issue.

@whizzzkid whizzzkid reopened this Jul 26, 2023
@MidnightLightning
Copy link

I ran across this situation for my use-case too. In general a node keeps the items in the "files" area from being garbage-collected, but for different configurations of "Reprovider > Strategy", there is a setting for "pinned" but not for "in files", so having content be not just "in the local files directory" but actively pinned is important. Having the "pin" action in the "files" area not adjust when a file is uploaded then causes "orphaned pins" to exist (the previous CID of the folder is still pinned, when a new file is uploaded to it, and there's no way to browse/find that pin again in the UI without reverting the change to the folder in "Files").

I'd be in favor of the logic changing to:

In the "Files" section of the web UI, whenever a new file is added, a background process walks the file tree upward, looking at all the folders that it's contained in. If any of the folders are currently pinned, delete the existing pin and pin the new CID of the updated folder structure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort/hours Estimated to take one or several hours kind/discussion Topical discussion; usually not changes to codebase kind/enhancement A net-new feature or improvement to an existing feature kind/maintenance Work required to avoid breaking changes or harm to project's status quo kind/support A question or request for support need/author-input Needs input from the original author need/maintainer-input Needs input from the current maintainer(s) P3 Low: Not priority right now
Projects
No open projects
Status: Needs Grooming
Development

No branches or pull requests

3 participants