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

Interface for hypercore #7

Open
RangerMauve opened this issue Aug 10, 2020 · 0 comments
Open

Interface for hypercore #7

RangerMauve opened this issue Aug 10, 2020 · 0 comments

Comments

@RangerMauve
Copy link
Owner

It'd be cool if we could detect whether a hyper:// URL was a raw hypercore and change what the path means in that case.

Potentially, we could look at the first block in the hypercore, and if it's a hyperdrive before interpreting it as such, and if not it'll interpret it as a raw hypercore.

I think a hypercore interface would be similar to hyperdrive, but a bit more simple.

// Get a single chunk out
GET /{index} => buffer

// Append a chunk to the log
POST / {body} => 200 OK

// Get data for chunks between a range
GET /{start}...{end} => buffer

// Get the latest chunk in the hypercore
GET /head => buffer

It doesn't need a PUT or DELETE method since hypercores are immutable.

I'm not sure if there's a safe way to specify a content type since it's assumed to just be binary in hypercore unless the application already knows what it is. 🤷

In addition, I think the length should be put into the ETAG header.

I think all the extension message stuff could stay the same as in hyperdrive.

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

No branches or pull requests

1 participant