-
Notifications
You must be signed in to change notification settings - Fork 30
Pinning Service API #378
Comments
It would be very helpful for ipfs-deploy if pinning services had a common API. My impression is that this was going to be sort of standardized by https://github.com/ipfs-shipyard/cube, but I don't know what's the status on that project. |
@agentofuser Yes, The Cube project is building a pinning service that is easy to deploy for you and your friends/family. It has it's own pinning service API definition and is another potential adopter of this common API. |
Sidenote: Utilizing DID in the security/user-id component of the API would be ideal. |
➡️ a huge 👍 to this in general ➡️ a lot of object store services to date have taken to being S3 api compatible, we probably can't follow this 1:1 but I wonder if being nearly-compatible or at least inspired by would help folks migrate? in particular, stuff like legal holds probably encodes enough real-world experience to be worth looking at ➡️ this may be out of scope for this issue, but an alternate "API" I envision is a "re-pin everything I pin" service: one way this could work would be following a pubsub channel that announces new items |
This is something that Cluster is looking to provide but it is beyond what I envision being provided by a straight IPFS pinning service. It also has a lot of technical and security challenges.
Not opposed to this idea, I would still want to define this API as a way of clarifying the language around what pinning is and its different forms/options so that developers in the IPFS world have a common language to talk about it with. |
Having started to work with gRPC more, I think if the idea is to have a unified pinning service API that can be implemented across multiple providers, gRPC is a must have for a few reasons:
These are my initial thoughts for now, however if I have more i'll update this post. |
@postables I agree that gRPC would be awesome and it does seem to be coming along in this space, see Improbable's grpc-web blog post and gRPC's web protocol. My biggest issue with gRPC is that they don't allow for custom transports yet™. Did you have any thoughts on the actual API defined here: https://app.swaggerhub.com/apis/lanzafame/ipfs-pinning-service/v0.0.0? In terms of usability? or how it integrates with your payment system? or the use of JWT to identify who pinned a cid? |
my $0.02: broadly speaking, I'm hugely in favor of well-defined, testable, and documented APIs that 3rd parties can implement however, gRPC/protobuf might be excessive for an API of limited complexity, small message size (aside from files themselves), and relatively low throughput requirements you can still get the validation upside just by using swagger, and the logic duplication is pretty mild for an API of this cale |
@lanzafame Thanks for the links i'll check them out. As for initial thoughts on the API that's define so far, it looks quite nice, and would be pretty easy to integrate with as is. The JWT in my system uses Additionally I believe some other blockchain based authentication systems also use JWTs sousing JWT's in general is a good idea, as it helps encourage interoperability with different types of auth systems. As for the payment system, my only suggestion would be to add The other suggestions I have are:
Those minor nits aside, this is off to a great start already 👌 @parkan That's a valid point and I suppose if the API never goes beyond it's current scope in functionality gRPC/protobuf would definitely be excessive |
@postables I have updated the API with your corrections and suggestions, thanks.
|
Excellent 👌 thanks for implementing the suggestions, I think this gives a lot of room for overlaying this API ontop of existing implementations different service providers have. |
Grpc using multiple transports is not ready and I suspect will come out around the same time a the final RFC for http/3 which is July. So one month. I the meantime you can use grpc and convert it forward and back at design time using gnostic. So you can define thing in grpc and share the API to non golang projects over openapi. Those users can then gen a proxy client from the openapi spec into whatever language they are using. The last bit is data validation. Open api is rich and uses JSON schema. So the client can do client side validation. I think gnostic supports translation of grpc data validation but not sure since I was last using it. Grpc over quic ( uni- directional ) and grpc over webrtc ) bi directional ) will make things very easy. Pions have a great webrtc golang stack now with good momentum. Ultimately grpc generators that support these new transports for other languages will be years away. Just how it is Quic and Webrtc are both likely to get browser full support do that client will be in good shape. |
@lanzafame As mentioned via email, I'm happy to get started on an open-source implementation of the Pinning Service API, and implement it within Temporal. However before I get started it's probably best worth deciding on how it gets implemented. Since there isn't any consensus yet on whether or not to implement gRPC, I'm wondering if its best to start implementing the API using go-chi/chi. Although the nice thing with gRPC is we can actually tackle both a gRPC, and HTTP implementation of the Pinning Service API using https://github.com/grpc-ecosystem/grpc-gateway. |
@postables that is awesome! thanks very much. I think the interface should be defined in HTTP terms for now as not everyone supports communicating via gRPC on the server side, i.e. HTTP proxy<->gRPC service. So if Temporal supports gRPC, which I believe it does, you are free to use grpc-gateway, as long as the HTTP API that it produces is compatible with the swagger spec. This way we can move forward with this now and then once gRPC gets native support for other transports, we can reassess and go with gRPC in the future. Also, I was just looking at the openid spec and it has a standard claim for the user id so I will be updating |
I've just seen your lighting talk from IPFS camp 2019 and you have a perfect idea that could rise more pinning services around! Looking forward :) |
@lanzafame Awesome, I'm about 90% certain that it should be possible to craft gRPC code that will result in an identicile HTTP API spec. If not then I'll just stick to HTTP API with |
@postables I have updated the API spec with the changes to JWT claims as mentioned above: https://app.swaggerhub.com/apis/lanzafame/ipfs-pinning-service/0.0.1. |
Perfect that is very helpful. I have one thing I wanted to mention, while exploring code generation capabilities using Now I can quite easily change this to a different API path by altering the Should we keep with the |
I have added a second entry to the |
I noticed another weird thing with how the package api
type Cid struct {
_ string `json:"/,omitempty"`
} Here is the openapi type definitions
It appears that for some reason the properties of the For the metadata type definitions, they get generated with names:
Update: Yup the name of the var request models.Pin
if err := c.BindJSON(&request); err != nil {
// if this fails, it means the user sent an invalid request
// and we were unable to bind to the Pin model correctly
a.handleError(c, http.StatusBadRequest, err.Error())
return
}
request.Cid. // we can't access the element, element, because it is named _ and therefore unexported (this is only a problem if the models are stored in another "package" which I'm currently doing) |
Hey all! Apologies for being so late to hop into this thread. Great idea @lanzafame. I like the idea of having some sort of standard API that all pinning services can adhere to. That being said it will probably take some time to get right as pinning services are still evolving to meet the changing needs of users. A couple of initial thoughts:
|
@obo20 Thanks for taking a look.
I am happy to include an
My main aim with the options I have left is to allow the user to decide exactly how the DAG is structured if they wish. Essentially, they should be able to know how to add the file/directory on their machine and get the same CID. As for the payment side of things, the only strategy that you mentioned that has an impact is the Credits system as it requires a duration and I can't think of a nice way to get around that. Any thoughts? |
@postables Sorry, I have been on holidays the last few weeks and am just catching up with everything. How do you think it would be best to resolve the Cid issue, I wrote the swagger spec from the JSON output perspective but if that isn't generating the correct code, then I am happy to correct it. |
IPFS GUI Team is looking into adding native Pinning Services support to ipfs-webui / ipfs-desktop and ipfs-companion in Q3. @lanzafame what is the latest status of the Pinning API spec? Is the swagger prototype prefered form? Is there a repo where we can PR changes to the swagger prototype? The timeline is pretty aggressive and we'd like to finalize the spec in next 2-3 weeks (provide feedback and invite stakeholders |
@lidel ipfs-shipyard would be an excellent place to continue this conversation and iteration. There isn't currently a repo so just copy across the spec from swagger hub and continue. As for the latest status, I am not quite sure other than what is here, there has been a lot of discussion around it that I have not been able to keep up with due to life intervening. |
Imports initial API definition from ipfs/notes#378 (comment) License: MIT Signed-off-by: Marcin Rataj <lidel@lidel.org>
Imports initial API definition from ipfs/notes#378 (comment) Co-authored-by: lanzafame <adrianlanzafame92@gmail.com>
Ok, let's continue in https://github.com/ipfs/pinning-services-api-spec @lanzafame mind closing this issue? |
Imports initial API definition from ipfs/notes#378 (comment) Co-authored-by: lanzafame <adrianlanzafame92@gmail.com>
A Pinning Service is a service that accepts hashes from a user and will host the associated hash, i.e. Pinata, Infura, et al.
The rationale behind defining a pinning service API is to have a baseline functionality and interface that can be provided by these services so that tools can be built on top of a common base of functionality.
Draft pinning service api: https://app.swaggerhub.com/apis/lanzafame/ipfs-pinning-service/v0.0.0Latest draft: https://app.swaggerhub.com/apis/lanzafame/ipfs-pinning-service/0.0.1
//cc @obo20 @MichaelMure
Anyone who knows someone running an IPFS pinning service, please tag them here, thanks. @parkan
The text was updated successfully, but these errors were encountered: