#[non_exhaustive]pub struct StorageConfig {
pub max_object_bytes: usize,
pub max_objects_per_user: u32,
pub max_bytes_per_user: u64,
pub write_rate: u32,
pub write_rate_window_secs: u32,
pub server_collections: Vec<String>,
pub admin_in_openapi: bool,
}storage only.Expand description
The storage module’s settings. Build in code from StorageConfig::default by changing
fields, or let the module read [modules.storage].
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.max_object_bytes: usizeThe largest value, in bytes of its JSON. Default 256 KiB (the protocol’s default); at most 4 MiB (a batch read of larger objects may then exceed the batch budget and answer 413).
max_objects_per_user: u32The most objects one user may own (over it: 403 quota_exceeded). Default 1000. Counts
every object, but only the owner’s own writes are refused by it (server code and admins
may always write).
max_bytes_per_user: u64The most bytes (of value JSON) all of one user’s objects may hold together (over it: 403
quota_exceeded). Default 4 MiB (DEFAULT_MAX_BYTES_PER_USER): sixteen objects of the
largest default size, or hundreds of typical saves, and a bounded disk cost per account
(10 000 accounts at most ~40 GiB). Like the object quota it binds only the owner’s writes.
write_rate: u32Owner writes (PUT, DELETE, each batch put) per user within write_rate_window_secs, as a
token bucket: a burst of this many, then one every window / write_rate (over it: 429
rate_limited + retry_after_ms). Default 60 (per 60 s: a burst of 60, then one a second).
0 = no limit. Server code and admins are not limited.
write_rate_window_secs: u32The window of write_rate, seconds. Default 60.
server_collections: Vec<String>Server-owned collections: the owner may read objects there but never create, change or
delete one (403 forbidden), so a player cannot pre-create an object the server will own
(e.g. wallet/gold). An entry x covers the collection x and every collection starting
with x. (server covers server and server.wallet). New objects that server code or an
admin creates there are server-locked unless write says otherwise. Default ["server"].
admin_in_openapi: boolList the /v1/admin/users/{user}/storage routes in the OpenAPI document. Default false
(like the auth module’s admin routes).
Implementations§
Source§impl StorageConfig
impl StorageConfig
Sourcepub fn is_server_collection(&self, collection: &str) -> bool
pub fn is_server_collection(&self, collection: &str) -> bool
Whether the owner may never write in collection (server_collections).
Sourcepub fn put_body_limit(&self) -> usize
pub fn put_body_limit(&self) -> usize
The request body limit of a single-object PUT: the value plus room for the envelope (at
least the protocol’s PUT_BODY_LIMIT_BYTES).
Trait Implementations§
Source§impl Clone for StorageConfig
impl Clone for StorageConfig
Source§impl Debug for StorageConfig
impl Debug for StorageConfig
Source§impl Default for StorageConfig
impl Default for StorageConfig
Source§impl<'de> Deserialize<'de> for StorageConfigwhere
StorageConfig: Default,
impl<'de> Deserialize<'de> for StorageConfigwhere
StorageConfig: Default,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for StorageConfig
impl RefUnwindSafe for StorageConfig
impl Send for StorageConfig
impl Sync for StorageConfig
impl Unpin for StorageConfig
impl UnsafeUnpin for StorageConfig
impl UnwindSafe for StorageConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more