-
Notifications
You must be signed in to change notification settings - Fork 2
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
Web3.storage driver #11
Conversation
drivers/drivers.go
Outdated
@@ -43,6 +43,7 @@ type OSDriver interface { | |||
NewSession(path string) OSSession | |||
Description() string | |||
UriSchemes() []string | |||
Publish() string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could be called Flush
as well for a more common concept in I/O
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think Publish()
is more verbose, since it's explicit that it will return a publicly accessible URL.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I agree with Rafal - Flush()
has connotations of cleanup, rather than something that returns something useful
drivers/w3s.go
Outdated
|
||
func (session *W3sSession) ReadData(ctx context.Context, name string) (*FileInfoReader, error) { | ||
// not supported | ||
return nil, nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we return an error from these unsupported methods to make failures more obvious?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, good idea. I'll add an error for not implemented functions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
drivers/w3s.go
Outdated
if err != nil { | ||
return nil, err | ||
} | ||
child, err = rc.addFileToDag(ctx, child, tail, filename, fileCid) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This whole DAG logic seems quite complex! does web3.storage not provide any lib for that? kudos on figuring all of this out, if not
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They provide a lib, but unfortunately only JS. And it's not good enough to be worth running this part as a separate NodeJS binary.
Co-authored-by: Yondon Fu <[email protected]>
… it in the OS URL)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Add web3.storage driver.
fix livepeer/catalyst#375
How does it work?
SaveData()
does the following:pubId
Publish()
uploads the whole dag directory structure into web3.storage and therefore makes all the HLS manifest files usable.Additional comments
ipfs-car --pack
- it archives any file into a CAR file, I think that technically we could do the same using Golang andgo-car
library, but I think it may be more work and it may be more error-prone, since big files are actually sharded in the IPFS structuresw3 can store add
- it uploads a CAR into web3.storagew3 can upload add
- it binds together a number of CARs and publishes their root with the public URLkey
andproof
variables are not used right now; in this PR the localw3
credentials are used.Publish()
step,the each subdirectory is uploaded as a separate CAR; technically, we should not need it, we should just create one CAR with the whole subdirectories and upload it. However, currently theUPDATE:go-car
library fails for these scenarios, so that's the workaround. Here's the go-car PR which fixes the issue: Allow using WalkOption in WriteCar function ipld/go-car#357go-car
merged my PR, so we there is no longer need to create each subdirectory separately. Updated the PR.