Skip to content

Commit

Permalink
Cache offers in json rpc APIs.
Browse files Browse the repository at this point in the history
  • Loading branch information
bhartnett committed Nov 4, 2024
1 parent 6404565 commit a76d712
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion fluffy/rpc/rpc_portal_beacon_api.nim
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ proc installPortalBeaconApiHandlers*(rpcServer: RpcServer, p: PortalProtocol) =
contentId = p.toContentId(key).valueOr:
raise invalidKeyErr()

p.storeContent(key, contentId, contentValueBytes)
p.storeContent(key, contentId, contentValueBytes, cacheOffer = true)

rpcServer.rpc("portal_beaconLocalContent") do(contentKey: string) -> string:
let
Expand Down
2 changes: 1 addition & 1 deletion fluffy/rpc/rpc_portal_history_api.nim
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ proc installPortalHistoryApiHandlers*(rpcServer: RpcServer, p: PortalProtocol) =
contentId = p.toContentId(key).valueOr:
raise invalidKeyErr()

p.storeContent(key, contentId, contentValueBytes)
p.storeContent(key, contentId, contentValueBytes, cacheOffer = true)

rpcServer.rpc("portal_historyLocalContent") do(contentKey: string) -> string:
let
Expand Down
4 changes: 2 additions & 2 deletions fluffy/rpc/rpc_portal_state_api.nim
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ proc installPortalStateApiHandlers*(rpcServer: RpcServer, p: PortalProtocol) =
contentValue = validateOfferGetValue(Opt.none(Hash32), key, contentBytes).valueOr:
raise invalidValueErr()

p.storeContent(keyBytes, contentId, contentValue)
p.storeContent(keyBytes, contentId, contentValue, cacheOffer = true)

rpcServer.rpc("portal_stateLocalContent") do(contentKey: string) -> string:
let
Expand All @@ -159,7 +159,7 @@ proc installPortalStateApiHandlers*(rpcServer: RpcServer, p: PortalProtocol) =
contentValue = validateOfferGetValue(Opt.none(Hash32), key, contentBytes).valueOr:
raise invalidValueErr()

p.storeContent(keyBytes, contentId, contentValue)
p.storeContent(keyBytes, contentId, contentValue, cacheOffer = true)

await p.neighborhoodGossip(
Opt.none(NodeId), ContentKeysList(@[keyBytes]), @[contentBytes]
Expand Down

0 comments on commit a76d712

Please sign in to comment.