streamingfast / substreams-sink-kv

Substreams KV sink
Apache License 2.0
2 stars 5 forks source link

Implement WASM query layer #9

Closed abourget closed 1 year ago

abourget commented 1 year ago

This is the design for a WASM query layer

It starts from the expriment branch feature/dynamic-grpc-test-dont-merge from substreams. Here: https://github.com/streamingfast/substreams/compare/develop...feature/dynamic-grpc-test-dont-merge

Second stage:

Third stage:


Protobuf definition for sf/substreams/sink/kv/v1/services.proto:


// This defines a KV Sink to be queried with a generic key access interface (Get, GetMany, Scan, Prefix calls).
message sf.substreams.sink.kv.v1.GenericService {
}

// This defines configuration to run a WASM query service on top of the KV store being sync'd.
message sf.susbtreams.sink.kv.v1.WASMQueryService  {
  int64 start_block = 1;
  // wasm exports: "kv_get_batch", "kv_get", "kv_scan", "kv_prefix"
  bytes wasm_query_module = 5;
  // Fully qualified Protobuf Service definition name
  string grpc_service = 2; // sf.mycustom.v1.MyService
}