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

Rename portal_*Gossip JSON-RPC endpoint to portal_*PutContent #346

Merged
merged 5 commits into from
Dec 14, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions jsonrpc/src/content/results.json
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,8 @@
"$ref": "#/components/schemas/hexString"
}
},
"GossipResult": {
"name": "gossipResult",
"PutContentResult": {
"name": "PutContentResult",
"description": "Returns the number of peers that the content was gossiped to",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like this should also return information about whether the content was added to the database, and possibly if the data was already in the database.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Returning a boolean to indicate if the data was written to the database makes sense. This can be implemented in the same way as portal_*Store currently does. Indicating if the data was already in the database would require a second database lookup to check if the key/data exists before overwriting so I'd say we shouldn't do this for performance reasons.

"schema": {
"title": "number of peers",
Expand Down
32 changes: 19 additions & 13 deletions jsonrpc/src/methods/beacon.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
},
{
"name": "portal_beaconGetContent",
"summary": "Get content from the local database if it exists, otherwise look up the target content key in the network. After fetching from the network the content is validated and stored in the local database if storage criteria is met before being returned.",
"summary": "Get content from the local database if it exists, otherwise look up the target content key in the network. After fetching from the network the content is stored in the local database if storage criteria is met before being returned.",
"params": [
{
"$ref": "#/components/contentDescriptors/ContentKey"
Expand All @@ -143,9 +143,11 @@
"result": {
"$ref": "#/components/contentDescriptors/GetContentResult"
},
"errors":[{
"$ref": "#/components/errors/ContentNotFoundError"
}]
"errors": [
{
"$ref": "#/components/errors/ContentNotFoundError"
}
]
},
{
"name": "portal_beaconTraceGetContent",
Expand All @@ -158,9 +160,11 @@
"result": {
"$ref": "#/components/contentDescriptors/TraceGetContentResult"
},
"errors":[{
"$ref": "#/components/errors/ContentNotFoundErrorWithTrace"
}]
"errors": [
{
"$ref": "#/components/errors/ContentNotFoundErrorWithTrace"
}
]
},
{
"name": "portal_beaconStore",
Expand Down Expand Up @@ -188,13 +192,15 @@
"result": {
"$ref": "#/components/contentDescriptors/LocalContentResult"
},
"errors":[{
"$ref": "#/components/errors/ContentNotFoundError"
}]
"errors": [
{
"$ref": "#/components/errors/ContentNotFoundError"
}
]
},
{
"name": "portal_beaconGossip",
"summary": "Send the provided content item to interested peers. Clients may choose to send to some or all peers.",
"name": "portal_beaconPutContent",
"summary": "Store the content in the local database if storage criteria is met, then send the content to interested peers. Clients may choose to send to some or all peers.",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"summary": "Store the content in the local database if storage criteria is met, then send the content to interested peers. Clients may choose to send to some or all peers.",
"summary": "Store the content in the local database if storage criteria is met, then send the content to interested peers using the client's default gossip mechanisms.",

"params": [
{
"$ref": "#/components/contentDescriptors/ContentKey"
Expand All @@ -204,7 +210,7 @@
}
],
"result": {
"$ref": "#/components/contentDescriptors/GossipResult"
"$ref": "#/components/contentDescriptors/PutContentResult"
}
}
]
32 changes: 19 additions & 13 deletions jsonrpc/src/methods/history.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
},
{
"name": "portal_historyGetContent",
"summary": "Get content from the local database if it exists, otherwise look up the target content key in the network. After fetching from the network the content is validated and stored in the local database if storage criteria is met before being returned.",
"summary": "Get content from the local database if it exists, otherwise look up the target content key in the network. After fetching from the network the content is stored in the local database if storage criteria is met before being returned.",
"params": [
{
"$ref": "#/components/contentDescriptors/ContentKey"
Expand All @@ -135,9 +135,11 @@
"result": {
"$ref": "#/components/contentDescriptors/GetContentResult"
},
"errors":[{
"$ref": "#/components/errors/ContentNotFoundError"
}]
"errors": [
{
"$ref": "#/components/errors/ContentNotFoundError"
}
]
},
{
"name": "portal_historyTraceGetContent",
Expand All @@ -150,9 +152,11 @@
"result": {
"$ref": "#/components/contentDescriptors/TraceGetContentResult"
},
"errors":[{
"$ref": "#/components/errors/ContentNotFoundErrorWithTrace"
}]
"errors": [
{
"$ref": "#/components/errors/ContentNotFoundErrorWithTrace"
}
]
},
{
"name": "portal_historyStore",
Expand Down Expand Up @@ -180,13 +184,15 @@
"result": {
"$ref": "#/components/contentDescriptors/LocalContentResult"
},
"errors":[{
"$ref": "#/components/errors/ContentNotFoundError"
}]
"errors": [
{
"$ref": "#/components/errors/ContentNotFoundError"
}
]
},
{
"name": "portal_historyGossip",
"summary": "Send the provided content item to interested peers. Clients may choose to send to some or all peers.",
"name": "portal_historyPutContent",
"summary": "Store the content in the local database if storage criteria is met, then send the content to interested peers. Clients may choose to send to some or all peers.",
"params": [
{
"$ref": "#/components/contentDescriptors/ContentKey"
Expand All @@ -196,7 +202,7 @@
}
],
"result": {
"$ref": "#/components/contentDescriptors/GossipResult"
"$ref": "#/components/contentDescriptors/PutContentResult"
}
}
]
8 changes: 4 additions & 4 deletions jsonrpc/src/methods/state.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
},
{
"name": "portal_stateGetContent",
"summary": "Get content from the local database if it exists, otherwise look up the target content key in the network. After fetching from the network the content is validated and stored in the local database if storage criteria is met before being returned.",
"summary": "Get content from the local database if it exists, otherwise look up the target content key in the network. After fetching from the network the content is stored in the local database if storage criteria is met before being returned.",
"params": [
{
"$ref": "#/components/contentDescriptors/ContentKey"
Expand Down Expand Up @@ -185,8 +185,8 @@
}]
},
{
"name": "portal_stateGossip",
"summary": "Send the provided content item to interested peers. Clients may choose to send to some or all peers.",
"name": "portal_statePutContent",
"summary": "Store the content in the local database if storage criteria is met, then send the content to interested peers. Clients may choose to send to some or all peers.",
"params": [
{
"$ref": "#/components/contentDescriptors/ContentKey"
Expand All @@ -196,7 +196,7 @@
}
],
"result": {
"$ref": "#/components/contentDescriptors/GossipResult"
"$ref": "#/components/contentDescriptors/PutContentResult"
}
}
]
Loading