Skip to content
This repository was archived by the owner on Oct 18, 2023. It is now read-only.

Commit 5fc49e1

Browse files
committed
implement sqld programs
1 parent f9a70c9 commit 5fc49e1

File tree

22 files changed

+753
-477
lines changed

22 files changed

+753
-477
lines changed

sqld/proto/proxy.proto

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,10 @@ message Column {
7575
}
7676

7777
message DisconnectMessage {
78-
bytes clientId = 1;
78+
string clientId = 1;
7979
}
8080

81-
message Ack {}
81+
message Ack { }
8282

8383
message ExecuteResults {
8484
repeated QueryResult results = 1;
@@ -91,7 +91,51 @@ message ExecuteResults {
9191
State state = 2;
9292
}
9393

94+
message Program {
95+
repeated Step steps = 1;
96+
}
97+
98+
message Step {
99+
optional Cond cond = 1;
100+
Query query = 2;
101+
}
102+
103+
message Cond {
104+
oneof cond {
105+
OkCond ok = 1;
106+
ErrCond err = 2;
107+
NotCond not = 3;
108+
AndCond and = 4;
109+
OrCond or = 5;
110+
}
111+
}
112+
113+
message OkCond {
114+
int64 step = 1;
115+
}
116+
117+
message ErrCond {
118+
int64 step = 1;
119+
}
120+
121+
message NotCond {
122+
Cond cond = 1;
123+
}
124+
125+
message AndCond {
126+
repeated Cond conds = 1;
127+
}
128+
129+
message OrCond {
130+
repeated Cond conds = 1;
131+
}
132+
133+
message ProgramReq {
134+
string client_id = 1;
135+
Program pgm = 2;
136+
}
137+
94138
service Proxy {
95-
rpc Execute(Queries) returns (ExecuteResults) {}
139+
rpc Execute(ProgramReq) returns (ExecuteResults) {}
96140
rpc Disconnect(DisconnectMessage) returns (Ack) {}
97141
}

sqld/src/batch/mod.rs

Lines changed: 0 additions & 101 deletions
This file was deleted.

sqld/src/batch/proto.rs

Lines changed: 0 additions & 132 deletions
This file was deleted.

sqld/src/database/dump_loader.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ impl DumpLoader {
2323

2424
let (ok_snd, ok_rcv) = oneshot::channel::<anyhow::Result<()>>();
2525
tokio::task::spawn_blocking(move || {
26-
let db = match open_db(path, hooks, false) {
26+
let db = match open_db(&path, hooks, false) {
2727
Ok(db) => {
2828
let _ = ok_snd.send(Ok(()));
2929
db

0 commit comments

Comments
 (0)