0
0
mirror of https://github.com/tursodatabase/libsql.git synced 2024-12-16 13:48:52 +00:00
libsql/libsql-storage/proto/storage.proto
Avinash Sajjanshetty d765413f5f
Refactor and update storage server proto (#1457)
* Update proto to send `max_frame_no` while inserting frames

We plan to allow multiple (non concurrent) writers. If a transaction's
`max_frame_no` does not match the server's `max_frame_no`, then it
has missed some new writes and we can abort the transaction

* Updates storage trait's insert_frames definition

- Change parameter type `FrameData` to `Frame` from rpc def, to
  avoid unnecessary copying
- Take `max_frame_no` param

* Use `insert_frames` method

* cleanup: remove `insert_frame` method and impl

* Remove `FrameData`, use `Frame` from proto instead
2024-06-10 07:33:53 +00:00

79 lines
1.4 KiB
Protocol Buffer

syntax = "proto3";
package storage;
message Frame {
uint32 page_no = 1;
bytes data = 2;
}
message InsertFramesRequest {
string namespace = 1;
repeated Frame frames = 2;
uint64 max_frame_no = 3;
}
message InsertFramesResponse {
uint32 num_frames = 1;
}
message FindFrameRequest {
string namespace = 1;
uint32 page_no = 2;
uint64 max_frame_no = 3;
}
message FindFrameResponse {
optional uint64 frame_no = 1;
}
message ReadFrameRequest {
string namespace = 1;
uint64 frame_no = 2;
}
message ReadFrameResponse {
optional bytes frame = 1;
}
message DbSizeRequest {
string namespace = 1;
}
message DbSizeResponse {
uint64 size = 1;
}
message FramesInWALRequest {
string namespace = 1;
}
message FramesInWALResponse {
uint64 count = 1;
}
message FramePageNumRequest {
string namespace = 1;
uint64 frame_no = 2;
}
message FramePageNumResponse {
uint32 page_no = 1;
}
message DestroyRequest {
string namespace = 1;
}
message DestroyResponse {}
service Storage {
rpc InsertFrames(InsertFramesRequest) returns (InsertFramesResponse) {}
rpc FindFrame(FindFrameRequest) returns (FindFrameResponse) {}
rpc ReadFrame(ReadFrameRequest) returns (ReadFrameResponse) {}
rpc DbSize(DbSizeRequest) returns (DbSizeResponse) {}
rpc FramesInWAL(FramesInWALRequest) returns (FramesInWALResponse) {}
rpc FramePageNum(FramePageNumRequest) returns (FramePageNumResponse) {}
rpc Destroy(DestroyRequest) returns (DestroyResponse) {}
}