• Home
  • Raw
  • Download

Lines Matching refs:tx

129     fn load_from_db(key_id: i64, tx: &Transaction) -> Result<Self> {  in load_from_db()
130 let mut stmt = tx in load_from_db()
155 fn store_in_db(&self, key_id: i64, tx: &Transaction) -> Result<()> { in store_in_db()
156 let mut stmt = tx in store_in_db()
204 fn load_from_db(blob_id: i64, tx: &Transaction) -> Result<Self> { in load_from_db()
205 let mut stmt = tx in load_from_db()
230 fn store_in_db(&self, blob_id: i64, tx: &Transaction) -> Result<()> { in store_in_db()
231 let mut stmt = tx in store_in_db()
849 db.with_transaction(TransactionBehavior::Immediate, |tx| { in new()
850 versioning::upgrade_database(tx, Self::CURRENT_DB_VERSION, Self::UPGRADERS) in new()
852 Self::init_tables(tx).context("Trying to initialize tables.").no_gc() in new()
859 fn from_0_to_1(tx: &Transaction) -> Result<u32> { in from_0_to_1()
860 tx.execute( in from_0_to_1()
877 fn init_tables(tx: &Transaction) -> Result<()> { in init_tables()
878 tx.execute( in init_tables()
891 tx.execute( in init_tables()
898 tx.execute( in init_tables()
905 tx.execute( in init_tables()
915 tx.execute( in init_tables()
922 tx.execute( in init_tables()
933 tx.execute( in init_tables()
940 tx.execute( in init_tables()
950 tx.execute( in init_tables()
957 tx.execute( in init_tables()
967 tx.execute( in init_tables()
974 tx.execute( in init_tables()
1031 let (total, unused) = self.with_transaction(TransactionBehavior::Deferred, |tx| { in do_table_size_query()
1032 tx.query_row(query, params, |row| Ok((row.get(0)?, row.get(1)?))) in do_table_size_query()
1134 self.with_transaction(TransactionBehavior::Immediate, |tx| { in handle_next_superseded_blobs()
1137 tx.execute( in handle_next_superseded_blobs()
1142 tx.execute("DELETE FROM persistent.blobentry WHERE id = ?;", params![blob_id]) in handle_next_superseded_blobs()
1146 Self::cleanup_unreferenced(tx).context("Trying to cleanup unreferenced.")?; in handle_next_superseded_blobs()
1150 let mut stmt = tx in handle_next_superseded_blobs()
1183 Ok((blob_id, blob, BlobMetaData::load_from_db(blob_id, tx)?)) in handle_next_superseded_blobs()
1193 tx.execute( in handle_next_superseded_blobs()
1223 self.with_transaction(TransactionBehavior::Immediate, |tx| { in cleanup_leftovers()
1224 tx.execute( in cleanup_leftovers()
1244 self.with_transaction(TransactionBehavior::Immediate, |tx| { in key_exists()
1247 let result = Self::load_key_entry_id(&tx, &key_descriptor, key_type); in key_exists()
1271 self.with_transaction(TransactionBehavior::Immediate, |tx| { in store_super_key()
1273 tx.execute( in store_super_key()
1290 key_metadata.store_in_db(key_id, tx).context("KeyMetaData::store_in_db failed")?; in store_super_key()
1293 &tx, in store_super_key()
1301 Self::load_key_components(tx, KeyEntryLoadBits::KM, key_id) in store_super_key()
1316 self.with_transaction(TransactionBehavior::Immediate, |tx| { in load_super_key()
1323 let id = Self::load_key_entry_id(&tx, &key_descriptor, KeyType::Super); in load_super_key()
1326 let key_entry = Self::load_key_components(&tx, KeyEntryLoadBits::KM, id) in load_super_key()
1357 self.with_transaction(TransactionBehavior::Immediate, |tx| { in get_or_create_key_with()
1359 let mut stmt = tx in get_or_create_key_with()
1386 Self::load_key_components(&tx, KeyEntryLoadBits::KM, id) in get_or_create_key_with()
1392 tx.execute( in get_or_create_key_with()
1412 &tx, in get_or_create_key_with()
1447 .and_then(|tx| f(&tx).map(|result| (result, tx))) in with_transaction()
1448 .and_then(|(result, tx)| { in with_transaction()
1449 tx.commit().context("In with_transaction: Failed to commit transaction.")?; in with_transaction()
1496 self.with_transaction(TransactionBehavior::Immediate, |tx| { in create_key_entry()
1497 Self::create_key_entry_internal(tx, domain, namespace, key_type, km_uuid).no_gc() in create_key_entry()
1503 tx: &Transaction, in create_key_entry_internal()
1518 tx.execute( in create_key_entry_internal()
1550 self.with_transaction(TransactionBehavior::Immediate, |tx| { in create_attestation_key_entry()
1553 tx.execute( in create_attestation_key_entry()
1563 &tx, in create_attestation_key_entry()
1572 metadata.store_in_db(key_id.0, &tx)?; in create_attestation_key_entry()
1594 self.with_transaction(TransactionBehavior::Immediate, |tx| { in set_blob()
1595 Self::set_blob_internal(&tx, key_id.0, sc_type, blob, blob_metadata).need_gc() in set_blob()
1607 self.with_transaction(TransactionBehavior::Immediate, |tx| { in set_deleted_blob()
1609 &tx, in set_deleted_blob()
1621 tx: &Transaction, in set_blob_internal()
1629 tx.execute( in set_blob_internal()
1636 let blob_id = tx in set_blob_internal()
1642 .store_in_db(blob_id, tx) in set_blob_internal()
1647 tx.execute( in set_blob_internal()
1666 self.with_transaction(TransactionBehavior::Immediate, |tx| { in insert_keyparameter()
1667 Self::insert_keyparameter_internal(tx, key_id, params).no_gc() in insert_keyparameter()
1673 tx: &Transaction, in insert_keyparameter_internal()
1677 let mut stmt = tx in insert_keyparameter_internal()
1701 self.with_transaction(TransactionBehavior::Immediate, |tx| { in insert_key_metadata()
1702 metadata.store_in_db(key_id.0, &tx).no_gc() in insert_key_metadata()
1719 self.with_transaction(TransactionBehavior::Immediate, |tx| { in store_signed_attestation_certificate_chain()
1720 let mut stmt = tx in store_signed_attestation_certificate_chain()
1749 let num_updated = tx in store_signed_attestation_certificate_chain()
1764 metadata.store_in_db(key_id, &tx).context("Failed to insert key metadata.")?; in store_signed_attestation_certificate_chain()
1766 &tx, in store_signed_attestation_certificate_chain()
1773 Self::set_blob_internal(&tx, key_id, SubComponentType::CERT, Some(batch_cert), None) in store_signed_attestation_certificate_chain()
1802 self.with_transaction(TransactionBehavior::Immediate, |tx| { in assign_attestation_key()
1803 let result = tx in assign_attestation_key()
1855 self.with_transaction(TransactionBehavior::Immediate, |tx| { in fetch_unsigned_attestation_keys()
1856 let mut stmt = tx in fetch_unsigned_attestation_keys()
1894 self.with_transaction(TransactionBehavior::Immediate, |tx| { in delete_expired_attestation_keys()
1895 let mut stmt = tx in delete_expired_attestation_keys()
1917 if Self::mark_unreferenced(&tx, id)? { in delete_expired_attestation_keys()
1931 self.with_transaction(TransactionBehavior::Immediate, |tx| { in delete_all_attestation_keys()
1932 let mut stmt = tx in delete_all_attestation_keys()
1944 .map(|id| Self::mark_unreferenced(&tx, *id)) in delete_all_attestation_keys()
1964 self.with_transaction(TransactionBehavior::Immediate, |tx| { in get_attestation_pool_status()
1965 let mut stmt = tx.prepare( in get_attestation_pool_status()
1991 stmt = tx.prepare( in get_attestation_pool_status()
2040 self.with_transaction(TransactionBehavior::Deferred, |tx| { in retrieve_attestation_key_and_cert_chain()
2041 let mut stmt = tx.prepare( in retrieve_attestation_key_and_cert_chain()
2111 tx: &Transaction, in rebind_alias()
2127 let updated = tx in rebind_alias()
2135 let result = tx in rebind_alias()
2190 self.with_transaction(TransactionBehavior::Immediate, |tx| { in migrate_key_namespace()
2192 if tx in migrate_key_namespace()
2207 let updated = tx in migrate_key_namespace()
2253 self.with_transaction(TransactionBehavior::Immediate, |tx| { in store_new_key()
2254 let key_id = Self::create_key_entry_internal(tx, &domain, namespace, key_type, km_uuid) in store_new_key()
2258 tx, in store_new_key()
2266 Self::set_blob_internal(tx, key_id.id(), SubComponentType::CERT, Some(&cert), None) in store_new_key()
2271 tx, in store_new_key()
2279 Self::insert_keyparameter_internal(tx, &key_id, params) in store_new_key()
2281 metadata.store_in_db(key_id.id(), tx).context("Trying to insert key metadata.")?; in store_new_key()
2282 let need_gc = Self::rebind_alias(tx, &key_id, &alias, &domain, namespace, key_type) in store_new_key()
2312 self.with_transaction(TransactionBehavior::Immediate, |tx| { in store_new_certificate()
2313 let key_id = Self::create_key_entry_internal(tx, &domain, namespace, key_type, km_uuid) in store_new_certificate()
2317 tx, in store_new_certificate()
2330 metadata.store_in_db(key_id.id(), tx).context("Trying to insert key metadata.")?; in store_new_certificate()
2332 let need_gc = Self::rebind_alias(tx, &key_id, &alias, &domain, namespace, key_type) in store_new_certificate()
2342 fn load_key_entry_id(tx: &Transaction, key: &KeyDescriptor, key_type: KeyType) -> Result<i64> { in load_key_entry_id()
2348 let mut stmt = tx in load_key_entry_id()
2384 tx: &Transaction, in load_access_tuple()
2401 let key_id = Self::load_key_entry_id(&tx, &access_key, key_type) in load_access_tuple()
2410 let mut stmt = tx in load_access_tuple()
2437 let mut stmt = tx in load_access_tuple()
2467 let access_vector: Option<i32> = tx in load_access_tuple()
2495 tx: &Transaction, in load_blob_components()
2497 let mut stmt = tx in load_blob_components()
2542 BlobMetaData::load_from_db(blob_id, tx) in load_blob_components()
2550 fn load_key_parameters(key_id: i64, tx: &Transaction) -> Result<Vec<KeyParameter>> { in load_key_parameters()
2551 let mut stmt = tx in load_key_parameters()
2583 self.with_transaction(TransactionBehavior::Immediate, |tx| { in check_and_update_key_usage_count()
2584 let limit: Option<i32> = tx in check_and_update_key_usage_count()
2597 tx.execute( in check_and_update_key_usage_count()
2606 1 => Self::mark_unreferenced(tx, key_id) in check_and_update_key_usage_count()
2668 let tx = self in load_key_entry_internal() localVariable
2675 Self::load_access_tuple(&tx, key, key_type, caller_uid) in load_key_entry_internal()
2693 let (key_id_guard, tx) = match key_id_guard { in load_key_entry_internal()
2697 tx.rollback().context("In load_key_entry: Failed to roll back transaction.")?; in load_key_entry_internal()
2703 let tx = self in load_key_entry_internal() localVariable
2709 &tx, in load_key_entry_internal()
2721 (key_id_guard, tx) in load_key_entry_internal()
2723 Some(l) => (l, tx), in load_key_entry_internal()
2725 Some(key_id_guard) => (key_id_guard, tx), in load_key_entry_internal()
2728 let key_entry = Self::load_key_components(&tx, load_bits, key_id_guard.id()) in load_key_entry_internal()
2731 tx.commit().context("In load_key_entry: Failed to commit transaction.")?; in load_key_entry_internal()
2736 fn mark_unreferenced(tx: &Transaction, key_id: i64) -> Result<bool> { in mark_unreferenced()
2737 let updated = tx in mark_unreferenced()
2740 tx.execute("DELETE FROM persistent.keymetadata WHERE keyentryid = ?;", params![key_id]) in mark_unreferenced()
2742 tx.execute("DELETE FROM persistent.keyparameter WHERE keyentryid = ?;", params![key_id]) in mark_unreferenced()
2744 tx.execute("DELETE FROM persistent.grant WHERE keyentryid = ?;", params![key_id]) in mark_unreferenced()
2760 self.with_transaction(TransactionBehavior::Immediate, |tx| { in unbind_key()
2762 Self::load_access_tuple(tx, key, key_type, caller_uid) in unbind_key()
2770 Self::mark_unreferenced(tx, key_id) in unbind_key()
2777 fn get_key_km_uuid(tx: &Transaction, key_id: i64) -> Result<Uuid> { in get_key_km_uuid()
2778 tx.query_row( in get_key_km_uuid()
2795 self.with_transaction(TransactionBehavior::Immediate, |tx| { in unbind_keys_for_namespace()
2796 tx.execute( in unbind_keys_for_namespace()
2805 tx.execute( in unbind_keys_for_namespace()
2814 tx.execute( in unbind_keys_for_namespace()
2823 tx.execute( in unbind_keys_for_namespace()
2834 fn cleanup_unreferenced(tx: &Transaction) -> Result<()> { in cleanup_unreferenced()
2837 tx.execute( in cleanup_unreferenced()
2846 tx.execute( in cleanup_unreferenced()
2855 tx.execute( in cleanup_unreferenced()
2864 tx.execute( in cleanup_unreferenced()
2886 self.with_transaction(TransactionBehavior::Immediate, |tx| { in unbind_keys_for_user()
2887 let mut stmt = tx in unbind_keys_for_user()
2936 Self::load_blob_components(key_id, KeyEntryLoadBits::KM, tx) in unbind_keys_for_user()
2944 notify_gc = Self::mark_unreferenced(&tx, key_id) in unbind_keys_for_user()
2954 tx: &Transaction, in load_key_components()
2958 let metadata = KeyMetaData::load_from_db(key_id, &tx).context("In load_key_components.")?; in load_key_components()
2961 Self::load_blob_components(key_id, load_bits, &tx) in load_key_components()
2964 let parameters = Self::load_key_parameters(key_id, &tx) in load_key_components()
2967 let km_uuid = Self::get_key_km_uuid(&tx, key_id) in load_key_components()
2993 self.with_transaction(TransactionBehavior::Deferred, |tx| { in list()
2994 let mut stmt = tx in list()
3040 self.with_transaction(TransactionBehavior::Immediate, |tx| { in grant()
3051 Self::load_access_tuple(&tx, key, KeyType::Client, caller_uid) in grant()
3062 let grant_id = if let Some(grant_id) = tx in grant()
3072 tx.execute( in grant()
3082 tx.execute( in grant()
3107 self.with_transaction(TransactionBehavior::Immediate, |tx| { in ungrant()
3111 Self::load_access_tuple(&tx, key, KeyType::Client, caller_uid) in ungrant()
3119 tx.execute( in ungrant()
3191 self.with_transaction(TransactionBehavior::Deferred, |tx| { in load_key_descriptor()
3192 tx.query_row( in load_key_descriptor()
3247 db.with_transaction(TransactionBehavior::Immediate, |tx| { in new_test_db()
3248 KeystoreDB::init_tables(tx).context("Failed to initialize tables.").no_gc() in new_test_db()
3272 db.with_transaction(TransactionBehavior::Immediate, |tx| { in rebind_alias()
3273 KeystoreDB::rebind_alias(tx, newid, alias, &domain, &namespace, KeyType::Client).no_gc() in rebind_alias()
3881 db.with_transaction(TransactionBehavior::Immediate, |tx| { in test_set_blob()
3882 BlobMetaData::load_from_db(id, tx).no_gc() in test_set_blob()
4556 db.with_transaction(TransactionBehavior::Immediate, |tx| { in test_upgrade_0_to_1()
4557 KeystoreDB::from_0_to_1(tx).no_gc() in test_upgrade_0_to_1()
5431 let tx = db.conn.transaction_with_behavior(TransactionBehavior::Immediate)?; in test_last_off_body() localVariable
5432 tx.commit()?; in test_last_off_body()