mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-04 17:38:10 +00:00
remove dead code
This commit is contained in:
1 parent
ce3ed46903
commit
9475b7ef20
12 files changed
+1
-154
No files matched your search
Whitespace-only changes.
Whitespace-only changes.
@@ -1,10 +0,0 @@
|
||||
pub mod frontend_subscriber_id;
|
||||
pub mod frontend_subscriber_payload;
|
||||
pub mod task_provider;
|
||||
pub mod task;
|
||||
pub mod task_id;
|
||||
pub mod task_pool;
|
||||
pub mod task_type;
|
||||
mod task_provider_job_id;
|
||||
mod task_state;
|
||||
pub mod task_database;
|
||||
@@ -1,42 +0,0 @@
|
||||
use multi_index_map::MultiIndexMap;
|
||||
use crate::core::tasks::task_id::TaskId;
|
||||
use crate::core::tasks::task_provider::TaskProvider;
|
||||
use crate::core::tasks::task_provider_job_id::TaskProviderJobId;
|
||||
use crate::core::tasks::task_state::TaskState;
|
||||
use crate::core::tasks::task_type::TaskType;
|
||||
|
||||
/// The provider's native identifier for the task.
|
||||
pub type ProviderTaskId = String;
|
||||
|
||||
#[derive(MultiIndexMap, Debug, Clone)]
|
||||
#[multi_index_derive(Debug)]
|
||||
#[multi_index_hash(rustc_hash::FxBuildHasher)]
|
||||
pub struct Task {
|
||||
#[multi_index(hashed_unique)]
|
||||
pub id: TaskId,
|
||||
|
||||
#[multi_index(hashed_non_unique)]
|
||||
pub task_state: TaskState,
|
||||
|
||||
pub task_type: Option<TaskType>,
|
||||
|
||||
#[multi_index(hashed_non_unique)]
|
||||
pub provider: Option<TaskProvider>,
|
||||
|
||||
/// Identifier used by the provider to track the job.
|
||||
#[multi_index(hashed_unique)]
|
||||
pub provider_job_id: Option<TaskProviderJobId>,
|
||||
|
||||
/// If the frontend is subscribing, it might have an identifier
|
||||
pub frontend_subscriber_id: Option<String>,
|
||||
|
||||
/// If the frontend is subscribing, it might have a payload.
|
||||
/// This is opaque, but could be for instance base64-encoded JSON.
|
||||
pub frontend_subscriber_payload: Option<String>,
|
||||
|
||||
// TODO: Submitted and completion datetimes
|
||||
|
||||
// TODO: Progress
|
||||
|
||||
// TODO: Completion media file, completion batch token
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
|
||||
pub struct TaskDatabase {
|
||||
pub pool: Pool<Sqlite>,
|
||||
}
|
||||
|
||||
impl Database {
|
||||
pub async fn new(app_handle: &AppHandle) -> Result<Self> {
|
||||
let app_dir = app_handle
|
||||
.path_resolver()
|
||||
.app_data_dir()
|
||||
.expect("failed to get app dir");
|
||||
|
||||
// Ensure the app directory exists
|
||||
fs::create_dir_all(&app_dir)?;
|
||||
|
||||
let db_path = app_dir.join("grid_search.db");
|
||||
|
||||
// Set the DATABASE_URL environment variable to point to this SQLite file
|
||||
env::set_var("DATABASE_URL", format!("sqlite://{}", db_path.display()));
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
use idempotency::uuid::generate_random_uuid;
|
||||
|
||||
/// Our identifier for tasks.
|
||||
/// These are ephemeral (for now), but may be peristed later on.
|
||||
#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
|
||||
pub struct TaskId(String);
|
||||
|
||||
impl TaskId {
|
||||
pub fn generate() -> Self {
|
||||
let task_id = format!("tauri_task_{}", generate_random_uuid());
|
||||
Self(task_id)
|
||||
}
|
||||
|
||||
pub fn from_str(task_id: &str) -> Self {
|
||||
Self(task_id.to_string())
|
||||
}
|
||||
|
||||
pub fn to_string(&self) -> String {
|
||||
self.0.clone()
|
||||
}
|
||||
|
||||
pub fn as_str(&self) -> &str {
|
||||
self.0.as_str()
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
|
||||
/// Hand-rolling this instead of SQLite for now.
|
||||
/// Not sure if SQLite will create crazy build issues.
|
||||
/// Can replace with SQLite later, perhaps.
|
||||
pub struct TaskPool {
|
||||
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
|
||||
|
||||
#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
|
||||
pub enum TaskProvider {
|
||||
Artcraft,
|
||||
Fal,
|
||||
Sora,
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
use tokens::tokens::generic_inference_jobs::InferenceJobToken;
|
||||
|
||||
#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
|
||||
pub struct TaskProviderJobId(String);
|
||||
|
||||
impl TaskProviderJobId {
|
||||
pub fn from_str(job_id: &str) -> Self {
|
||||
Self(job_id.to_string())
|
||||
}
|
||||
|
||||
pub fn from_artcraft_job_id(job_id: InferenceJobToken) -> Self {
|
||||
Self(job_id.to_string())
|
||||
}
|
||||
|
||||
pub fn to_string(&self) -> String {
|
||||
self.0.clone()
|
||||
}
|
||||
|
||||
pub fn as_str(&self) -> &str {
|
||||
self.0.as_str()
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
|
||||
#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
|
||||
pub enum TaskState {
|
||||
Submitted,
|
||||
InProgress,
|
||||
|
||||
// Terminal states
|
||||
|
||||
Complete,
|
||||
Failed,
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
|
||||
#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
|
||||
pub enum TaskType {
|
||||
BackgroundRemoval,
|
||||
ImageGeneration,
|
||||
VideoGeneration,
|
||||
}
|
||||
@@ -13,7 +13,7 @@ pub fn best_window_size_heuristic(window: &Window) -> AnyhowResult<PhysicalSize<
|
||||
// prefer the outer size.
|
||||
let inner = window.inner_size()?;
|
||||
let outer = window.outer_size()?;
|
||||
|
||||
|
||||
let height_delta = outer.height.saturating_sub(inner.height);
|
||||
if height_delta > HEIGHT_DIFFERENCE_THRESHOLD {
|
||||
// Dev tools are open, use the outer size
|
||||
|
||||
Reference in new issue
Block a user