Skip to content

Commit

Permalink
rsc: Correct structure to match cargo expectations
Browse files Browse the repository at this point in the history
  • Loading branch information
V-FEXrt committed May 20, 2024
1 parent b78a0ad commit 918ae76
Show file tree
Hide file tree
Showing 13 changed files with 14 additions and 32 deletions.
8 changes: 0 additions & 8 deletions rust/rsc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,6 @@ name = "rsc"
version = "0.1.0"
edition = "2021"

[[bin]]
name = "rsc"
path = "src/rsc/main.rs"

[[bin]]
name = "rsc_tool"
path = "src/rsc_tool/main.rs"

[dependencies]
entity = { path = "../entity" }
migration = { path = "../migration" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ use sea_orm::{ActiveModelTrait, ActiveValue::*, DatabaseConnection, DbErr, Trans
use std::sync::Arc;
use tracing;

#[path = "../common/database.rs"]
mod database;
use rsc::database;

#[tracing::instrument(skip_all)]
pub async fn add_job(
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion rust/rsc/src/rsc/blob.rs → rust/rsc/src/bin/rsc/blob.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use entity::blob;
use futures::stream::BoxStream;
use futures::TryStreamExt;
use sea_orm::prelude::Uuid;
use sea_orm::{ActiveModelTrait, ActiveValue::*, DatabaseConnection};
use sea_orm::{ActiveValue::*, DatabaseConnection};
use std::sync::Arc;
use tokio_util::bytes::Bytes;
use tracing;
Expand Down
File renamed without changes.
20 changes: 7 additions & 13 deletions rust/rsc/src/rsc/main.rs → rust/rsc/src/bin/rsc/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,30 @@ use axum::{
routing::{get, post},
Router,
};
use chrono::Utc;
use clap::Parser;
use data_encoding::HEXLOWER;
use migration::{Migrator, MigratorTrait};
use rand_core::{OsRng, RngCore};
use rlimit::{getrlimit, Resource};
use rlimit::Resource;
use rsc::{config, database};
use sea_orm::{
prelude::Uuid, ActiveModelTrait, ActiveValue::*, ColumnTrait, ConnectOptions, ConnectionTrait,
Database, DatabaseConnection, EntityTrait, QueryFilter,
};
use std::collections::HashMap;
use std::io::{Error, ErrorKind};
use std::sync::Arc;
use std::time::Duration;
use tracing;

use sea_orm::{
prelude::Uuid, ActiveModelTrait, ActiveValue::*, ColumnTrait, ConnectOptions, ConnectionTrait,
Database, DatabaseConnection, EntityTrait, QueryFilter,
};

use chrono::Utc;

mod add_job;
mod api_key_check;
mod blob;
mod blob_store_impls;
mod read_job;
mod types;

#[path = "../common/config.rs"]
mod config;
#[path = "../common/database.rs"]
mod database;

#[derive(Debug, Parser)]
struct ServerOptions {
#[arg(help = "Specify a config override file", value_name = "CONFIG", long)]
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,13 @@ use clap::{Parser, Subcommand};
use inquire::{Confirm, Text};
use is_terminal::IsTerminal;
use migration::{DbErr, Migrator, MigratorTrait};
use rsc::{config, database};
use sea_orm::{prelude::Uuid, DatabaseConnection};
use std::io::{Error, ErrorKind};
use tracing;

mod table;

#[path = "../common/config.rs"]
mod config;
#[path = "../common/database.rs"]
mod database;

async fn add_api_key(
key: Option<String>,
desc: String,
Expand Down
File renamed without changes.
File renamed without changes.
5 changes: 2 additions & 3 deletions rust/rsc/src/common/database.rs → rust/rsc/src/database.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use chrono::NaiveDateTime;
use data_encoding::BASE64;
use entity::prelude::{
Blob, BlobStore, Job, LocalBlobStore, OutputDir, OutputFile, OutputSymlink, VisibleFile,
Blob, BlobStore, LocalBlobStore, OutputDir, OutputFile, OutputSymlink, VisibleFile,
};
use entity::{
api_key, blob, blob_store, job, local_blob_store, output_dir, output_file, output_symlink,
Expand All @@ -13,8 +13,7 @@ use rand_core::{OsRng, RngCore};
use sea_orm::ExecResult;
use sea_orm::{
prelude::Uuid, ActiveModelTrait, ActiveValue::*, ColumnTrait, ConnectionTrait, DbBackend,
DbErr, DeleteResult, EntityTrait, PaginatorTrait, QueryFilter, QueryOrder, QuerySelect,
Statement,
DbErr, DeleteResult, EntityTrait, PaginatorTrait, QueryFilter, QueryOrder, Statement,
};
use tracing;

Expand Down
2 changes: 2 additions & 0 deletions rust/rsc/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pub mod config;
pub mod database;

0 comments on commit 918ae76

Please sign in to comment.