Skip to content

Commit

Permalink
Remove kitsune-search-server (#359)
Browse files Browse the repository at this point in the history
* Remove kitsune-search-server

* fix deprecated warning
  • Loading branch information
aumetra authored Oct 2, 2023
1 parent 7ac431e commit 51c8e9f
Show file tree
Hide file tree
Showing 40 changed files with 42 additions and 2,211 deletions.
695 changes: 39 additions & 656 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ members = [
"kitsune",
"kitsune-cli",
"kitsune-job-runner",
"kitsune-search-server",
"kitsune-search-server/proto",
"lib/athena",
"lib/post-process",
"lib/speedy-uuid",
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ So, as long as this disclaimer is here, make sure to double check all the change
- `kitsune-cli/`: Kitsune CLI binary
- `kitsune-fe/`: Kitsune frontend project
- `kitsune-job-runner/`: Kitsune dedicated job runner
- `kitsune-search-server/`: Search server for Kitsune
- `lib/`: Libraries made for Kitsune but with no dependencies on Kitsune-specific code. Easily usable by other projects
- `proto/`: Any Protobuf definitions for the Kitsune project
- `public/`: Public web assets
Expand Down
1 change: 0 additions & 1 deletion crates/kitsune-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ zxcvbn = { version = "2.2.2", default-features = false }

[features]
default = []
kitsune-search = ["kitsune-search/kitsune-search"]
mastodon-api = []
meilisearch = ["kitsune-search/meilisearch"]

Expand Down
8 changes: 0 additions & 8 deletions crates/kitsune-core/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,6 @@ pub enum MessagingConfiguration {
InProcess,
}

#[derive(Clone, Deserialize, Serialize)]
#[serde(rename_all = "kebab-case")]
pub struct KitsuneSearchConfiguration {
pub index_server: SmolStr,
pub search_servers: Vec<SmolStr>,
}

#[derive(Clone, Deserialize, Serialize)]
#[serde(rename_all = "kebab-case")]
pub struct MeiliSearchConfiguration {
Expand All @@ -127,7 +120,6 @@ pub struct MeiliSearchConfiguration {
#[derive(Clone, Deserialize, Serialize)]
#[serde(rename_all = "kebab-case", tag = "type")]
pub enum SearchConfiguration {
Kitsune(KitsuneSearchConfiguration),
Meilisearch(MeiliSearchConfiguration),
Sql,
None,
Expand Down
17 changes: 0 additions & 17 deletions crates/kitsune-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,6 @@ use std::{
time::Duration,
};

#[cfg(feature = "kitsune-search")]
use kitsune_search::GrpcSearchService;

#[cfg(feature = "meilisearch")]
use kitsune_search::MeiliSearchService;

Expand Down Expand Up @@ -188,20 +185,6 @@ async fn prepare_search(
db_pool: &PgPool,
) -> eyre::Result<SearchService> {
let service = match search_config {
SearchConfiguration::Kitsune(_config) => {
#[cfg(not(feature = "kitsune-search"))]
panic!("Server compiled without Kitsune Search compatibility");

#[cfg(feature = "kitsune-search")]
#[allow(clippy::used_underscore_binding)]
GrpcSearchService::connect(
&_config.index_server,
_config.search_servers.iter().map(ToString::to_string),
)
.await
.context("Failed to connect to the search servers")?
.into()
}
SearchConfiguration::Meilisearch(_config) => {
#[cfg(not(feature = "meilisearch"))]
panic!("Server compiled without Meilisearch compatibility");
Expand Down
2 changes: 1 addition & 1 deletion crates/kitsune-http-signatures/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ base64-simd = "0.8.0"
derive_builder = "0.12.0"
http = "0.2.9"
rayon = "1.8.0"
ring = { version = "0.16.20", features = ["std"] }
ring = { version = "0.17.0", features = ["std"] }
time = { version = "0.3.29", features = ["formatting", "parsing"] }
thiserror = "1.0.49"
tokio = { version = "1.32.0", features = ["sync"] }
Expand Down
3 changes: 2 additions & 1 deletion crates/kitsune-http-signatures/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,10 @@ impl SigningKey for Ed25519KeyPair {

impl SigningKey for RsaKeyPair {
fn sign(&self, msg: &[u8]) -> Vec<u8> {
let mut signature = vec![0; self.public_modulus_len()];
let mut signature = vec![0; self.public().modulus_len()];
self.sign(&RSA_PKCS1_SHA256, &SystemRandom::new(), msg, &mut signature)
.unwrap();

signature
}
}
Expand Down
6 changes: 0 additions & 6 deletions crates/kitsune-search/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,9 @@ strum = { version = "0.25.0", features = ["derive"] }
thiserror = "1.0.49"
tracing = "0.1.37"

# "kitsune-search" feature
bytes = { version = "1.5.0", optional = true }
kitsune-search-proto = { path = "../../kitsune-search-server/proto", optional = true }
tonic = { version = "0.10.2", optional = true }

# "meilisearch" feature
meilisearch-sdk = { version = "0.24.2", optional = true }

[features]
default = []
kitsune-search = ["dep:bytes", "dep:kitsune-search-proto", "dep:tonic"]
meilisearch = ["dep:meilisearch-sdk"]
8 changes: 0 additions & 8 deletions crates/kitsune-search/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,6 @@ pub enum Error {
#[cfg(feature = "meilisearch")]
#[error(transparent)]
Meilisearch(#[from] meilisearch_sdk::errors::Error),

#[cfg(feature = "kitsune-search")]
#[error(transparent)]
TonicStatus(#[from] tonic::Status),

#[cfg(feature = "kitsune-search")]
#[error(transparent)]
TonicTransport(#[from] tonic::transport::Error),
}

impl<E> From<kitsune_db::PoolError<E>> for Error
Expand Down
172 changes: 0 additions & 172 deletions crates/kitsune-search/src/grpc.rs

This file was deleted.

6 changes: 0 additions & 6 deletions crates/kitsune-search/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,11 @@ use speedy_uuid::Uuid;
use strum::EnumIter;

mod error;
#[cfg(feature = "kitsune-search")]
mod grpc;
#[cfg(feature = "meilisearch")]
mod meilisearch;
mod sql;

pub use self::error::Error;
#[cfg(feature = "kitsune-search")]
pub use self::grpc::SearchService as GrpcSearchService;
#[cfg(feature = "meilisearch")]
pub use self::meilisearch::MeiliSearchService;
pub use self::sql::SearchService as SqlSearchService;
Expand All @@ -31,8 +27,6 @@ type Result<T, E = Error> = std::result::Result<T, E>;
#[derive(Clone)]
#[enum_dispatch(SearchBackend)]
pub enum SearchService {
#[cfg(feature = "kitsune-search")]
Grpc(GrpcSearchService),
#[cfg(feature = "meilisearch")]
Meilisearch(MeiliSearchService),
Noop(NoopSearchService),
Expand Down
16 changes: 0 additions & 16 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ services:
JOB_WORKERS: 1
REDIS_URL: redis://redis:6379
RUST_LOG: debug
SEARCH_INDEX_SERVER: http://backend-search:8080
SEARCH_SERVERS: http://backend-search:8080
volumes:
- upload-data:/app/uploads
- type: bind
Expand All @@ -28,20 +26,6 @@ services:
- db
- redis

backend-search:
image: kitsune-search
networks:
- backend
environment:
INDEX_DIR_PATH: search-index
LEVENSHTEIN_DISTANCE: 2
MEMORY_ARENA_SIZE: 3MB
PORT: 8080
READ_ONLY: false
RUST_LOG: debug
volumes:
- search-index:/app/search-index

db:
image: postgres:15-alpine
environment:
Expand Down
5 changes: 0 additions & 5 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,6 @@
cargoBuildFlags = "-p kitsune";
});

search = rustPlatform.buildRustPackage (basePackage // {
pname = "kitsune-search";
cargoBuildFlags = "-p kitsune-search";
});

frontend = pkgs.mkYarnPackage {
inherit version;

Expand Down
8 changes: 0 additions & 8 deletions kitsune-search-server/.env

This file was deleted.

1 change: 0 additions & 1 deletion kitsune-search-server/.gitignore

This file was deleted.

Loading

0 comments on commit 51c8e9f

Please sign in to comment.