-
Notifications
You must be signed in to change notification settings - Fork 44
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 a ReadWrite blockstore without knowing the root Cid #395
Comments
I think this is used when opening a new file, because it needs to write the header and so needs to select what root goes into the header |
Yeah, this has bothered me slightly about the blockstore mechanics—when you reopen a CAR, the root must match, under the concept of a validating a "resume". But there's plenty of cases where you just don't care or it would be more convenient to just skip that form of validation. I ended up copying the same behaviour in The other property that is matched during a resume is the data padding ( So, I think it'd be reasonable to add an option to skip validation of these things; Alternatively we could actually rewrite roots if they provide a different set of roots and they take up the same amount of space. But then you have to account for the case where they don't want to rewrite, they just want to skip validation and you also need to make the user aware that they will get an error if the new header length doesn't match, (or doesn't fit in to the padded space available—you could take advantage of non-zero padding in the case of a different sized header and calculate a new DataOffset if you have to consume some of it). |
Not sure that makes sense, but what about flipping that entirely, and have options to enable validation ( There is also a need for a way to changes the roots (append and/or replace). |
So this is the problem I'm trying to avoid. I don't really want to bump to a /v3 if we can help it. I'm happy to queue up breaking changes in some branch we shunt to the side and defer that until we have enough of them to warrant it, but major version bumps are annoying enough in Go that I wouldn't do it as flippantly as I do in JS, particularly in this repo where we already have the confusion of a |
@MichaelMure fwiw I'm happy for you to proceed with this, but I'd really prefer to not introduce a breaking change - either introducing a new constructor or having an opt-out option (that takes a bool so we could potentially use it to flip the behaviour in a future breaking release) seem to be the ideal path here. I don't think this is something that's going to be on a backlog for someone else to do unless it ends up getting in our way. I'm mostly using the storage/ interface for what I'm doing so I tend to bump into things there more than in blockstore/. |
@MichaelMure : is this something you want to pursue? |
@BigLep I don't think I need that in the short term, so likely no. It's also likely that this will come back to haunt me at some point. |
It'll haunt one of us, so whoever it haunts first can come back and address it! Marking as a P2 for now, it can sit in our backlog. |
Kinda connected to #196
It's quite odd to me that
OpenReadWrite()
require passing the expected root, while that information is in the file header. This prevent from simply opening the file and accessing the roots.Is there a reason for this?
The text was updated successfully, but these errors were encountered: