remove some various unused functions and mark some possibly important ones *for now*

Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
strawberry 2024-04-22 23:54:56 -04:00 committed by June
parent 66bb88a03a
commit 17d0c869b0
11 changed files with 41 additions and 36 deletions

View file

@ -206,6 +206,9 @@ impl Service {
}
/// Checks if a given room id matches any exclusive appservice regex
///
/// TODO: use this?
#[allow(dead_code)]
pub(crate) async fn is_exclusive_room_id(&self, room_id: &RoomId) -> bool {
self.read()
.await

View file

@ -18,9 +18,15 @@ pub(crate) trait Data: Send + Sync {
#[allow(unused_qualifications)] // async traits
async fn watch(&self, user_id: &UserId, device_id: &DeviceId) -> Result<()>;
fn cleanup(&self) -> Result<()>;
/// TODO: use this?
#[allow(dead_code)]
fn flush(&self) -> Result<()>;
fn cork(&self) -> Result<Cork>;
fn cork_and_flush(&self) -> Result<Cork>;
/// TODO: use this?
#[allow(dead_code)]
fn cork_and_sync(&self) -> Result<Cork>;
fn memory_usage(&self) -> String;
fn clear_caches(&self, amount: u32);

View file

@ -207,6 +207,8 @@ impl Service<'_> {
pub(crate) fn cleanup(&self) -> Result<()> { self.db.cleanup() }
/// TODO: use this?
#[allow(dead_code)]
pub(crate) fn flush(&self) -> Result<()> { self.db.flush() }
pub(crate) fn server_name(&self) -> &ServerName { self.config.server_name.as_ref() }
@ -231,10 +233,6 @@ impl Service<'_> {
self.config.allow_public_room_directory_over_federation
}
pub(crate) fn allow_public_room_directory_without_auth(&self) -> bool {
self.config.allow_public_room_directory_without_auth
}
pub(crate) fn allow_device_name_federation(&self) -> bool { self.config.allow_device_name_federation }
pub(crate) fn allow_room_creation(&self) -> bool { self.config.allow_room_creation }
@ -253,8 +251,6 @@ impl Service<'_> {
pub(crate) fn dns_resolver(&self) -> &TokioAsyncResolver { &self.resolver.resolver }
pub(crate) fn query_all_nameservers(&self) -> bool { self.config.query_all_nameservers }
pub(crate) fn actual_destinations(&self) -> &Arc<RwLock<resolver::WellKnownMap>> { &self.resolver.destinations }
pub(crate) fn jwt_decoding_key(&self) -> Option<&jsonwebtoken::DecodingKey> { self.jwt_decoding_key.as_ref() }
@ -269,8 +265,6 @@ impl Service<'_> {
pub(crate) fn turn_secret(&self) -> &String { &self.config.turn_secret }
pub(crate) fn auto_join_rooms(&self) -> &[OwnedRoomId] { &self.config.auto_join_rooms }
pub(crate) fn allow_profile_lookup_federation_requests(&self) -> bool {
self.config.allow_profile_lookup_federation_requests
}
@ -309,46 +303,18 @@ impl Service<'_> {
pub(crate) fn allow_outgoing_presence(&self) -> bool { self.config.allow_outgoing_presence }
pub(crate) fn presence_idle_timeout_s(&self) -> u64 { self.config.presence_idle_timeout_s }
pub(crate) fn presence_offline_timeout_s(&self) -> u64 { self.config.presence_offline_timeout_s }
pub(crate) fn allow_incoming_read_receipts(&self) -> bool { self.config.allow_incoming_read_receipts }
pub(crate) fn allow_outgoing_read_receipts(&self) -> bool { self.config.allow_outgoing_read_receipts }
pub(crate) fn rocksdb_log_level(&self) -> &String { &self.config.rocksdb_log_level }
pub(crate) fn rocksdb_max_log_file_size(&self) -> usize { self.config.rocksdb_max_log_file_size }
pub(crate) fn rocksdb_log_time_to_roll(&self) -> usize { self.config.rocksdb_log_time_to_roll }
pub(crate) fn rocksdb_optimize_for_spinning_disks(&self) -> bool { self.config.rocksdb_optimize_for_spinning_disks }
pub(crate) fn rocksdb_parallelism_threads(&self) -> usize { self.config.rocksdb_parallelism_threads }
pub(crate) fn rocksdb_compression_algo(&self) -> &String { &self.config.rocksdb_compression_algo }
pub(crate) fn rocksdb_compression_level(&self) -> i32 { self.config.rocksdb_compression_level }
pub(crate) fn rocksdb_bottommost_compression_level(&self) -> i32 {
self.config.rocksdb_bottommost_compression_level
}
pub(crate) fn prevent_media_downloads_from(&self) -> &[OwnedServerName] {
&self.config.prevent_media_downloads_from
}
pub(crate) fn forbidden_remote_server_names(&self) -> &[OwnedServerName] {
&self.config.forbidden_remote_server_names
}
pub(crate) fn forbidden_remote_room_directory_server_names(&self) -> &[OwnedServerName] {
&self.config.forbidden_remote_room_directory_server_names
}
pub(crate) fn ip_range_denylist(&self) -> &[String] { &self.config.ip_range_denylist }
pub(crate) fn well_known_support_page(&self) -> &Option<Url> { &self.config.well_known.support_page }
pub(crate) fn well_known_support_role(&self) -> &Option<ContactRole> { &self.config.well_known.support_role }

View file

@ -17,6 +17,8 @@ pub(crate) trait Data: Send + Sync {
fn get_all_media_keys(&self) -> Result<Vec<Vec<u8>>>;
// TODO: use this
#[allow(dead_code)]
fn remove_url_preview(&self, url: &str) -> Result<()>;
fn set_url_preview(&self, url: &str, data: &super::UrlPreviewData, timestamp: std::time::Duration) -> Result<()>;

View file

@ -459,6 +459,8 @@ impl Service {
pub(crate) async fn get_url_preview(&self, url: &str) -> Option<UrlPreviewData> { self.db.get_url_preview(url) }
/// TODO: use this?
#[allow(dead_code)]
pub(crate) async fn remove_url_preview(&self, url: &str) -> Result<()> {
// TODO: also remove the downloaded image
self.db.remove_url_preview(url)

View file

@ -16,6 +16,9 @@ impl Service {
}
/// Returns the pdu from the outlier tree.
///
/// TODO: use this?
#[allow(dead_code)]
pub(crate) fn get_pdu_outlier(&self, event_id: &EventId) -> Result<Option<PduEvent>> {
self.db.get_outlier_pdu(event_id)
}

View file

@ -21,8 +21,14 @@ pub(crate) trait Data: Send + Sync {
fn private_read_set(&self, room_id: &RoomId, user_id: &UserId, count: u64) -> Result<()>;
/// Returns the private read marker.
///
/// TODO: use this?
#[allow(dead_code)]
fn private_read_get(&self, room_id: &RoomId, user_id: &UserId) -> Result<Option<u64>>;
/// Returns the count of the last typing update in this room.
///
/// TODO: use this?
#[allow(dead_code)]
fn last_privateread_update(&self, user_id: &UserId, room_id: &RoomId) -> Result<u64>;
}

View file

@ -47,6 +47,9 @@ pub(crate) trait Data: Send + Sync {
fn room_invited_count(&self, room_id: &RoomId) -> Result<Option<u64>>;
/// Returns an iterator over all User IDs who ever joined a room.
///
/// TODO: use this?
#[allow(dead_code)]
fn room_useroncejoined<'a>(&'a self, room_id: &RoomId) -> Box<dyn Iterator<Item = Result<OwnedUserId>> + 'a>;
/// Returns an iterator over all invited members of a room.
@ -83,5 +86,8 @@ pub(crate) trait Data: Send + Sync {
/// Add the given servers the list to accept or decline invites via for a
/// given room.
///
/// TODO: use this?
#[allow(dead_code)]
fn add_servers_invite_via(&self, room_id: &RoomId, servers: &[OwnedServerName]) -> Result<()>;
}

View file

@ -153,6 +153,9 @@ impl Service {
*/
/// Returns the version of a room, if known
///
/// TODO: use this?
#[allow(dead_code)]
pub(crate) fn get_room_version(&self, room_id: &RoomId) -> Result<Option<RoomVersionId>> {
let create_event = services()
.rooms
@ -188,6 +191,9 @@ impl Service {
/// Returns the pdu.
///
/// Checks the `eventid_outlierpdu` Tree if not found in the timeline.
///
/// TODO: use this?
#[allow(dead_code)]
pub(crate) fn get_non_outlier_pdu(&self, event_id: &EventId) -> Result<Option<PduEvent>> {
self.db.get_non_outlier_pdu(event_id)
}

View file

@ -11,6 +11,9 @@ pub(crate) trait Data: Send + Sync {
fn active_requests_for(&self, destination: &Destination) -> SendingEventTypeIter<'_>;
fn delete_active_request(&self, key: Vec<u8>) -> Result<()>;
fn delete_all_active_requests_for(&self, destination: &Destination) -> Result<()>;
/// TODO: use this?
#[allow(dead_code)]
fn delete_all_requests_for(&self, destination: &Destination) -> Result<()>;
fn queue_requests(&self, requests: &[(&Destination, SendingEventType)]) -> Result<Vec<Vec<u8>>>;
fn queued_requests<'a>(

View file

@ -337,6 +337,8 @@ impl Service {
.add_one_time_key(user_id, device_id, one_time_key_key, one_time_key_value)
}
// TODO: use this ?
#[allow(dead_code)]
pub(crate) fn last_one_time_keys_update(&self, user_id: &UserId) -> Result<u64> {
self.db.last_one_time_keys_update(user_id)
}