mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-05-26 20:49:55 +00:00
Compare commits
21 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9a5ba6171f | |||
| da3efa05b5 | |||
| b53ba2eef4 | |||
| 33019c4529 | |||
| f7bd9eaba8 | |||
| f9c42bbadc | |||
| fe62c39501 | |||
| 35320cf0d4 | |||
| eaf6a889c2 | |||
| b04f1332db | |||
| 9e4bcda17b | |||
| 45e4053883 | |||
| c0b617f4f1 | |||
| a28cfd284b | |||
| a5b9cb69bd | |||
| 3c8f252a14 | |||
| 8a63818f31 | |||
| 5b5e26e529 | |||
| 866769c054 | |||
| 2e3b71f5f1 | |||
| 1312d61141 |
@@ -19,7 +19,7 @@ inputs:
|
|||||||
rust-version:
|
rust-version:
|
||||||
description: 'Rust version to install (e.g. nightly). Defaults to 1.87.0'
|
description: 'Rust version to install (e.g. nightly). Defaults to 1.87.0'
|
||||||
required: false
|
required: false
|
||||||
default: '1.87.0'
|
default: ''
|
||||||
sccache-cache-limit:
|
sccache-cache-limit:
|
||||||
description: 'Maximum size limit for sccache local cache (e.g. 2G, 500M)'
|
description: 'Maximum size limit for sccache local cache (e.g. 2G, 500M)'
|
||||||
required: false
|
required: false
|
||||||
|
|||||||
@@ -1,71 +0,0 @@
|
|||||||
name: Cleanup Registry Images
|
|
||||||
|
|
||||||
on:
|
|
||||||
schedule:
|
|
||||||
# Run daily at midnight UTC
|
|
||||||
- cron: '0 0 * * *'
|
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
dry_run:
|
|
||||||
description: 'Dry run (check only, no actual deletion)'
|
|
||||||
required: false
|
|
||||||
default: true
|
|
||||||
type: boolean
|
|
||||||
grace_period:
|
|
||||||
description: 'Grace period (e.g., 24h, 48h, 168h)'
|
|
||||||
required: false
|
|
||||||
default: '24h'
|
|
||||||
type: string
|
|
||||||
keep_count:
|
|
||||||
description: 'Number of images to keep per tag pattern'
|
|
||||||
required: false
|
|
||||||
default: '30'
|
|
||||||
type: string
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: "cleanup-registry"
|
|
||||||
cancel-in-progress: false
|
|
||||||
|
|
||||||
env:
|
|
||||||
BUILTIN_REGISTRY: forgejo.ellis.link
|
|
||||||
IMAGE_PATH: forgejo.ellis.link/continuwuation/continuwuity
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
cleanup-registry:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v5
|
|
||||||
with:
|
|
||||||
persist-credentials: false
|
|
||||||
|
|
||||||
- name: Set cleanup parameters
|
|
||||||
id: params
|
|
||||||
run: |
|
|
||||||
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
|
||||||
echo "dry_run=${{ inputs.dry_run }}" >> $GITHUB_OUTPUT
|
|
||||||
echo "grace_period=${{ inputs.grace_period }}" >> $GITHUB_OUTPUT
|
|
||||||
echo "keep_count=${{ inputs.keep_count }}" >> $GITHUB_OUTPUT
|
|
||||||
else
|
|
||||||
# Scheduled runs are not dry-run by default
|
|
||||||
echo "dry_run=false" >> $GITHUB_OUTPUT
|
|
||||||
echo "grace_period=24h" >> $GITHUB_OUTPUT
|
|
||||||
echo "keep_count=30" >> $GITHUB_OUTPUT
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Login to registry
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
registry: ${{ env.BUILTIN_REGISTRY }}
|
|
||||||
username: ${{ vars.BUILTIN_REGISTRY_USER || github.actor }}
|
|
||||||
password: ${{ secrets.BUILTIN_REGISTRY_PASSWORD || secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Clean up old SHA commit images
|
|
||||||
uses: docker://us-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner-cli
|
|
||||||
with:
|
|
||||||
args: >-
|
|
||||||
-repo=${{ env.IMAGE_PATH }}
|
|
||||||
-tag-filter-all="sha-[0-9a-f]+"
|
|
||||||
-keep=${{ steps.params.outputs.keep_count }}
|
|
||||||
-grace=${{ steps.params.outputs.grace_period }}
|
|
||||||
${{ steps.params.outputs.dry_run == 'true' && '-dry-run' || '' }}
|
|
||||||
@@ -20,7 +20,8 @@ jobs:
|
|||||||
fetch-tags: false
|
fetch-tags: false
|
||||||
fetch-single-branch: true
|
fetch-single-branch: true
|
||||||
submodules: false
|
submodules: false
|
||||||
persist-credentials: false
|
persist-credentials: true
|
||||||
|
token: ${{ secrets.FORGEJO_TOKEN }}
|
||||||
|
|
||||||
- uses: https://github.com/cachix/install-nix-action@7ab6e7fd29da88e74b1e314a4ae9ac6b5cda3801 # v31.8.0
|
- uses: https://github.com/cachix/install-nix-action@7ab6e7fd29da88e74b1e314a4ae9ac6b5cda3801 # v31.8.0
|
||||||
with:
|
with:
|
||||||
|
|||||||
Generated
+298
-387
File diff suppressed because it is too large
Load Diff
+17
-30
@@ -166,8 +166,8 @@ default-features = false
|
|||||||
features = ["raw_value"]
|
features = ["raw_value"]
|
||||||
|
|
||||||
# Used for appservice registration files
|
# Used for appservice registration files
|
||||||
[workspace.dependencies.serde_yml]
|
[workspace.dependencies.serde-saphyr]
|
||||||
version = "0.0.12"
|
version = "0.0.7"
|
||||||
|
|
||||||
# Used to load forbidden room/user regex from config
|
# Used to load forbidden room/user regex from config
|
||||||
[workspace.dependencies.serde_regex]
|
[workspace.dependencies.serde_regex]
|
||||||
@@ -210,13 +210,13 @@ default-features = false
|
|||||||
version = "0.1.41"
|
version = "0.1.41"
|
||||||
default-features = false
|
default-features = false
|
||||||
[workspace.dependencies.tracing-subscriber]
|
[workspace.dependencies.tracing-subscriber]
|
||||||
version = "0.3.19"
|
version = "0.3.20"
|
||||||
default-features = false
|
default-features = false
|
||||||
features = ["env-filter", "std", "tracing", "tracing-log", "ansi", "fmt"]
|
features = ["env-filter", "std", "tracing", "tracing-log", "ansi", "fmt"]
|
||||||
[workspace.dependencies.tracing-journald]
|
[workspace.dependencies.tracing-journald]
|
||||||
version = "0.3.1"
|
version = "0.3.1"
|
||||||
[workspace.dependencies.tracing-core]
|
[workspace.dependencies.tracing-core]
|
||||||
version = "0.1.33"
|
version = "0.1.34"
|
||||||
default-features = false
|
default-features = false
|
||||||
|
|
||||||
# for URL previews
|
# for URL previews
|
||||||
@@ -286,7 +286,7 @@ features = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[workspace.dependencies.hyper-util]
|
[workspace.dependencies.hyper-util]
|
||||||
version = "0.1.11"
|
version = "=0.1.17"
|
||||||
default-features = false
|
default-features = false
|
||||||
features = [
|
features = [
|
||||||
"server-auto",
|
"server-auto",
|
||||||
@@ -412,28 +412,27 @@ default-features = false
|
|||||||
|
|
||||||
# optional opentelemetry, performance measurements, flamegraphs, etc for performance measurements and monitoring
|
# optional opentelemetry, performance measurements, flamegraphs, etc for performance measurements and monitoring
|
||||||
[workspace.dependencies.opentelemetry]
|
[workspace.dependencies.opentelemetry]
|
||||||
version = "0.30.0"
|
version = "0.31.0"
|
||||||
|
|
||||||
[workspace.dependencies.tracing-flame]
|
[workspace.dependencies.tracing-flame]
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
|
|
||||||
[workspace.dependencies.tracing-opentelemetry]
|
[workspace.dependencies.tracing-opentelemetry]
|
||||||
version = "0.31.0"
|
version = "0.32.0"
|
||||||
|
|
||||||
[workspace.dependencies.opentelemetry_sdk]
|
[workspace.dependencies.opentelemetry_sdk]
|
||||||
version = "0.30.0"
|
version = "0.31.0"
|
||||||
features = ["rt-tokio"]
|
features = ["rt-tokio"]
|
||||||
|
|
||||||
[workspace.dependencies.opentelemetry-otlp]
|
[workspace.dependencies.opentelemetry-otlp]
|
||||||
version = "0.30.0"
|
version = "0.31.0"
|
||||||
features = ["http", "trace", "logs", "metrics"]
|
features = ["http", "trace", "logs", "metrics"]
|
||||||
|
|
||||||
[workspace.dependencies.opentelemetry-jaeger-propagator]
|
|
||||||
version = "0.30.0"
|
|
||||||
|
|
||||||
# optional sentry metrics for crash/panic reporting
|
# optional sentry metrics for crash/panic reporting
|
||||||
[workspace.dependencies.sentry]
|
[workspace.dependencies.sentry]
|
||||||
version = "0.42.0"
|
version = "0.45.0"
|
||||||
default-features = false
|
default-features = false
|
||||||
features = [
|
features = [
|
||||||
"backtrace",
|
"backtrace",
|
||||||
@@ -449,9 +448,9 @@ features = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[workspace.dependencies.sentry-tracing]
|
[workspace.dependencies.sentry-tracing]
|
||||||
version = "0.42.0"
|
version = "0.45.0"
|
||||||
[workspace.dependencies.sentry-tower]
|
[workspace.dependencies.sentry-tower]
|
||||||
version = "0.42.0"
|
version = "0.45.0"
|
||||||
|
|
||||||
# jemalloc usage
|
# jemalloc usage
|
||||||
[workspace.dependencies.tikv-jemalloc-sys]
|
[workspace.dependencies.tikv-jemalloc-sys]
|
||||||
@@ -477,7 +476,7 @@ default-features = false
|
|||||||
features = ["use_std"]
|
features = ["use_std"]
|
||||||
|
|
||||||
[workspace.dependencies.console-subscriber]
|
[workspace.dependencies.console-subscriber]
|
||||||
version = "0.4"
|
version = "0.5"
|
||||||
|
|
||||||
[workspace.dependencies.nix]
|
[workspace.dependencies.nix]
|
||||||
version = "0.30.1"
|
version = "0.30.1"
|
||||||
@@ -564,19 +563,7 @@ version = "0.7.5"
|
|||||||
|
|
||||||
# backport of [https://github.com/tokio-rs/tracing/pull/2956] to the 0.1.x branch of tracing.
|
# backport of [https://github.com/tokio-rs/tracing/pull/2956] to the 0.1.x branch of tracing.
|
||||||
# we can switch back to upstream if #2956 is merged and backported in the upstream repo.
|
# we can switch back to upstream if #2956 is merged and backported in the upstream repo.
|
||||||
# https://forgejo.ellis.link/continuwuation/tracing/commit/b348dca742af641c47bc390261f60711c2af573c
|
|
||||||
[patch.crates-io.tracing-subscriber]
|
|
||||||
git = "https://forgejo.ellis.link/continuwuation/tracing"
|
|
||||||
rev = "1e64095a8051a1adf0d1faa307f9f030889ec2aa"
|
|
||||||
[patch.crates-io.tracing]
|
|
||||||
git = "https://forgejo.ellis.link/continuwuation/tracing"
|
|
||||||
rev = "1e64095a8051a1adf0d1faa307f9f030889ec2aa"
|
|
||||||
[patch.crates-io.tracing-core]
|
|
||||||
git = "https://forgejo.ellis.link/continuwuation/tracing"
|
|
||||||
rev = "1e64095a8051a1adf0d1faa307f9f030889ec2aa"
|
|
||||||
[patch.crates-io.tracing-log]
|
|
||||||
git = "https://forgejo.ellis.link/continuwuation/tracing"
|
|
||||||
rev = "1e64095a8051a1adf0d1faa307f9f030889ec2aa"
|
|
||||||
|
|
||||||
# adds a tab completion callback: https://forgejo.ellis.link/continuwuation/rustyline-async/src/branch/main/.patchy/0002-add-tab-completion-callback.patch
|
# adds a tab completion callback: https://forgejo.ellis.link/continuwuation/rustyline-async/src/branch/main/.patchy/0002-add-tab-completion-callback.patch
|
||||||
# adds event for CTRL+\: https://forgejo.ellis.link/continuwuation/rustyline-async/src/branch/main/.patchy/0001-add-event-for-ctrl.patch
|
# adds event for CTRL+\: https://forgejo.ellis.link/continuwuation/rustyline-async/src/branch/main/.patchy/0001-add-event-for-ctrl.patch
|
||||||
@@ -600,7 +587,7 @@ rev = "9c8e51510c35077df888ee72a36b4b05637147da"
|
|||||||
# reverts hyperium#148 conflicting with our delicate federation resolver hooks
|
# reverts hyperium#148 conflicting with our delicate federation resolver hooks
|
||||||
[patch.crates-io.hyper-util]
|
[patch.crates-io.hyper-util]
|
||||||
git = "https://forgejo.ellis.link/continuwuation/hyper-util"
|
git = "https://forgejo.ellis.link/continuwuation/hyper-util"
|
||||||
rev = "e4ae7628fe4fcdacef9788c4c8415317a4489941"
|
rev = "5886d5292bf704c246206ad72d010d674a7b77d0"
|
||||||
|
|
||||||
#
|
#
|
||||||
# Our crates
|
# Our crates
|
||||||
@@ -960,7 +947,7 @@ semicolon_outside_block = "warn"
|
|||||||
str_to_string = "warn"
|
str_to_string = "warn"
|
||||||
string_lit_chars_any = "warn"
|
string_lit_chars_any = "warn"
|
||||||
string_slice = "warn"
|
string_slice = "warn"
|
||||||
string_to_string = "warn"
|
|
||||||
suspicious_xor_used_as_pow = "warn"
|
suspicious_xor_used_as_pow = "warn"
|
||||||
tests_outside_test_module = "warn"
|
tests_outside_test_module = "warn"
|
||||||
try_err = "warn"
|
try_err = "warn"
|
||||||
|
|||||||
+1
-1
@@ -48,7 +48,7 @@ EOF
|
|||||||
|
|
||||||
# Developer tool versions
|
# Developer tool versions
|
||||||
# renovate: datasource=github-releases depName=cargo-bins/cargo-binstall
|
# renovate: datasource=github-releases depName=cargo-bins/cargo-binstall
|
||||||
ENV BINSTALL_VERSION=1.15.7
|
ENV BINSTALL_VERSION=1.15.10
|
||||||
# renovate: datasource=github-releases depName=psastras/sbom-rs
|
# renovate: datasource=github-releases depName=psastras/sbom-rs
|
||||||
ENV CARGO_SBOM_VERSION=0.9.1
|
ENV CARGO_SBOM_VERSION=0.9.1
|
||||||
# renovate: datasource=crate depName=lddtree
|
# renovate: datasource=crate depName=lddtree
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ RUN --mount=type=cache,target=/etc/apk/cache apk add \
|
|||||||
|
|
||||||
# Developer tool versions
|
# Developer tool versions
|
||||||
# renovate: datasource=github-releases depName=cargo-bins/cargo-binstall
|
# renovate: datasource=github-releases depName=cargo-bins/cargo-binstall
|
||||||
ENV BINSTALL_VERSION=1.15.7
|
ENV BINSTALL_VERSION=1.15.10
|
||||||
# renovate: datasource=github-releases depName=psastras/sbom-rs
|
# renovate: datasource=github-releases depName=psastras/sbom-rs
|
||||||
ENV CARGO_SBOM_VERSION=0.9.1
|
ENV CARGO_SBOM_VERSION=0.9.1
|
||||||
# renovate: datasource=crate depName=lddtree
|
# renovate: datasource=crate depName=lddtree
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
file = inputs.self + "/rust-toolchain.toml";
|
file = inputs.self + "/rust-toolchain.toml";
|
||||||
|
|
||||||
# See also `rust-toolchain.toml`
|
# See also `rust-toolchain.toml`
|
||||||
sha256 = "sha256-+9FmLhAOezBZCOziO0Qct1NOrfpjNsXxc/8I0c7BdKE=";
|
sha256 = "sha256-SJwZ8g0zF2WrKDVmHrVG3pD2RGoQeo24MEXnNx5FyuI=";
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -18,14 +18,6 @@
|
|||||||
"tikv-jemallocator",
|
"tikv-jemallocator",
|
||||||
"tikv-jemalloc-sys",
|
"tikv-jemalloc-sys",
|
||||||
"tikv-jemalloc-ctl",
|
"tikv-jemalloc-ctl",
|
||||||
"opentelemetry",
|
|
||||||
"opentelemetry_sdk",
|
|
||||||
"opentelemetry-jaeger",
|
|
||||||
"tracing-opentelemetry",
|
|
||||||
"tracing-subscriber",
|
|
||||||
"tracing",
|
|
||||||
"tracing-core",
|
|
||||||
"tracing-log",
|
|
||||||
"rustyline-async",
|
"rustyline-async",
|
||||||
"event-listener",
|
"event-listener",
|
||||||
"async-channel",
|
"async-channel",
|
||||||
|
|||||||
+1
-1
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
[toolchain]
|
[toolchain]
|
||||||
profile = "minimal"
|
profile = "minimal"
|
||||||
channel = "1.89.0"
|
channel = "1.90.0"
|
||||||
components = [
|
components = [
|
||||||
# For rust-analyzer
|
# For rust-analyzer
|
||||||
"rust-src",
|
"rust-src",
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ futures.workspace = true
|
|||||||
log.workspace = true
|
log.workspace = true
|
||||||
ruma.workspace = true
|
ruma.workspace = true
|
||||||
serde_json.workspace = true
|
serde_json.workspace = true
|
||||||
serde_yml.workspace = true
|
serde-saphyr.workspace = true
|
||||||
tokio.workspace = true
|
tokio.workspace = true
|
||||||
tracing-subscriber.workspace = true
|
tracing-subscriber.workspace = true
|
||||||
tracing.workspace = true
|
tracing.workspace = true
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ pub(super) async fn register(&self) -> Result {
|
|||||||
|
|
||||||
let range = 1..checked!(body_len - 1)?;
|
let range = 1..checked!(body_len - 1)?;
|
||||||
let appservice_config_body = body[range].join("\n");
|
let appservice_config_body = body[range].join("\n");
|
||||||
let parsed_config = serde_yml::from_str(&appservice_config_body);
|
let parsed_config = serde_saphyr::from_str(&appservice_config_body);
|
||||||
match parsed_config {
|
match parsed_config {
|
||||||
| Err(e) => return Err!("Could not parse appservice config as YAML: {e}"),
|
| Err(e) => return Err!("Could not parse appservice config as YAML: {e}"),
|
||||||
| Ok(registration) => match self
|
| Ok(registration) => match self
|
||||||
@@ -57,7 +57,7 @@ pub(super) async fn show_appservice_config(&self, appservice_identifier: String)
|
|||||||
{
|
{
|
||||||
| None => return Err!("Appservice does not exist."),
|
| None => return Err!("Appservice does not exist."),
|
||||||
| Some(config) => {
|
| Some(config) => {
|
||||||
let config_str = serde_yml::to_string(&config)?;
|
let config_str = serde_saphyr::to_string(&config)?;
|
||||||
write!(self, "Config for {appservice_identifier}:\n\n```yaml\n{config_str}\n```")
|
write!(self, "Config for {appservice_identifier}:\n\n```yaml\n{config_str}\n```")
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ pub(crate) async fn well_known_support(
|
|||||||
while let Some(user_id) = stream.next().await {
|
while let Some(user_id) = stream.next().await {
|
||||||
// Skip server user
|
// Skip server user
|
||||||
if *user_id == services.globals.server_user {
|
if *user_id == services.globals.server_user {
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
contacts.push(Contact {
|
contacts.push(Contact {
|
||||||
role: role_value.clone(),
|
role: role_value.clone(),
|
||||||
|
|||||||
+1
-1
@@ -92,7 +92,7 @@ ruma.workspace = true
|
|||||||
sanitize-filename.workspace = true
|
sanitize-filename.workspace = true
|
||||||
serde_json.workspace = true
|
serde_json.workspace = true
|
||||||
serde_regex.workspace = true
|
serde_regex.workspace = true
|
||||||
serde_yml.workspace = true
|
serde-saphyr.workspace = true
|
||||||
serde.workspace = true
|
serde.workspace = true
|
||||||
smallvec.workspace = true
|
smallvec.workspace = true
|
||||||
smallstr.workspace = true
|
smallstr.workspace = true
|
||||||
|
|||||||
@@ -83,7 +83,9 @@ pub enum Error {
|
|||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
TypedHeader(#[from] axum_extra::typed_header::TypedHeaderRejection),
|
TypedHeader(#[from] axum_extra::typed_header::TypedHeaderRejection),
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
Yaml(#[from] serde_yml::Error),
|
YamlDe(#[from] serde_saphyr::Error),
|
||||||
|
#[error(transparent)]
|
||||||
|
YamlSer(#[from] serde_saphyr::ser_error::Error),
|
||||||
|
|
||||||
// ruma/conduwuit
|
// ruma/conduwuit
|
||||||
#[error("Arithmetic operation failed: {0}")]
|
#[error("Arithmetic operation failed: {0}")]
|
||||||
|
|||||||
@@ -421,8 +421,8 @@ where
|
|||||||
/// `key_fn` is used as to obtain the power level and age of an event for
|
/// `key_fn` is used as to obtain the power level and age of an event for
|
||||||
/// breaking ties (together with the event ID).
|
/// breaking ties (together with the event ID).
|
||||||
#[tracing::instrument(level = "debug", skip_all)]
|
#[tracing::instrument(level = "debug", skip_all)]
|
||||||
pub async fn lexicographical_topological_sort<Id, F, Fut, Hasher>(
|
pub async fn lexicographical_topological_sort<Id, F, Fut, Hasher, S>(
|
||||||
graph: &HashMap<Id, HashSet<Id, Hasher>>,
|
graph: &HashMap<Id, HashSet<Id, Hasher>, S>,
|
||||||
key_fn: &F,
|
key_fn: &F,
|
||||||
) -> Result<Vec<Id>>
|
) -> Result<Vec<Id>>
|
||||||
where
|
where
|
||||||
@@ -430,6 +430,7 @@ where
|
|||||||
Fut: Future<Output = Result<(Int, MilliSecondsSinceUnixEpoch)>> + Send,
|
Fut: Future<Output = Result<(Int, MilliSecondsSinceUnixEpoch)>> + Send,
|
||||||
Id: Borrow<EventId> + Clone + Eq + Hash + Ord + Send + Sync,
|
Id: Borrow<EventId> + Clone + Eq + Hash + Ord + Send + Sync,
|
||||||
Hasher: BuildHasher + Default + Clone + Send + Sync,
|
Hasher: BuildHasher + Default + Clone + Send + Sync,
|
||||||
|
S: BuildHasher + Clone + Send + Sync,
|
||||||
{
|
{
|
||||||
#[derive(PartialEq, Eq)]
|
#[derive(PartialEq, Eq)]
|
||||||
struct TieBreaker<'a, Id> {
|
struct TieBreaker<'a, Id> {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ use conduwuit::{
|
|||||||
use futures::{Stream, StreamExt, TryStreamExt};
|
use futures::{Stream, StreamExt, TryStreamExt};
|
||||||
use rocksdb::{DBPinnableSlice, ReadOptions};
|
use rocksdb::{DBPinnableSlice, ReadOptions};
|
||||||
|
|
||||||
use super::get::{cached_handle_from, handle_from};
|
use super::get::handle_from;
|
||||||
use crate::Handle;
|
use crate::Handle;
|
||||||
|
|
||||||
pub trait Get<'a, K, S>
|
pub trait Get<'a, K, S>
|
||||||
@@ -58,20 +58,6 @@ where
|
|||||||
.try_flatten()
|
.try_flatten()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[implement(super::Map)]
|
|
||||||
#[tracing::instrument(name = "batch_cached", level = "trace", skip_all)]
|
|
||||||
pub(crate) fn get_batch_cached<'a, I, K>(
|
|
||||||
&self,
|
|
||||||
keys: I,
|
|
||||||
) -> impl Iterator<Item = Result<Option<Handle<'_>>>> + Send + use<'_, I, K>
|
|
||||||
where
|
|
||||||
I: Iterator<Item = &'a K> + ExactSizeIterator + Send,
|
|
||||||
K: AsRef<[u8]> + Send + ?Sized + Sync + 'a,
|
|
||||||
{
|
|
||||||
self.get_batch_blocking_opts(keys, &self.cache_read_options)
|
|
||||||
.map(cached_handle_from)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[implement(super::Map)]
|
#[implement(super::Map)]
|
||||||
#[tracing::instrument(name = "batch_blocking", level = "trace", skip_all)]
|
#[tracing::instrument(name = "batch_blocking", level = "trace", skip_all)]
|
||||||
pub(crate) fn get_batch_blocking<'a, I, K>(
|
pub(crate) fn get_batch_blocking<'a, I, K>(
|
||||||
|
|||||||
+11
-11
@@ -184,7 +184,7 @@ fn spawn_one(
|
|||||||
let handle = thread::Builder::new()
|
let handle = thread::Builder::new()
|
||||||
.name(WORKER_NAME.into())
|
.name(WORKER_NAME.into())
|
||||||
.stack_size(WORKER_STACK_SIZE)
|
.stack_size(WORKER_STACK_SIZE)
|
||||||
.spawn(move || self.worker(id, recv))?;
|
.spawn(move || self.worker(id, &recv))?;
|
||||||
|
|
||||||
workers.push(handle);
|
workers.push(handle);
|
||||||
|
|
||||||
@@ -260,9 +260,9 @@ async fn execute(&self, queue: &Sender<Cmd>, cmd: Cmd) -> Result {
|
|||||||
tid = ?thread::current().id(),
|
tid = ?thread::current().id(),
|
||||||
),
|
),
|
||||||
)]
|
)]
|
||||||
fn worker(self: Arc<Self>, id: usize, recv: Receiver<Cmd>) {
|
fn worker(self: Arc<Self>, id: usize, recv: &Receiver<Cmd>) {
|
||||||
self.worker_init(id);
|
self.worker_init(id);
|
||||||
self.worker_loop(&recv);
|
self.worker_loop(recv);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[implement(Pool)]
|
#[implement(Pool)]
|
||||||
@@ -309,7 +309,7 @@ fn worker_loop(self: &Arc<Self>, recv: &Receiver<Cmd>) {
|
|||||||
self.busy.fetch_add(1, Ordering::Relaxed);
|
self.busy.fetch_add(1, Ordering::Relaxed);
|
||||||
|
|
||||||
while let Ok(cmd) = self.worker_wait(recv) {
|
while let Ok(cmd) = self.worker_wait(recv) {
|
||||||
self.worker_handle(cmd);
|
Pool::worker_handle(cmd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -331,11 +331,11 @@ fn worker_wait(self: &Arc<Self>, recv: &Receiver<Cmd>) -> Result<Cmd, RecvError>
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[implement(Pool)]
|
#[implement(Pool)]
|
||||||
fn worker_handle(self: &Arc<Self>, cmd: Cmd) {
|
fn worker_handle(cmd: Cmd) {
|
||||||
match cmd {
|
match cmd {
|
||||||
| Cmd::Get(cmd) if cmd.key.len() == 1 => self.handle_get(cmd),
|
| Cmd::Get(cmd) if cmd.key.len() == 1 => Pool::handle_get(cmd),
|
||||||
| Cmd::Get(cmd) => self.handle_batch(cmd),
|
| Cmd::Get(cmd) => Pool::handle_batch(cmd),
|
||||||
| Cmd::Iter(cmd) => self.handle_iter(cmd),
|
| Cmd::Iter(cmd) => Pool::handle_iter(cmd),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -346,7 +346,7 @@ fn worker_handle(self: &Arc<Self>, cmd: Cmd) {
|
|||||||
skip_all,
|
skip_all,
|
||||||
fields(%cmd.map),
|
fields(%cmd.map),
|
||||||
)]
|
)]
|
||||||
fn handle_iter(&self, mut cmd: Seek) {
|
fn handle_iter(mut cmd: Seek) {
|
||||||
let chan = cmd.res.take().expect("missing result channel");
|
let chan = cmd.res.take().expect("missing result channel");
|
||||||
|
|
||||||
if chan.is_canceled() {
|
if chan.is_canceled() {
|
||||||
@@ -375,7 +375,7 @@ fn handle_iter(&self, mut cmd: Seek) {
|
|||||||
keys = %cmd.key.len(),
|
keys = %cmd.key.len(),
|
||||||
),
|
),
|
||||||
)]
|
)]
|
||||||
fn handle_batch(self: &Arc<Self>, mut cmd: Get) {
|
fn handle_batch(mut cmd: Get) {
|
||||||
debug_assert!(cmd.key.len() > 1, "should have more than one key");
|
debug_assert!(cmd.key.len() > 1, "should have more than one key");
|
||||||
debug_assert!(!cmd.key.iter().any(SmallVec::is_empty), "querying for empty key");
|
debug_assert!(!cmd.key.iter().any(SmallVec::is_empty), "querying for empty key");
|
||||||
|
|
||||||
@@ -401,7 +401,7 @@ fn handle_batch(self: &Arc<Self>, mut cmd: Get) {
|
|||||||
skip_all,
|
skip_all,
|
||||||
fields(%cmd.map),
|
fields(%cmd.map),
|
||||||
)]
|
)]
|
||||||
fn handle_get(&self, mut cmd: Get) {
|
fn handle_get(mut cmd: Get) {
|
||||||
debug_assert!(!cmd.key[0].is_empty(), "querying for empty key");
|
debug_assert!(!cmd.key[0].is_empty(), "querying for empty key");
|
||||||
|
|
||||||
// Obtain the result channel.
|
// Obtain the result channel.
|
||||||
|
|||||||
@@ -25,13 +25,13 @@ pub(super) fn refutable(mut item: ItemFn, _args: &[Meta]) -> Result<TokenStream>
|
|||||||
};
|
};
|
||||||
|
|
||||||
let name = format!("_args_{i}");
|
let name = format!("_args_{i}");
|
||||||
*pat = Box::new(Pat::Ident(PatIdent {
|
**pat = Pat::Ident(PatIdent {
|
||||||
ident: Ident::new(&name, Span::call_site().into()),
|
ident: Ident::new(&name, Span::call_site().into()),
|
||||||
attrs: Vec::new(),
|
attrs: Vec::new(),
|
||||||
by_ref: None,
|
by_ref: None,
|
||||||
mutability: None,
|
mutability: None,
|
||||||
subpat: None,
|
subpat: None,
|
||||||
}));
|
});
|
||||||
|
|
||||||
let field = fields.iter();
|
let field = fields.iter();
|
||||||
let refute = quote! {
|
let refute = quote! {
|
||||||
|
|||||||
+3
-4
@@ -62,7 +62,8 @@ standard = [
|
|||||||
"media_thumbnail",
|
"media_thumbnail",
|
||||||
"systemd",
|
"systemd",
|
||||||
"url_preview",
|
"url_preview",
|
||||||
"zstd_compression"
|
"zstd_compression",
|
||||||
|
"sentry_telemetry"
|
||||||
]
|
]
|
||||||
full = [
|
full = [
|
||||||
"standard",
|
"standard",
|
||||||
@@ -129,7 +130,6 @@ perf_measurements = [
|
|||||||
"dep:tracing-opentelemetry",
|
"dep:tracing-opentelemetry",
|
||||||
"dep:opentelemetry_sdk",
|
"dep:opentelemetry_sdk",
|
||||||
"dep:opentelemetry-otlp",
|
"dep:opentelemetry-otlp",
|
||||||
"dep:opentelemetry-jaeger-propagator",
|
|
||||||
"conduwuit-core/perf_measurements",
|
"conduwuit-core/perf_measurements",
|
||||||
"conduwuit-core/sentry_telemetry",
|
"conduwuit-core/sentry_telemetry",
|
||||||
]
|
]
|
||||||
@@ -201,6 +201,7 @@ conduwuit-core.workspace = true
|
|||||||
conduwuit-database.workspace = true
|
conduwuit-database.workspace = true
|
||||||
conduwuit-router.workspace = true
|
conduwuit-router.workspace = true
|
||||||
conduwuit-service.workspace = true
|
conduwuit-service.workspace = true
|
||||||
|
conduwuit-build-metadata.workspace = true
|
||||||
|
|
||||||
clap.workspace = true
|
clap.workspace = true
|
||||||
console-subscriber.optional = true
|
console-subscriber.optional = true
|
||||||
@@ -212,8 +213,6 @@ opentelemetry.optional = true
|
|||||||
opentelemetry.workspace = true
|
opentelemetry.workspace = true
|
||||||
opentelemetry-otlp.optional = true
|
opentelemetry-otlp.optional = true
|
||||||
opentelemetry-otlp.workspace = true
|
opentelemetry-otlp.workspace = true
|
||||||
opentelemetry-jaeger-propagator.optional = true
|
|
||||||
opentelemetry-jaeger-propagator.workspace = true
|
|
||||||
opentelemetry_sdk.optional = true
|
opentelemetry_sdk.optional = true
|
||||||
opentelemetry_sdk.workspace = true
|
opentelemetry_sdk.workspace = true
|
||||||
sentry-tower.optional = true
|
sentry-tower.optional = true
|
||||||
|
|||||||
+1
-1
@@ -94,7 +94,7 @@ pub(crate) fn init(
|
|||||||
|
|
||||||
let otlp_layer = config.allow_otlp.then(|| {
|
let otlp_layer = config.allow_otlp.then(|| {
|
||||||
opentelemetry::global::set_text_map_propagator(
|
opentelemetry::global::set_text_map_propagator(
|
||||||
opentelemetry_jaeger_propagator::Propagator::new(),
|
opentelemetry_sdk::propagation::TraceContextPropagator::new(),
|
||||||
);
|
);
|
||||||
|
|
||||||
let exporter = opentelemetry_otlp::SpanExporter::builder()
|
let exporter = opentelemetry_otlp::SpanExporter::builder()
|
||||||
|
|||||||
+21
-1
@@ -1,10 +1,12 @@
|
|||||||
#![cfg(feature = "sentry_telemetry")]
|
#![cfg(feature = "sentry_telemetry")]
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
|
borrow::Cow,
|
||||||
str::FromStr,
|
str::FromStr,
|
||||||
sync::{Arc, OnceLock},
|
sync::{Arc, OnceLock},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use conduwuit_build_metadata as build;
|
||||||
use conduwuit_core::{config::Config, debug, trace};
|
use conduwuit_core::{config::Config, debug, trace};
|
||||||
use sentry::{
|
use sentry::{
|
||||||
Breadcrumb, ClientOptions, Level,
|
Breadcrumb, ClientOptions, Level,
|
||||||
@@ -44,7 +46,7 @@ fn options(config: &Config) -> ClientOptions {
|
|||||||
server_name,
|
server_name,
|
||||||
traces_sample_rate: config.sentry_traces_sample_rate,
|
traces_sample_rate: config.sentry_traces_sample_rate,
|
||||||
debug: cfg!(debug_assertions),
|
debug: cfg!(debug_assertions),
|
||||||
release: sentry::release_name!(),
|
release: release_name(),
|
||||||
user_agent: conduwuit_core::version::user_agent().into(),
|
user_agent: conduwuit_core::version::user_agent().into(),
|
||||||
attach_stacktrace: config.sentry_attach_stacktrace,
|
attach_stacktrace: config.sentry_attach_stacktrace,
|
||||||
before_send: Some(Arc::new(before_send)),
|
before_send: Some(Arc::new(before_send)),
|
||||||
@@ -91,3 +93,21 @@ fn before_breadcrumb(crumb: Breadcrumb) -> Option<Breadcrumb> {
|
|||||||
trace!("Sentry breadcrumb: {crumb:?}");
|
trace!("Sentry breadcrumb: {crumb:?}");
|
||||||
Some(crumb)
|
Some(crumb)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn release_name() -> Option<Cow<'static, str>> {
|
||||||
|
static RELEASE: OnceLock<Option<String>> = OnceLock::new();
|
||||||
|
|
||||||
|
RELEASE
|
||||||
|
.get_or_init(|| {
|
||||||
|
let pkg_name = env!("CARGO_PKG_NAME");
|
||||||
|
let pkg_version = env!("CARGO_PKG_VERSION");
|
||||||
|
|
||||||
|
if let Some(commit_short) = build::GIT_COMMIT_HASH_SHORT {
|
||||||
|
Some(format!("{pkg_name}@{pkg_version}+{commit_short}"))
|
||||||
|
} else {
|
||||||
|
Some(format!("{pkg_name}@{pkg_version}"))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.as_ref()
|
||||||
|
.map(|s| Cow::Borrowed(s.as_str()))
|
||||||
|
}
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ rustyline-async.workspace = true
|
|||||||
rustyline-async.optional = true
|
rustyline-async.optional = true
|
||||||
serde_json.workspace = true
|
serde_json.workspace = true
|
||||||
serde.workspace = true
|
serde.workspace = true
|
||||||
serde_yml.workspace = true
|
serde-saphyr.workspace = true
|
||||||
sha2.workspace = true
|
sha2.workspace = true
|
||||||
termimad.workspace = true
|
termimad.workspace = true
|
||||||
termimad.optional = true
|
termimad.optional = true
|
||||||
|
|||||||
@@ -271,7 +271,7 @@ impl Service {
|
|||||||
.id_appserviceregistrations
|
.id_appserviceregistrations
|
||||||
.get(id)
|
.get(id)
|
||||||
.await
|
.await
|
||||||
.and_then(|ref bytes| serde_yml::from_slice(bytes).map_err(Into::into))
|
.and_then(|ref bytes| serde_saphyr::from_slice(bytes).map_err(Into::into))
|
||||||
.map_err(|e| err!(Database("Invalid appservice {id:?} registration: {e:?}")))
|
.map_err(|e| err!(Database("Invalid appservice {id:?} registration: {e:?}")))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -188,9 +188,7 @@ impl Service {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tracing::instrument(skip(self), level = "debug")]
|
#[tracing::instrument(skip(self), level = "debug")]
|
||||||
pub fn all_local_aliases<'a>(
|
pub fn all_local_aliases(&self) -> impl Stream<Item = (&RoomId, &str)> + Send + '_ {
|
||||||
&'a self,
|
|
||||||
) -> impl Stream<Item = (&'a RoomId, &'a str)> + Send + 'a {
|
|
||||||
self.db
|
self.db
|
||||||
.alias_roomid
|
.alias_roomid
|
||||||
.stream()
|
.stream()
|
||||||
|
|||||||
Reference in New Issue
Block a user