Fix Rust compile
This commit is contained in:
parent
9233a4f314
commit
7b9287ca52
5 changed files with 10 additions and 10 deletions
|
|
@ -70,7 +70,6 @@ pub struct WebSocketVaultUpdate {
|
||||||
pub enum WebSocketClientMessage {
|
pub enum WebSocketClientMessage {
|
||||||
Handshake(WebSocketHandshake),
|
Handshake(WebSocketHandshake),
|
||||||
CursorPositions(CursorPositionFromClient),
|
CursorPositions(CursorPositionFromClient),
|
||||||
Ping {},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(TS, Serialize, Clone, Debug)]
|
#[derive(TS, Serialize, Clone, Debug)]
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ use log::debug;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
consts::{DEFAULT_LOG_DIRECTORY, DEFAULT_LOG_LEVEL, DEFAULT_LOG_ROTATION_INTERVAL},
|
consts::{DEFAULT_LOG_DIRECTORY, DEFAULT_LOG_LEVEL, DEFAULT_LOG_ROTATION_INTERVAL, DURATION_ZERO},
|
||||||
utils::log_level::LogLevel,
|
utils::log_level::LogLevel,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -27,7 +27,7 @@ impl LoggingConfig {
|
||||||
!self.log_directory.is_empty(),
|
!self.log_directory.is_empty(),
|
||||||
"log_directory must not be an empty string"
|
"log_directory must not be an empty string"
|
||||||
);
|
);
|
||||||
ensure!(self.log_rotation > 0, "log_rotation must be greater than 0");
|
ensure!(self.log_rotation > DURATION_ZERO, "log_rotation must be greater than 0");
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ use crate::consts::{
|
||||||
DEFAULT_ALLOWED_ORIGINS, DEFAULT_BROADCAST_CHANNEL_CAPACITY, DEFAULT_HOST,
|
DEFAULT_ALLOWED_ORIGINS, DEFAULT_BROADCAST_CHANNEL_CAPACITY, DEFAULT_HOST,
|
||||||
DEFAULT_MAX_BODY_SIZE_MB, DEFAULT_MAX_CLIENTS_PER_VAULT, DEFAULT_MAX_PENDING_WS_CONNECTIONS,
|
DEFAULT_MAX_BODY_SIZE_MB, DEFAULT_MAX_CLIENTS_PER_VAULT, DEFAULT_MAX_PENDING_WS_CONNECTIONS,
|
||||||
DEFAULT_MERGEABLE_FILE_EXTENSIONS, DEFAULT_PORT, DEFAULT_RATE_LIMIT_PER_USER_PER_SECOND,
|
DEFAULT_MERGEABLE_FILE_EXTENSIONS, DEFAULT_PORT, DEFAULT_RATE_LIMIT_PER_USER_PER_SECOND,
|
||||||
DEFAULT_RESPONSE_TIMEOUT_SECONDS,
|
DEFAULT_RESPONSE_TIMEOUT_SECONDS, DURATION_ZERO,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Clone, Default)]
|
#[derive(Debug, Deserialize, Serialize, Clone, Default)]
|
||||||
|
|
@ -35,7 +35,7 @@ pub struct ServerConfig {
|
||||||
|
|
||||||
/// Per-user maximum requests per second (keyed by bearer token).
|
/// Per-user maximum requests per second (keyed by bearer token).
|
||||||
/// `None` disables rate limiting.
|
/// `None` disables rate limiting.
|
||||||
#[serde(default = "DEFAULT_RATE_LIMIT_PER_USER_PER_SECOND")]
|
#[serde(default = "default_rate_limit_per_user_per_second")]
|
||||||
pub rate_limit_per_user_per_second: Option<u64>,
|
pub rate_limit_per_user_per_second: Option<u64>,
|
||||||
|
|
||||||
/// Allowed CORS origins. Default: `["*"]` (allow all).
|
/// Allowed CORS origins. Default: `["*"]` (allow all).
|
||||||
|
|
@ -52,7 +52,7 @@ pub struct ServerConfig {
|
||||||
impl ServerConfig {
|
impl ServerConfig {
|
||||||
pub fn validate(&self) -> Result<()> {
|
pub fn validate(&self) -> Result<()> {
|
||||||
ensure!(
|
ensure!(
|
||||||
self.response_timeout > 0,
|
self.response_timeout > DURATION_ZERO,
|
||||||
"response_timeout must be greater than 0"
|
"response_timeout must be greater than 0"
|
||||||
);
|
);
|
||||||
ensure!(
|
ensure!(
|
||||||
|
|
@ -114,7 +114,7 @@ fn default_mergeable_file_extensions() -> Vec<String> {
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn DEFAULT_RATE_LIMIT_PER_USER_PER_SECOND() -> Option<u64> {
|
fn default_rate_limit_per_user_per_second() -> Option<u64> {
|
||||||
debug!("Using default rate limit per second: {DEFAULT_RATE_LIMIT_PER_USER_PER_SECOND:?}");
|
debug!("Using default rate limit per second: {DEFAULT_RATE_LIMIT_PER_USER_PER_SECOND:?}");
|
||||||
DEFAULT_RATE_LIMIT_PER_USER_PER_SECOND
|
DEFAULT_RATE_LIMIT_PER_USER_PER_SECOND
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@ use std::time::Duration;
|
||||||
|
|
||||||
use crate::utils::log_level::LogLevel;
|
use crate::utils::log_level::LogLevel;
|
||||||
|
|
||||||
|
pub const DURATION_ZERO: Duration = Duration::from_secs(0);
|
||||||
|
|
||||||
pub const DEFAULT_CONFIG_PATH: &str = "config.yml";
|
pub const DEFAULT_CONFIG_PATH: &str = "config.yml";
|
||||||
|
|
||||||
pub const DEFAULT_DATABASES_DIRECTORY_PATH: &str = "databases";
|
pub const DEFAULT_DATABASES_DIRECTORY_PATH: &str = "databases";
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ use axum::{
|
||||||
};
|
};
|
||||||
use axum_extra::TypedHeader;
|
use axum_extra::TypedHeader;
|
||||||
use axum_typed_multipart::TypedMultipart;
|
use axum_typed_multipart::TypedMultipart;
|
||||||
use futures::io::Write;
|
|
||||||
use log::{debug, info};
|
use log::{debug, info};
|
||||||
use reconcile_text::{BuiltinTokenizer, EditedText, reconcile};
|
use reconcile_text::{BuiltinTokenizer, EditedText, reconcile};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
|
|
@ -56,7 +55,7 @@ pub async fn update_binary(
|
||||||
get_parent_document(&state, &vault_id, &document_id, request.parent_version_id).await?;
|
get_parent_document(&state, &vault_id, &document_id, request.parent_version_id).await?;
|
||||||
let content = request.content.contents.to_vec();
|
let content = request.content.contents.to_vec();
|
||||||
|
|
||||||
let mut transaction = state
|
let transaction = state
|
||||||
.database
|
.database
|
||||||
.create_write_transaction(&vault_id)
|
.create_write_transaction(&vault_id)
|
||||||
.await
|
.await
|
||||||
|
|
@ -102,7 +101,7 @@ pub async fn update_text(
|
||||||
|
|
||||||
let content = edited_text.apply().text().into_bytes();
|
let content = edited_text.apply().text().into_bytes();
|
||||||
|
|
||||||
let mut transaction = state
|
let transaction = state
|
||||||
.database
|
.database
|
||||||
.create_write_transaction(&vault_id)
|
.create_write_transaction(&vault_id)
|
||||||
.await
|
.await
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue