Skip to content

Use UUIDs for request identifiers #278

@hannahhoward

Description

@hannahhoward

What

We could unlock a number of capabilities for Graphsync and the whole transfer stack if we used UUIDs for identifiers.

Right now, we generate a ton of complexity in the data transfer stack simply tracking IDs between layers.

Going forward, we'd like graphsync to simply share an id with higher levels of the stack. Data Transfer and/or Retrieval should be able to pass an id that graphsync uses. Moreover, graphsync itself should be able to match up an incoming request with pre-existing data for higher levels of the stack (see push transfers).

RFC 4122 UUIDs have some interesting properties. They are unique not just on one system, but unique to all systems (with a non-zero but negligible chance of collision). If we used UUIDs, we could share an identifier between all layers of the transfer stack (all the way up to retrieval), and pass those around on the network.

Moreover, if an incoming Graphsync request has a UUID that matches say a previous data transfer push request, we can immediately match these two up and have them share state.

It would also unlock actually making a push mode in graphsync itself, since the id sent from another machine could be used. (this could remove the need for the data transfer libp2p protocol)

How

Potential Downsides

The wire format described will cost approximately 17 bytes on the wire (1 varint length + 16 bytes encoding).

Moreover, protobuf doesn't define a clear UUID encoding (protocolbuffers/protobuf#2224), so this requires the application developer for graphsync to know how to encode the UUID in the same manner we are.

There's a high likelyhood if we need to operate with backward compatibility for some time, there could be an interim phase of increased complexity.

Alternatives

We could put the UUIDs in an extension (no protocol change)

We could simply expand the size of request id to int64 (would at least allow us to accept data transfer channel numbers)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions