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

wasm rdbms #1212

Open
wants to merge 135 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
135 commits
Select commit Hold shift + click to select a range
a5c833a
golem-wit rdbms
justcoon Oct 24, 2024
1eecf2c
rdbms - durable host implementation - wip
justcoon Oct 25, 2024
28ec7c2
RdbmsService - initial
justcoon Oct 28, 2024
60daa98
Db service types
justcoon Oct 28, 2024
cd2705c
Db service type, pg pool - wip
justcoon Oct 29, 2024
8af70ad
Postgres execute
justcoon Oct 30, 2024
f2c8d71
rdbms-service wasm component
justcoon Oct 31, 2024
34ddeb1
Postgres query - wip
justcoon Oct 31, 2024
eaf4276
Postgres query - wip
justcoon Oct 31, 2024
d12beb8
rdbms-service wasm component
justcoon Oct 31, 2024
bc7d992
test - wip
justcoon Nov 1, 2024
08ba003
rdbms create linker
justcoon Nov 2, 2024
3d9da6d
rdbms-service wasm component
justcoon Nov 2, 2024
1e9d460
rdbms-service wasm component
justcoon Nov 2, 2024
ad165ad
rdbms-service wip
justcoon Nov 3, 2024
41ffbf5
rdbms-service wip
justcoon Nov 3, 2024
9cf08f0
cache fixes, tests
justcoon Nov 4, 2024
9d4071b
tokio-postgres
justcoon Nov 5, 2024
0b2d4dd
tokio-postgres
justcoon Nov 5, 2024
afb0c29
StreamDbResultSet
justcoon Nov 6, 2024
ee9f53d
sqlx postgres
justcoon Nov 7, 2024
5afbed8
golem-wit rdbms update
justcoon Nov 7, 2024
5aa2617
initial mysql durable host implementation
justcoon Nov 8, 2024
b643b65
sqlx common - wip, rdbms-service component update
justcoon Nov 8, 2024
eced927
sqlx common - wip, rdbms-service component update
justcoon Nov 8, 2024
4ae36ab
sqlx common - query executor
justcoon Nov 9, 2024
968a1e0
SqlxRdbms
justcoon Nov 9, 2024
c3a23b2
rdbms error
justcoon Nov 9, 2024
512191a
mysql test
justcoon Nov 10, 2024
69debca
pool workers cache, config, some clippy fixes
justcoon Nov 10, 2024
d698ef7
merge fixes
justcoon Nov 11, 2024
f09a8e2
rdbm - split to modules, conversions
justcoon Nov 11, 2024
e83284c
rdbm - split to modules, conversions
justcoon Nov 11, 2024
3e8ff68
DockerMysqlRdb, tests with docker
justcoon Nov 12, 2024
592de1f
RdbmsPoolKey for identification, DockerPostgresRdbs, DockerMysqlRdbs,…
justcoon Nov 13, 2024
0962bc0
RdbmsPoolKey for identification, DockerPostgresRdbs, DockerMysqlRdbs,…
justcoon Nov 13, 2024
d126d22
tests
justcoon Nov 14, 2024
14990d5
Rdbms with Type
justcoon Nov 14, 2024
db003b5
RdbmsStatus
justcoon Nov 14, 2024
44a192f
rdbms metrics
justcoon Nov 16, 2024
2eafe11
rdbms metrics
justcoon Nov 16, 2024
30713ba
TestDsl - invoke_and_await_typed
justcoon Nov 16, 2024
269fd4e
TestDsl - invoke_and_await_typed, test
justcoon Nov 16, 2024
3e5d044
tests
justcoon Nov 17, 2024
5db8ce2
tests
justcoon Nov 17, 2024
c388614
tests
justcoon Nov 18, 2024
870cebe
postgres - bind arrays
justcoon Nov 18, 2024
9585e0b
postgres schema test
justcoon Nov 18, 2024
211fd31
rdbms config
justcoon Nov 19, 2024
1a30ed2
rdbms config, tests
justcoon Nov 19, 2024
aaa56aa
tests
justcoon Nov 19, 2024
7d54011
tests
justcoon Nov 19, 2024
2a59fbf
tests
justcoon Nov 20, 2024
2301cbd
fixes
justcoon Nov 20, 2024
b61c236
tests
justcoon Nov 21, 2024
bdf2b52
logs
justcoon Nov 22, 2024
0209dcb
RdbmsPoolKey with Url
justcoon Nov 24, 2024
13ed39a
interval and date types
justcoon Nov 24, 2024
bd2a395
custom db types per rdbms - wip
justcoon Nov 27, 2024
35785b5
custom db types per rdbms - wip
justcoon Nov 28, 2024
477adf4
rebase fixes
justcoon Nov 29, 2024
81d82fc
custom db types per rdbms - wip
justcoon Nov 29, 2024
4eef727
custom db types per rdbms - wip
justcoon Nov 30, 2024
1231528
custom db types per rdbms - wip
justcoon Dec 1, 2024
94231ef
custom db types per rdbms - wip
justcoon Dec 1, 2024
686c13c
custom db types per rdbms - wip
justcoon Dec 1, 2024
a3bf897
custom db types per rdbms - wip
justcoon Dec 1, 2024
1ada567
custom db types per rdbms - wip
justcoon Dec 2, 2024
bf5ae79
sqlx_rdbms mod
justcoon Dec 2, 2024
6ca1012
rebase fixes
justcoon Dec 3, 2024
2442d34
custom db types per rdbms - wip
justcoon Dec 3, 2024
a588a3b
utils
justcoon Dec 3, 2024
a12af7b
fixes
justcoon Dec 4, 2024
03a7f3c
rebase fixes
justcoon Dec 4, 2024
6e4b59c
mysql tests and fixes - wip
justcoon Dec 4, 2024
1c31119
postgres, mysql tests and fixes - wip
justcoon Dec 4, 2024
552734e
postgres, mysql tests and fixes - wip
justcoon Dec 5, 2024
090a8e8
postgres, mysql tests and fixes - wip
justcoon Dec 5, 2024
0609f19
postgres, mysql tests and fixes (null value) - wip
justcoon Dec 5, 2024
de97019
postgres, mysql tests and fixes (xml value) - wip
justcoon Dec 6, 2024
f1e64e6
postgres, mysql tests and fixes - wip
justcoon Dec 6, 2024
236248f
postgres, mysql tests and fixes - wip
justcoon Dec 6, 2024
3d4209b
postgres, mysql tests and fixes - wip
justcoon Dec 7, 2024
e3aa033
postgres tests and fixes (money, jsonpath value) - wip
justcoon Dec 7, 2024
79cfc23
postgres, mysql tests and fixes - wip
justcoon Dec 8, 2024
018b772
postgres, mysql - cleanup
justcoon Dec 8, 2024
0dfdffe
postgres tests
justcoon Dec 8, 2024
8d6ccf2
rdbms wit - change type aliases to records
justcoon Dec 9, 2024
a58111e
rdbms wit - change type aliases to records
justcoon Dec 10, 2024
66e7d6e
postgres composite type - wip
justcoon Dec 11, 2024
d6792cf
postgres composite type - working prototype
justcoon Dec 11, 2024
1c613b5
postgres composite type
justcoon Dec 12, 2024
16429bb
postgres composite, enum types fixes
justcoon Dec 12, 2024
8b9f16c
postgres domain type, split to modules
justcoon Dec 13, 2024
1795ec9
postgres domain type, split to modules
justcoon Dec 13, 2024
6952c63
postgres wit enumeration
justcoon Dec 14, 2024
eabbdf1
postgres recursive types and values - refactoring - wip
justcoon Dec 14, 2024
09b13c3
postgres recursive types and values - refactoring
justcoon Dec 15, 2024
3ef8528
postgres recursive types and values - refactoring
justcoon Dec 15, 2024
dd921f0
postgres recursive types and values - tests and fixes
justcoon Dec 15, 2024
5699d46
postgres recursive types and values - tests and fixes
justcoon Dec 15, 2024
6e9109f
fixes, tests
justcoon Dec 16, 2024
019c7ab
postgres recursive types and values - using resource approach
justcoon Dec 17, 2024
9c719bc
postgres recursive types and values - using resource approach - store…
justcoon Dec 19, 2024
69edfb4
postgres recursive types and values - using resource approach - store…
justcoon Dec 20, 2024
42e629c
rebase fixes
justcoon Dec 20, 2024
2405683
dependencies
justcoon Dec 20, 2024
b5a9463
rdbms - transaction support - wip
justcoon Dec 21, 2024
4659208
rdbms - transaction support - wip
justcoon Dec 22, 2024
d6fb0d7
rdbms - transaction support - wip
justcoon Dec 22, 2024
c36107b
rdbms - transaction support - wip
justcoon Dec 22, 2024
84a7631
rdbms - transaction support - tests
justcoon Dec 23, 2024
1ada4a7
rdbms - transaction support - tests
justcoon Dec 24, 2024
3e340b4
rdbms - transaction support - tests
justcoon Dec 24, 2024
75bbc7e
rdbms - transaction support - tests
justcoon Dec 25, 2024
ea87fb8
query and query stream
justcoon Dec 25, 2024
1b246c3
rdbms-service test component - cleanup
justcoon Dec 26, 2024
420ed97
transaction query_stream - wip
justcoon Dec 27, 2024
f33442e
transaction query_stream
justcoon Dec 27, 2024
0e772e2
Merge branch 'main' into rdbms
justcoon Dec 28, 2024
892ea41
cleanup
justcoon Dec 29, 2024
770e75e
common types
justcoon Dec 30, 2024
fd5dc5c
Merge branch 'main' into rdbms
justcoon Jan 3, 2025
e09b6f0
Copyright 2024-2025 Golem Cloud
justcoon Jan 3, 2025
2aa23bb
Merge branch 'main' into rdbms
justcoon Jan 7, 2025
d1e58d4
Merge branch 'main' into rdbms
justcoon Jan 7, 2025
58c1ed7
Merge branch 'main' into rdbms
justcoon Jan 9, 2025
e73b0af
postgres range
justcoon Dec 16, 2024
e3a62ef
postgres range - getter and setters - wip
justcoon Jan 10, 2025
af14b94
Merge branch 'main' into rdbms
justcoon Jan 11, 2025
f76450f
merge fixes
justcoon Jan 11, 2025
06e8de4
postgres range - getter and setters
justcoon Jan 11, 2025
2cbab17
postgres db value type
justcoon Jan 11, 2025
b710ed8
try_match
justcoon Jan 11, 2025
e23d59d
postgres range, tests
justcoon Jan 12, 2025
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
89 changes: 84 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ exclude = [
"test-components/variant-service",
"test-components/write-stderr",
"test-components/write-stdout",
"test-components/rdbms-service",
]

[workspace.dependencies]
Expand Down Expand Up @@ -162,13 +163,20 @@ serde_yaml = { version = "0.9.34" }
sha2 = "0.10.8"
sozu-command-lib = { version = "1.0.5", default-features = false }
sozu-lib = { version = "1.0.5", default-features = false }
sqlx-core = { version = "0.8" }
sqlx = { version = "0.8", features = [
"runtime-tokio",
"sqlite",
"postgres",
"mysql",
"uuid",
"migrate",
"chrono",
"json",
"bigdecimal",
"mac_address",
"bit-vec",
"ipnetwork"
] }
strum = "0.26.3"
strum_macros = "0.26.4"
Expand All @@ -179,6 +187,7 @@ testcontainers-modules = { version = "0.11.4", features = [
"postgres",
"redis",
"minio",
"mysql"
] }
test-r = { version = "2.0.1", default-features = true }
thiserror = "2.0.6"
Expand Down
30 changes: 20 additions & 10 deletions golem-common/src/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,35 +156,41 @@ impl<
/// Tries to get a cached value for the given key. If the value is missing or is pending, it returns None.
#[allow(unused)]
pub fn try_get(&self, key: &K) -> Option<V> {
match self.state.items.try_get(key) {
let result = match self.state.items.try_get(key) {
Present(item) => match item.deref() {
Item::Pending { .. } => None,
Item::Cached { value, .. } => {
self.update_last_access(key);
Some(value.clone())
}
Item::Cached { value, .. } => Some(value.clone()),
},
Absent | Locked => None,
};

if (result.is_some()) {
self.update_last_access(key);
}

result
}

/// Gets a cached value for the given key. If the value is pending, it awaits it.
/// If the pending value fails, it returns None.
#[allow(unused)]
pub async fn get(&self, key: &K) -> Option<V> {
match self.state.items.get(key) {
let result = match self.state.items.get(key) {
Some(item) => match item.deref() {
Item::Pending { tx, .. } => {
let mut rx = tx.subscribe();
rx.recv().await.ok().and_then(|r| r.ok())
}
Item::Cached { value, .. } => {
self.update_last_access(key);
Some(value.clone())
}
Item::Cached { value, .. } => Some(value.clone()),
},
None => None,
};

if (result.is_some()) {
self.update_last_access(key);
}

result
}

/// Gets a cached value for a given key, or inserts a new one with the given async function. If a value is pending,
Expand Down Expand Up @@ -336,6 +342,10 @@ impl<
}
}

pub fn contains_key(&self, key: &K) -> bool {
self.state.items.contains_key(key)
}

pub fn create_weak_remover(&self, key: K) -> impl FnOnce() {
let weak_state = Arc::downgrade(&self.state);
let name = self.name;
Expand Down
2 changes: 1 addition & 1 deletion golem-test-framework/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ redis = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
serde_yaml = { workspace = true }
sqlx = { workspace = true }
testcontainers = { workspace = true }
testcontainers-modules = { workspace = true }
tokio = { workspace = true }
tokio-postgres = { workspace = true }
tokio-stream = { workspace = true }
tonic = { workspace = true }
tracing = { workspace = true }
Expand Down
Loading
Loading