Single threaded rodeo
This commit is contained in:
parent
a4baa2c792
commit
763ba94e9b
6 changed files with 14 additions and 28 deletions
14
Cargo.lock
generated
14
Cargo.lock
generated
|
@ -526,19 +526,6 @@ dependencies = [
|
|||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dashmap"
|
||||
version = "5.5.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"hashbrown",
|
||||
"lock_api",
|
||||
"once_cell",
|
||||
"parking_lot_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "der"
|
||||
version = "0.7.9"
|
||||
|
@ -1127,7 +1114,6 @@ version = "0.8.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a030549b8dfea08d7981ad0381acb4bc0cdc7a4fd616e3b9659c31dc0a3474fd"
|
||||
dependencies = [
|
||||
"dashmap",
|
||||
"hashbrown",
|
||||
"serde",
|
||||
]
|
||||
|
|
|
@ -19,7 +19,7 @@ getopts = "0.2.21"
|
|||
headers = "0.4"
|
||||
http = "1.1.0"
|
||||
id3 = "1.14.0"
|
||||
lasso2 = { version = "0.8.2", features = ["multi-threaded", "serialize"] }
|
||||
lasso2 = { version = "0.8.2", features = ["serialize"] }
|
||||
lewton = "0.10.2"
|
||||
log = "0.4.22"
|
||||
metaflac = "0.2.7"
|
||||
|
|
|
@ -3,7 +3,7 @@ use std::{
|
|||
sync::{Arc, RwLock},
|
||||
};
|
||||
|
||||
use lasso2::{RodeoReader, ThreadedRodeo};
|
||||
use lasso2::{Rodeo, RodeoReader};
|
||||
use log::{error, info};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tokio::task::spawn_blocking;
|
||||
|
@ -210,7 +210,7 @@ pub struct Index {
|
|||
impl Default for Index {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
strings: ThreadedRodeo::new().into_reader(),
|
||||
strings: Rodeo::new().into_reader(),
|
||||
browser: Default::default(),
|
||||
collection: Default::default(),
|
||||
}
|
||||
|
@ -218,7 +218,7 @@ impl Default for Index {
|
|||
}
|
||||
|
||||
pub struct Builder {
|
||||
strings: ThreadedRodeo,
|
||||
strings: Rodeo,
|
||||
browser_builder: browser::Builder,
|
||||
collection_builder: collection::Builder,
|
||||
}
|
||||
|
@ -226,7 +226,7 @@ pub struct Builder {
|
|||
impl Builder {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
strings: ThreadedRodeo::new(),
|
||||
strings: Rodeo::new(),
|
||||
browser_builder: browser::Builder::default(),
|
||||
collection_builder: collection::Builder::default(),
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ use std::{
|
|||
path::{Path, PathBuf},
|
||||
};
|
||||
|
||||
use lasso2::{RodeoReader, ThreadedRodeo};
|
||||
use lasso2::{Rodeo, RodeoReader};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tinyvec::TinyVec;
|
||||
use trie_rs::{Trie, TrieBuilder};
|
||||
|
@ -105,7 +105,7 @@ pub struct Builder {
|
|||
}
|
||||
|
||||
impl Builder {
|
||||
pub fn add_directory(&mut self, strings: &mut ThreadedRodeo, directory: scanner::Directory) {
|
||||
pub fn add_directory(&mut self, strings: &mut Rodeo, directory: scanner::Directory) {
|
||||
let Some(virtual_path) = directory.virtual_path.get_or_intern(strings) else {
|
||||
return;
|
||||
};
|
||||
|
@ -125,7 +125,7 @@ impl Builder {
|
|||
.insert(storage::File::Directory(virtual_path));
|
||||
}
|
||||
|
||||
pub fn add_song(&mut self, strings: &mut ThreadedRodeo, song: &scanner::Song) {
|
||||
pub fn add_song(&mut self, strings: &mut Rodeo, song: &scanner::Song) {
|
||||
let Some(virtual_path) = (&song.virtual_path).get_or_intern(strings) else {
|
||||
return;
|
||||
};
|
||||
|
|
|
@ -4,7 +4,7 @@ use std::{
|
|||
path::PathBuf,
|
||||
};
|
||||
|
||||
use lasso2::{RodeoReader, ThreadedRodeo};
|
||||
use lasso2::{RodeoReader, Rodeo};
|
||||
use rand::{rngs::ThreadRng, seq::IteratorRandom};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
|
@ -160,7 +160,7 @@ pub struct Builder {
|
|||
}
|
||||
|
||||
impl Builder {
|
||||
pub fn add_song(&mut self, strings: &mut ThreadedRodeo, song: &scanner::Song) {
|
||||
pub fn add_song(&mut self, strings: &mut Rodeo, song: &scanner::Song) {
|
||||
let Some(song) = store_song(strings, song) else {
|
||||
return;
|
||||
};
|
||||
|
|
|
@ -3,7 +3,7 @@ use std::{
|
|||
path::{Path, PathBuf},
|
||||
};
|
||||
|
||||
use lasso2::{RodeoReader, ThreadedRodeo};
|
||||
use lasso2::{RodeoReader, Rodeo};
|
||||
use log::error;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tinyvec::TinyVec;
|
||||
|
@ -87,7 +87,7 @@ impl Song {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn store_song(strings: &mut ThreadedRodeo, song: &scanner::Song) -> Option<Song> {
|
||||
pub fn store_song(strings: &mut Rodeo, song: &scanner::Song) -> Option<Song> {
|
||||
let Some(path) = (&song.path).get_or_intern(strings) else {
|
||||
return None;
|
||||
};
|
||||
|
@ -196,12 +196,12 @@ pub fn fetch_song(strings: &RodeoReader, song: &Song) -> super::Song {
|
|||
}
|
||||
|
||||
pub trait InternPath {
|
||||
fn get_or_intern(self, strings: &mut ThreadedRodeo) -> Option<PathKey>;
|
||||
fn get_or_intern(self, strings: &mut Rodeo) -> Option<PathKey>;
|
||||
fn get(self, strings: &RodeoReader) -> Option<PathKey>;
|
||||
}
|
||||
|
||||
impl<P: AsRef<Path>> InternPath for P {
|
||||
fn get_or_intern(self, strings: &mut ThreadedRodeo) -> Option<PathKey> {
|
||||
fn get_or_intern(self, strings: &mut Rodeo) -> Option<PathKey> {
|
||||
let id = self
|
||||
.as_ref()
|
||||
.as_os_str()
|
||||
|
|
Loading…
Add table
Reference in a new issue