2023-05-09 06:37:07 +00:00
|
|
|
use once_cell::sync::Lazy;
|
|
|
|
|
2023-01-07 09:42:45 +00:00
|
|
|
#[cfg(not(target_arch = "wasm32"))]
|
2022-12-30 08:23:19 +00:00
|
|
|
#[allow(dead_code)]
|
2022-10-16 22:20:39 +00:00
|
|
|
/// Specifies how many concurrent jobs can be buffered in the worker channel.
|
2022-02-26 23:30:19 +00:00
|
|
|
pub const MAX_CONCURRENT_TASKS: usize = 64;
|
|
|
|
|
2023-08-21 22:05:11 +00:00
|
|
|
/// Specifies how deep various forms of computation will go before the query fails
|
2024-02-02 22:10:47 +00:00
|
|
|
/// with [`crate::err::Error::ComputationDepthExceeded`].
|
2023-05-09 06:37:07 +00:00
|
|
|
///
|
|
|
|
/// For reference, use ~15 per MiB of stack in release mode.
|
2023-08-21 22:05:11 +00:00
|
|
|
///
|
|
|
|
/// During query parsing, the total depth of calls to parse values (including arrays, expressions,
|
|
|
|
/// functions, objects, sub-queries), Javascript values, and geometry collections count against
|
|
|
|
/// this limit.
|
|
|
|
///
|
|
|
|
/// During query execution, all potentially-recursive code paths count against this limit. Whereas
|
|
|
|
/// parsing assigns equal weight to each recursion, certain expensive code paths are allowed to
|
|
|
|
/// count for more than one unit of depth during execution.
|
2023-05-10 16:58:04 +00:00
|
|
|
pub static MAX_COMPUTATION_DEPTH: Lazy<u8> = Lazy::new(|| {
|
2023-05-09 06:37:07 +00:00
|
|
|
option_env!("SURREAL_MAX_COMPUTATION_DEPTH").and_then(|s| s.parse::<u8>().ok()).unwrap_or(120)
|
|
|
|
});
|
2022-02-22 14:16:50 +00:00
|
|
|
|
2022-11-01 23:55:33 +00:00
|
|
|
/// Specifies the names of parameters which can not be specified in a query.
|
|
|
|
pub const PROTECTED_PARAM_NAMES: &[&str] = &["auth", "scope", "token", "session"];
|
|
|
|
|
2022-10-16 22:20:39 +00:00
|
|
|
/// The characters which are supported in server record IDs.
|
2022-02-22 14:16:50 +00:00
|
|
|
pub const ID_CHARS: [char; 36] = [
|
|
|
|
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i',
|
|
|
|
'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
|
|
|
|
];
|
2023-06-09 13:45:07 +00:00
|
|
|
|
|
|
|
/// The publicly visible name of the server
|
|
|
|
pub const SERVER_NAME: &str = "SurrealDB";
|
2023-09-08 15:53:26 +00:00
|
|
|
|
|
|
|
/// Datastore processor batch size for scan operations
|
|
|
|
pub const PROCESSOR_BATCH_SIZE: u32 = 50;
|
2023-11-20 14:54:27 +00:00
|
|
|
|
|
|
|
/// Forward all signup/signin query errors to a client trying authenticate to a scope. Do not use in production.
|
|
|
|
pub static INSECURE_FORWARD_SCOPE_ERRORS: Lazy<bool> = Lazy::new(|| {
|
2023-12-12 13:51:43 +00:00
|
|
|
option_env!("SURREAL_INSECURE_FORWARD_SCOPE_ERRORS")
|
|
|
|
.and_then(|s| s.parse::<bool>().ok())
|
|
|
|
.unwrap_or(false)
|
2023-11-20 14:54:27 +00:00
|
|
|
});
|