Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Component metadata and ApiDefinition data serde #629

Merged
merged 32 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
c66f479
component-repo with bincode serde - wip
justcoon Jun 28, 2024
db7b927
component service
justcoon Jun 28, 2024
0125f5d
service base auth
justcoon Jun 28, 2024
95ff19f
migrations scripts
justcoon Jun 28, 2024
a38c56f
test
justcoon Jun 29, 2024
538ae0f
component-repo get all with namespace
justcoon Jun 30, 2024
ea83455
component-repo get_namespaces
justcoon Jun 30, 2024
8ef1638
component-service get_namespace
justcoon Jun 30, 2024
5b7b0e1
component-service get_ids_by_name
justcoon Jun 30, 2024
71a917e
component-service logs, namespace check
justcoon Jul 1, 2024
1452b27
component-service create with id
justcoon Jul 1, 2024
ddc25e9
naming fix - tpe -> typ
justcoon Jul 2, 2024
2a8dacf
components and component_versions tables, repo update
justcoon Jul 2, 2024
0e21ac2
component-service get_id_by_name, get_namespace
justcoon Jul 2, 2024
e6cdf75
component-repo queries with specific column names
justcoon Jul 2, 2024
4ccf0f3
component-repo upsert -> create
justcoon Jul 2, 2024
345ba22
component-repo sql format, tests
justcoon Jul 3, 2024
497df2d
remove unnecessary fields from component_versions table
justcoon Jul 3, 2024
da66f39
components and api_definition - proto serde
justcoon Jul 3, 2024
c0e8a1e
merge fixes
justcoon Jul 5, 2024
3d3f8f9
WorkerBinding proto - worker_id -> worker_name
justcoon Jul 5, 2024
6665f8e
golem-rib proto
justcoon Jul 5, 2024
b1c5599
WorkerBinding proto - golem.rib.Expr
justcoon Jul 5, 2024
37dd564
tests
justcoon Jul 6, 2024
ac5baec
component download - namespace check
justcoon Jul 7, 2024
de45178
component with namespace
justcoon Jul 7, 2024
803db08
repo - select by id without namespace
justcoon Jul 9, 2024
d64fb05
Merge branch 'refs/heads/main' into component_serde
justcoon Jul 9, 2024
8ed30a6
component repo - delete
justcoon Jul 9, 2024
eb396e0
logs, tests
justcoon Jul 9, 2024
a75cc52
fixes
justcoon Jul 10, 2024
4d746e2
Merge branch 'refs/heads/main' into component_serde
justcoon Jul 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
355 changes: 183 additions & 172 deletions Cargo.lock

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,14 @@ rand = "0.8.5"
serde = { version = "1.0", features = ["derive"] }
serde_json = { version = "1.0", features = ["raw_value"] }
serde_yaml = { version = "0.9.33 " }
sqlx = { version = "0.7", features = [
"runtime-tokio",
"sqlite",
"postgres",
"uuid",
"migrate",
"chrono",
] }
strum = "0.26.1"
strum_macros = "0.26.1"
tap = "1.0.1"
Expand Down
2 changes: 2 additions & 0 deletions golem-api-grpc/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
.include_file("mod.rs")
.compile(
&[
"proto/golem/rib/function_name.proto",
"proto/golem/rib/expr.proto",
"proto/golem/common/account_id.proto",
"proto/golem/common/project_id.proto",
"proto/golem/common/empty.proto",
Expand Down
7 changes: 4 additions & 3 deletions golem-api-grpc/proto/golem/apidefinition/api_definition.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ syntax = "proto3";
package golem.apidefinition;

import "golem/component/component_id.proto";
import "golem/rib/expr.proto";

message ApiDefinition {
ApiDefinitionId id = 1;
Expand Down Expand Up @@ -45,7 +46,7 @@ enum HttpMethod {

message WorkerBinding {
golem.component.ComponentId component = 1;
string worker_id = 2;
string response = 3;
optional string idempotency_key = 4;
golem.rib.Expr worker_name = 2;
golem.rib.Expr response = 3;
optional golem.rib.Expr idempotency_key = 4;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ import "wasm/rpc/type.proto";

message FunctionParameter {
string name = 1;
wasm.rpc.Type tpe = 2;
wasm.rpc.Type typ = 2;
}
2 changes: 1 addition & 1 deletion golem-api-grpc/proto/golem/component/function_result.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ import "wasm/rpc/type.proto";

message FunctionResult {
optional string name = 1;
wasm.rpc.Type tpe = 2;
wasm.rpc.Type typ = 2;
}
186 changes: 186 additions & 0 deletions golem-api-grpc/proto/golem/rib/expr.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
syntax = "proto3";

package golem.rib;

import "golem/rib/function_name.proto";

message Expr {
oneof expr {
LetExpr let = 1;
SelectFieldExpr select_field = 2;
SelectIndexExpr select_index = 3;
SequenceExpr sequence = 4;
RecordExpr record = 5;
TupleExpr tuple = 6;
LiteralExpr literal = 7;
NumberExpr number = 8;
FlagsExpr flags = 9;
IdentifierExpr identifier = 10;
BooleanExpr boolean = 11;
ConcatExpr concat = 12;
MultipleExpr multiple = 13;
NotExpr not = 14;
GreaterThanExpr greater_than = 15;
GreaterThanOrEqualToExpr greater_than_or_equal = 16;
LessThanOrEqualToExpr less_than_or_equal = 17;
EqualToExpr equal_to = 18;
LessThanExpr less_than = 19;
CondExpr cond = 20;
PatternMatchExpr pattern_match = 21;
OptionExpr option = 22;
ResultExpr result = 23;
CallExpr call = 24;
}
}

message LetExpr {
string name = 1;
Expr expr = 2;
}

message SelectFieldExpr {
string field = 1;
Expr expr = 2;
}

message SelectIndexExpr {
uint64 index = 1;
Expr expr = 2;
}

message SequenceExpr {
repeated Expr exprs = 1;
}

message RecordExpr {
repeated RecordFieldExpr fields = 1;
}

message RecordFieldExpr {
string name = 1;
Expr expr = 2;
}

message TupleExpr {
repeated Expr exprs = 1;
}

message LiteralExpr {
string value = 1;
}

message NumberExpr {
oneof number {
uint64 unsigned = 1;
int64 signed = 2;
double float = 3;
}
}

message FlagsExpr {
repeated string values = 1;
}

message IdentifierExpr {
string name = 1;
}

message BooleanExpr {
bool value = 1;
}

message ConcatExpr {
repeated Expr exprs = 1;
}

message MultipleExpr {
repeated Expr exprs = 1;
}

message NotExpr {
Expr expr = 1;
}

message GreaterThanExpr {
Expr left = 1;
Expr right = 2;
}

message GreaterThanOrEqualToExpr {
Expr left = 1;
Expr right = 2;
}

message LessThanOrEqualToExpr {
Expr left = 1;
Expr right = 2;
}

message EqualToExpr {
Expr left = 1;
Expr right = 2;
}

message LessThanExpr {
Expr left = 1;
Expr right = 2;
}

message CondExpr {
Expr left = 1;
Expr cond = 2;
Expr right = 3;
}

message PatternMatchExpr {
Expr expr = 1;
repeated MatchArm patterns = 2;
}

message OptionExpr {
optional Expr expr = 1;
}

message ResultExpr {
oneof result {
Expr ok = 1;
Expr err = 2;
}
}

message CallExpr {
golem.rib.ParsedFunctionName name = 1;
repeated Expr params = 2;
}

message MatchArm {
ArmPattern pattern = 1;
Expr expr = 2;
}

message ArmPattern {
oneof pattern {
WildCardArmPattern wild_card = 1;
AsArmPattern as = 2;
ConstructorArmPattern constructor = 3;
LiteralArmPattern literal = 4;
}
}

message WildCardArmPattern {

}

message AsArmPattern {
string name = 1;
ArmPattern pattern = 2;
}

message ConstructorArmPattern {
string name = 1;
repeated ArmPattern patterns = 2;
}

message LiteralArmPattern {
Expr expr = 1;
}
97 changes: 97 additions & 0 deletions golem-api-grpc/proto/golem/rib/function_name.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
syntax = "proto3";

package golem.rib;

message ParsedFunctionName {
ParsedFunctionSite site = 1;
ParsedFunctionReference function = 2;
}

message ParsedFunctionSite {
oneof site {
GlobalFunctionSite global = 1;
InterfaceFunctionSite interface = 2;
PackageInterfaceFunctionSite package_interface = 3;
}
}

message GlobalFunctionSite {

}

message InterfaceFunctionSite {
string name = 1;
}

message PackageInterfaceFunctionSite {
string namespace = 1;
string package = 2;
string interface = 3;
SemVersion version = 4;
}

message SemVersion {
uint64 major = 1;
uint64 minor = 2;
uint64 patch = 3;
string pre = 4;
string build = 5;
}

message ParsedFunctionReference {
oneof function_reference {
FunctionFunctionReference function = 1;
RawResourceConstructorFunctionReference raw_resource_constructor = 2;
RawResourceDropFunctionReference raw_resource_drop = 3;
RawResourceMethodFunctionReference raw_resource_method = 4;
RawResourceStaticMethodFunctionReference raw_resource_static_method = 5;
IndexedResourceConstructorFunctionReference indexed_resource_constructor = 6;
IndexedResourceMethodFunctionReference indexed_resource_method = 7;
IndexedResourceStaticMethodFunctionReference indexed_resource_static_method = 8;
IndexedResourceDropFunctionReference indexed_resource_drop = 9;
}
}

message FunctionFunctionReference {
string function = 1;
}

message RawResourceConstructorFunctionReference {
string resource = 1;
}

message RawResourceDropFunctionReference {
string resource = 1;
}

message RawResourceMethodFunctionReference {
string resource = 1;
string method = 2;
}

message RawResourceStaticMethodFunctionReference {
string resource = 1;
string method = 2;
}

message IndexedResourceConstructorFunctionReference {
string resource = 1;
repeated string resource_params = 2;
}

message IndexedResourceMethodFunctionReference {
string resource = 1;
repeated string resource_params = 2;
string method = 3;
}

message IndexedResourceStaticMethodFunctionReference {
string resource = 1;
repeated string resource_params = 2;
string method = 3;
}

message IndexedResourceDropFunctionReference {
string resource = 1;
repeated string resource_params = 2;
}
23 changes: 23 additions & 0 deletions golem-component-service-base/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,32 @@ golem-common = { path = "../golem-common", version = "0.0.0" }
golem-service-base = { path = "../golem-service-base" }
golem-wasm-ast = { workspace = true }

anyhow = { workspace = true }
async-trait = { workspace = true }
bincode = { workspace = true }
bytes = { workspace = true }
http_02 = { workspace = true }
prost = { workspace = true }
serde = { workspace = true }
sqlx = { workspace = true, features = [
"runtime-tokio",
"sqlite",
"postgres",
"uuid",
"migrate",
"chrono",
] }
tap = { workspace = true }
thiserror = { workspace = true }
tonic = { workspace = true }
tokio = { workspace = true }
tokio-stream = { workspace = true }
tokio-util = { workspace = true }
tracing = { workspace = true }
uuid = { workspace = true }

[dev-dependencies]
criterion = { version = "0.3", features = ["html_reports"] }
fastrand = "2.0.2"
testcontainers = { workspace = true }
testcontainers-modules = { workspace = true }
Loading
Loading