struct FilePlayerDataStorage {
save_root: PathBuf,
file_locks: SyncMutex<FxHashMap<PathBuf, Arc<AsyncMutex<()>>>>,
}Fields§
§save_root: PathBuf§file_locks: SyncMutex<FxHashMap<PathBuf, Arc<AsyncMutex<()>>>>Implementations§
Source§impl FilePlayerDataStorage
impl FilePlayerDataStorage
async fn new(save_root: PathBuf) -> Result<Self>
async fn save_domain(&self, domain: &str, player: &Player) -> Result<()>
async fn save_domain_data( &self, domain: &str, uuid: Uuid, data: &PersistentPlayerData, ) -> Result<()>
async fn load_domain( &self, domain: &str, uuid: Uuid, ) -> Result<Option<PersistentPlayerData>>
async fn load_global(&self, uuid: Uuid) -> Result<Option<GlobalPlayerData>>
async fn load_permission_subjects(&self) -> Result<PermissionSubjectIndex>
async fn load_known_players(&self) -> Result<KnownPlayers>
async fn read_known_players_file_locked(path: &Path) -> Result<KnownPlayers>
async fn save_known_players_if_current( &self, players: &KnownPlayers, is_current: impl FnOnce() -> bool + Send, ) -> Result<bool>
async fn save_global(&self, uuid: Uuid, data: &GlobalPlayerData) -> Result<()>
async fn save_permission_subjects( &self, subjects: &PermissionSubjectIndex, ) -> Result<()>
async fn load_player_permissions_file(&self) -> Result<PlayerPermissionsFile>
async fn read_player_permissions_file_locked( &self, path: &Path, ) -> Result<PlayerPermissionsFile>
async fn write_player_permissions_file_locked( &self, path: &Path, file: &PlayerPermissionsFile, ) -> Result<()>
fn global_dir(&self) -> PathBuf
fn global_players_dir(&self) -> PathBuf
fn player_permissions_file(&self) -> PathBuf
fn known_players_file(&self) -> PathBuf
fn domain_players_dir(&self, domain: &str) -> PathBuf
fn player_file(players_dir: &Path, uuid: Uuid) -> PathBuf
fn file_lock(&self, path: &Path) -> Arc<AsyncMutex<()>> ⓘ
async fn write_atomic( &self, players_dir: &Path, uuid: Uuid, bytes: Vec<u8>, ) -> Result<()>
async fn write_atomic_path_locked( final_path: &Path, bytes: Vec<u8>, ) -> Result<()>
fn atomic_temp_path(path: &Path) -> PathBuf
fn atomic_backup_path(path: &Path) -> PathBuf
async fn recover_missing_atomic_path_locked(final_path: &Path) -> Result<bool>
async fn write_synced_file(path: &Path, bytes: &[u8]) -> Result<()>
async fn copy_synced_file(source: &Path, destination: &Path) -> Result<()>
async fn sync_parent(parent: &Path) -> Result<()>
Auto Trait Implementations§
impl !Freeze for FilePlayerDataStorage
impl !RefUnwindSafe for FilePlayerDataStorage
impl !UnwindSafe for FilePlayerDataStorage
impl Send for FilePlayerDataStorage
impl Sync for FilePlayerDataStorage
impl Unpin for FilePlayerDataStorage
impl UnsafeUnpin for FilePlayerDataStorage
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<>>