Skip to content

Convert Cancel/Update on graphsync request to single RequestType #345

Closed
@hannahhoward

Description

@hannahhoward

Goals

Right now, a graphsync request has two bools -- cancel & update. Really, it has three modes:

  • cancel = false, update = false -> new request
  • cancel = true, update = false -> cancel request
  • cancel = false, update = true -> update request
  • cancel = true, update = true -> ????? undefined behavior

In the new protocol, it should be a single request type, especially since we may want to add more (in the future

Implementation

type GraphSyncRequestType enum {
   # New means a new request
   | New             ("n")
   # Cancel means cancel the request referenced by request ID
   | Cancel   ("c")
   # Update means the extensions contain an update about this request
   | Update             ("u")
   # Restart means restart this request from the begging, respecting the any DoNotSendCids/DoNotSendBlocks contained
   # in the extensions -- essentially a cancel followed by a new
   # | Restart ("r")
} representation string

type GraphSyncRequest struct {
  id                GraphSyncRequestID  (rename "ID")   # unique id set on the requester side
  root     optional Link                (rename "Root") # a CID for the root node in the query
  selector optional Any                 (rename "Sel")  # see https://github.com/ipld/specs/blob/master/selectors/selectors.md
  extensions        GraphSyncExtensions (rename "Ext")  # side channel information
  priority          GraphSyncPriority   (rename "Pri")  # the priority (normalized). default to 1
  requestType GraphSyncRequestType (rename "Typ") # the request type
} representation map

I put restart in as an example but it's left out intentionally for implementing first version

Hopefully the conversion is fairly clear based on the table above. I honestly don't know what we should do with the undefeined behavior for old messages where cancel + update are both true -- maybe just drop the message entirely? I have no idea what we're doing now but no implementation of graphsync should be doing this.

Metadata

Metadata

Assignees

Labels

need/triageNeeds initial labeling and prioritization

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions