struct IndexedDBManager {
port: GenericReceiver<IndexedDBThreadMsg>,
idb_base_dir: PathBuf,
databases: HashMap<IndexedDBDescription, IndexedDBEnvironment<SqliteEngine>>,
thread_pool: Arc<ThreadPool>,
serial_number_counter: u64,
connection_queues: HashMap<IndexedDBDescription, VecDeque<OpenRequest>>,
connections: HashMap<IndexedDBDescription, HashSet<Connection>>,
}Fields§
§port: GenericReceiver<IndexedDBThreadMsg>§idb_base_dir: PathBuf§databases: HashMap<IndexedDBDescription, IndexedDBEnvironment<SqliteEngine>>§thread_pool: Arc<ThreadPool>§serial_number_counter: u64A global counter to produce unique transaction ids. TODO: remove once db connections lifecyle is managed. A global counter is only necessary because of how deleting a db currently does not wait for connection to close and transactions to finish.
connection_queues: HashMap<IndexedDBDescription, VecDeque<OpenRequest>>§connections: HashMap<IndexedDBDescription, HashSet<Connection>>Implementations§
Source§impl IndexedDBManager
impl IndexedDBManager
fn new( port: GenericReceiver<IndexedDBThreadMsg>, idb_base_dir: PathBuf, ) -> IndexedDBManager
Source§impl IndexedDBManager
impl IndexedDBManager
fn start(&mut self)
Sourcefn handle_open_transaction_inactive(
&mut self,
name: String,
origin: ImmutableOrigin,
)
fn handle_open_transaction_inactive( &mut self, name: String, origin: ImmutableOrigin, )
Handle when an open transaction becomes inactive.
Sourcefn advance_connection_queue(&mut self, key: IndexedDBDescription)
fn advance_connection_queue(&mut self, key: IndexedDBDescription)
Run the next open request in the queue.
Sourcefn maybe_remove_front_from_queue(&mut self, key: &IndexedDBDescription) -> bool
fn maybe_remove_front_from_queue(&mut self, key: &IndexedDBDescription) -> bool
Remove the record at the front if it is not pending.
Sourcefn abort_pending_upgrade(
&mut self,
name: String,
id: Uuid,
origin: ImmutableOrigin,
)
fn abort_pending_upgrade( &mut self, name: String, id: Uuid, origin: ImmutableOrigin, )
Aborting the current upgrade for an origin. Note: this only reverts the version at this point.
Sourcefn abort_pending_upgrades(
&mut self,
pending_upgrades: HashMap<String, HashSet<Uuid>>,
origin: ImmutableOrigin,
)
fn abort_pending_upgrades( &mut self, pending_upgrades: HashMap<String, HashSet<Uuid>>, origin: ImmutableOrigin, )
Aborting all upgrades for an origin Note: this only reverts the version at this point.
Sourcefn open_a_database_connection(
&mut self,
sender: GenericCallback<BackendResult<OpenDatabaseResult>>,
origin: ImmutableOrigin,
db_name: String,
version: Option<u64>,
id: Uuid,
)
fn open_a_database_connection( &mut self, sender: GenericCallback<BackendResult<OpenDatabaseResult>>, origin: ImmutableOrigin, db_name: String, version: Option<u64>, id: Uuid, )
fn get_database( &self, origin: ImmutableOrigin, db_name: String, ) -> Option<&IndexedDBEnvironment<SqliteEngine>>
fn get_database_mut( &mut self, origin: ImmutableOrigin, db_name: String, ) -> Option<&mut IndexedDBEnvironment<SqliteEngine>>
Sourcefn upgrade_database(
&mut self,
idb_description: IndexedDBDescription,
key: IndexedDBDescription,
new_version: u64,
)
fn upgrade_database( &mut self, idb_description: IndexedDBDescription, key: IndexedDBDescription, new_version: u64, )
https://w3c.github.io/IndexedDB/#upgrade-a-database To upgrade a database with connection (a connection), a new version, and a request, run these steps: TODO: connection and request.
Sourcefn open_database(&mut self, key: IndexedDBDescription)
fn open_database(&mut self, key: IndexedDBDescription)
https://w3c.github.io/IndexedDB/#open-a-database-connection The part where the open request is ready for processing.
Sourcefn start_delete_database(
&mut self,
key: IndexedDBDescription,
id: Uuid,
sender: GenericCallback<BackendResult<u64>>,
)
fn start_delete_database( &mut self, key: IndexedDBDescription, id: Uuid, sender: GenericCallback<BackendResult<u64>>, )
https://www.w3.org/TR/IndexedDB/#delete-a-database The part adding the request to the connection queue.
Sourcefn delete_database(&mut self, key: IndexedDBDescription)
fn delete_database(&mut self, key: IndexedDBDescription)
fn handle_sync_operation(&mut self, operation: SyncOperation)
Auto Trait Implementations§
impl !Freeze for IndexedDBManager
impl !RefUnwindSafe for IndexedDBManager
impl Send for IndexedDBManager
impl !Sync for IndexedDBManager
impl Unpin for IndexedDBManager
impl !UnwindSafe for IndexedDBManager
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
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