-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Is possible to find out new added block numbers into local repo after each “ipfs add file”? #5826
Comments
Hey @avatar-lavventura - thanks for the feature request. Can you clarify a bit what you're trying to achieve? Are you specifically interested in the number of blocks added? Or are you more interested in how much total new data was added to the repo for a specific I think you are right; I don't think there's any way to do either (meaning added blocks or added data size) right now (someone please correct me if I'm wrong). If you could provide additional information about how this data is useful to you that would be great for helping us learn about how people use ipfs. |
@eingenito is right. There's no way to do this right now. Unfortunately, I'm not sure if there is a way to implement this without some pretty invasive changes to some internal APIs. |
The easiest way to do this would be on the blockstore layer, since this is where we check if blocks already exist - https://github.com/ipfs/go-ipfs-blockstore/blob/master/blockstore.go#L148 - but it will be fairly hard to wrap in a way we would need in |
@magik6k the issue is that that's racy (the same race OP is trying to avoid). To do this reliably, we'd effectively need to turn "add" into an atomic "check and add" (which isn't going to be free). |
We already check if
|
Yeah, you're right. We could do that. We could even use a Personally, I'd expose those results via a channel registered with the context, the way we do with DHT queries. |
I am using Based on the size of the transmitted data (communication usage) and size of the new added data to the repo (cache usage), I will charge user for their communication and cache usage using a smart contract. Example: user_A:
cluster_B:
// Here I assume that transmitted data size should be 2 GB and repo size should be increase for 2 GB. So communication and cache cost will be for 2 GB. Step 2: user_A:
cluster_B:
// Here as I understand from the answer of a question I asked before, if the data is already stored it does not re-downloaded again.
Since the data is already cached on the repo, |
@Stebalien, @magik6k : I was wondering is there any update on this feature request. |
No. Unfortunately, this really isn't a high priority issue. If you'd like to see it happen, you'll probably need to implement it yourself. |
=> Could you please guide me a point to implement it? |
The IPFS team is open to feature requests and discussions. I'm just setting expectations and stating that the core IPFS team won't have time to design or implement this feature. There's a good starting point here: #5826 (comment). Unfortunately, I can't give you much more guidance without digging through the code myself. |
Its easy to say that we don't have time but it would be more honest to say that |
I'm having trouble parsing your statement but yes, we don't have capacity (people-time). |
$ ipfs version --all
go-ipfs version: 0.4.17-
Repo version: 7
System version: 386/linux
Golang version: go1.10.3
I would like to find new added block numbers into local repo, after each
ipfs add file
. This could be reported after eachipfs add
is done on the output of the results.First time if I do
ipfs add file
transferred data size should be hash object's original size. But later when I doipfs add file
with the same hash, since the object blocks are already cached it should be 0, where added block number will be 0 as well. Is it possible to find out that?[Q] Is it possible to find out added block number into repo after each
ipfs add file
operation? From the block number I guess I can obtain the total size of blocks added into local repo.Please note that I can do
ipfs repo stat
before and afteripfs add file
to observe change onRepoSize
. But if there is anotheripfs add
processing in parallel on the background,ipfs repo stat
will not work, where it will affected from both parallel runningipfs add
operations. So it will be efficient to provide output for eachipfs add
to see new added blocks into the local repo.The text was updated successfully, but these errors were encountered: