pub struct PlayerDataStorage {
backend: PlayerDataStorageBackend,
}Expand description
Manages player data persistence.
Fields§
§backend: PlayerDataStorageBackendImplementations§
Source§impl PlayerDataStorage
impl PlayerDataStorage
Sourcepub async fn new(
save_root: PathBuf,
selection: StorageSelection,
) -> Result<Self>
pub async fn new( save_root: PathBuf, selection: StorageSelection, ) -> Result<Self>
Creates player data storage from config.
Sourcepub async fn save(&self, player: &Player) -> Result<()>
pub async fn save(&self, player: &Player) -> Result<()>
Saves a player’s current domain data and global last-active-domain.
Sourcepub async fn save_domain(&self, domain: &str, player: &Player) -> Result<()>
pub async fn save_domain(&self, domain: &str, player: &Player) -> Result<()>
Saves a player’s data for a specific domain.
Sourcepub async fn save_domain_data(
&self,
domain: &str,
uuid: Uuid,
data: &PersistentPlayerData,
) -> Result<()>
pub async fn save_domain_data( &self, domain: &str, uuid: Uuid, data: &PersistentPlayerData, ) -> Result<()>
Saves an already captured player data snapshot for a specific domain.
Sourcepub async fn load_domain(
&self,
domain: &str,
uuid: Uuid,
) -> Result<Option<PersistentPlayerData>>
pub async fn load_domain( &self, domain: &str, uuid: Uuid, ) -> Result<Option<PersistentPlayerData>>
Loads a player’s data for a specific domain.
Sourcepub async fn load_global(&self, uuid: Uuid) -> Result<Option<GlobalPlayerData>>
pub async fn load_global(&self, uuid: Uuid) -> Result<Option<GlobalPlayerData>>
Loads server-wide player data.
Sourcepub async fn load_permission_subjects(&self) -> Result<PermissionSubjectIndex>
pub async fn load_permission_subjects(&self) -> Result<PermissionSubjectIndex>
Loads all persisted player permission snapshots.
Sourcepub async fn load_known_players(&self) -> Result<KnownPlayers>
pub async fn load_known_players(&self) -> Result<KnownPlayers>
Loads the rebuildable player identity cache, falling back to empty on failure.
Sourcepub async fn save_known_players_if_current(
&self,
players: &KnownPlayers,
is_current: impl FnOnce() -> bool + Send,
) -> Result<bool>
pub async fn save_known_players_if_current( &self, players: &KnownPlayers, is_current: impl FnOnce() -> bool + Send, ) -> Result<bool>
Persists the identity cache when the caller’s snapshot is still current.
Sourcepub async fn save_global(
&self,
uuid: Uuid,
data: &GlobalPlayerData,
) -> Result<()>
pub async fn save_global( &self, uuid: Uuid, data: &GlobalPlayerData, ) -> Result<()>
Saves server-wide player data.
Sourcepub async fn save_permission_subjects(
&self,
subjects: &PermissionSubjectIndex,
) -> Result<()>
pub async fn save_permission_subjects( &self, subjects: &PermissionSubjectIndex, ) -> Result<()>
Persists the server’s complete UUID-keyed permission snapshot.
Auto Trait Implementations§
impl !Freeze for PlayerDataStorage
impl !RefUnwindSafe for PlayerDataStorage
impl !UnwindSafe for PlayerDataStorage
impl Send for PlayerDataStorage
impl Sync for PlayerDataStorage
impl Unpin for PlayerDataStorage
impl UnsafeUnpin for PlayerDataStorage
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
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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> ⓘ
Converts
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> ⓘ
Converts
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 moreWraps this value in an
Arc<SyncMutex<>>