Fix warnings

Signed-off-by: trivernis <trivernis@protonmail.com>
pull/5/head
trivernis 3 years ago
parent 745c6bf856
commit acdad7ac7e
Signed by: Trivernis
GPG Key ID: DFFFCC2C7A02DB45

@ -1,6 +1,7 @@
use crate::error::RepoResult;
use multihash::{Code, MultihashDigest};
use crate::error::RepoResult;
/// Creates a new content descriptor for the given file
pub fn create_content_descriptor(bytes: &[u8]) -> Vec<u8> {
Code::Sha2_256.digest(bytes).to_bytes()

@ -1,8 +1,10 @@
use crate::settings::Settings;
use sea_orm::DatabaseConnection;
use std::sync::Arc;
use sea_orm::DatabaseConnection;
use tokio::sync::Mutex;
use crate::settings::Settings;
#[derive(Clone, Default)]
pub struct Context {
pub settings: Arc<Mutex<Settings>>,

@ -1,5 +1,6 @@
use sea_orm::DbErr;
use std::fmt::{Debug, Formatter};
use sea_orm::DbErr;
use thiserror::Error;
pub type RepoResult<T> = Result<T, RepoError>;

@ -1,5 +1,6 @@
use std::io::Result;
use std::path::{Path, PathBuf};
use tokio::fs::{File, OpenOptions};
/// A file that only exists while being owned.

@ -1,11 +1,13 @@
use crate::content_descriptor::{create_content_descriptor, encode_content_descriptor};
use crate::error::RepoResult;
use crate::utils::get_folder_size;
use std::path::PathBuf;
use tokio::fs;
use tokio::fs::{File, OpenOptions};
use tokio::io::{AsyncRead, AsyncReadExt, BufReader};
use crate::content_descriptor::{create_content_descriptor, encode_content_descriptor};
use crate::error::RepoResult;
use crate::utils::get_folder_size;
#[derive(Clone, Debug)]
pub struct FileHashStore {
path: PathBuf,

@ -1,12 +1,14 @@
use crate::error::RepoResult;
use crate::utils::get_folder_size;
use std::fmt::Debug;
use std::io::Result;
use std::path::PathBuf;
use tokio::fs;
use tokio::fs::OpenOptions;
use tokio::io::{AsyncWriteExt, BufWriter};
use crate::error::RepoResult;
use crate::utils::get_folder_size;
#[derive(Clone, Debug)]
pub struct ThumbnailStore {
path: PathBuf,

@ -1,19 +1,21 @@
mod logging;
mod paths;
mod server;
pub mod v1;
use std::fs;
use std::path::PathBuf;
use crate::error::RepoResult;
use crate::settings::v1::SettingsV1;
use config::{Config, FileFormat};
use serde::{Deserialize, Serialize};
use std::fs;
use std::path::PathBuf;
pub use logging::*;
pub use paths::*;
pub use server::*;
use crate::error::RepoResult;
use crate::settings::v1::SettingsV1;
mod logging;
mod paths;
mod server;
pub mod v1;
#[derive(Clone, Debug, Deserialize, Serialize, Default)]
pub struct Settings {
pub server: ServerSettings,

@ -1,6 +1,7 @@
use serde::{Deserialize, Serialize};
use std::path::PathBuf;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct PathSettings {
pub(crate) database_directory: String,

@ -1,6 +1,7 @@
use serde::{Deserialize, Serialize};
use std::net::IpAddr;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Deserialize, Serialize, Default)]
pub struct ServerSettings {
pub tcp: TcpServerSettings,

@ -1,7 +1,9 @@
use crate::error::RepoResult;
use serde::{Deserialize, Serialize};
use std::net::IpAddr;
use serde::{Deserialize, Serialize};
use crate::error::RepoResult;
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct SettingsV1 {
pub listen_address: IpAddr,

@ -1,10 +1,12 @@
use crate::settings::Settings;
use mediarepo_api::types::repo::SizeType;
use std::collections::HashMap;
use std::path::PathBuf;
use mediarepo_api::types::repo::SizeType;
use tokio_graceful_shutdown::SubsystemHandle;
use typemap_rev::TypeMapKey;
use crate::settings::Settings;
pub struct SettingsKey;
impl TypeMapKey for SettingsKey {

@ -1,9 +1,11 @@
use crate::error::RepoResult;
use futures::future;
use std::path::PathBuf;
use futures::future;
use tokio::fs::{self, OpenOptions};
use tokio::io::{AsyncBufReadExt, BufReader};
use crate::error::RepoResult;
/// Parses a normalized tag into its two components of namespace and tag
pub fn parse_namespace_and_tag(norm_tag: String) -> (Option<String>, String) {
norm_tag

@ -1,7 +1,9 @@
use mediarepo_core::error::RepoDatabaseResult;
use std::time::Duration;
use sea_orm::{ConnectOptions, Database, DatabaseConnection};
use sqlx::migrate::MigrateDatabase;
use std::time::Duration;
use mediarepo_core::error::RepoDatabaseResult;
pub mod entities;
pub mod queries;

@ -1,11 +1,13 @@
use mediarepo_core::error::RepoResult;
use sea_orm::DbBackend;
use sea_orm::FromQueryResult;
use sea_orm::{DatabaseConnection, Statement};
use std::collections::HashMap;
use std::fmt::Display;
use std::iter::FromIterator;
use sea_orm::{DatabaseConnection, Statement};
use sea_orm::DbBackend;
use sea_orm::FromQueryResult;
use mediarepo_core::error::RepoResult;
#[derive(Debug, FromQueryResult)]
struct CIDNamespaceTag {
cd_id: i64,

@ -1,12 +1,14 @@
use crate::dto::{AddFileDto, FileDto};
use std::io::Cursor;
use chrono::{Local, NaiveDateTime};
use mediarepo_core::error::RepoResult;
use mediarepo_database::entities::{content_descriptor, file, file_metadata};
use sea_orm::ActiveValue::Set;
use sea_orm::{ActiveModelTrait, ConnectionTrait, DatabaseTransaction};
use std::io::Cursor;
use mediarepo_core::error::RepoResult;
use mediarepo_database::entities::{content_descriptor, file, file_metadata};
use crate::dao::file::FileDao;
use crate::dto::{AddFileDto, FileDto};
impl FileDao {
#[tracing::instrument(level = "debug", skip(self))]

@ -1,11 +1,13 @@
use crate::dao::file::{map_file_and_cd, FileDao};
use crate::dto::FileDto;
use mediarepo_core::error::{RepoError, RepoResult};
use sea_orm::ConnectionTrait;
use sea_orm::prelude::*;
use mediarepo_core::error::{RepoResult};
use mediarepo_database::entities::{
content_descriptor, content_descriptor_tag, file, file_metadata,
};
use sea_orm::prelude::*;
use sea_orm::ConnectionTrait;
use crate::dao::file::{FileDao};
use crate::dto::FileDto;
impl FileDao {
#[tracing::instrument(level = "debug", skip(self))]

@ -1,14 +1,16 @@
use crate::dao::file::{map_cd_and_file, FileDao};
use crate::dto::FileDto;
use chrono::NaiveDateTime;
use sea_orm::{ColumnTrait, EntityTrait, QueryFilter, QuerySelect};
use sea_orm::Condition;
use sea_orm::sea_query::{Alias, Expr, Query, SimpleExpr};
use mediarepo_core::error::RepoResult;
use mediarepo_database::entities::content_descriptor;
use mediarepo_database::entities::content_descriptor_tag;
use mediarepo_database::entities::file;
use mediarepo_database::entities::file_metadata;
use sea_orm::sea_query::{Alias, Expr, Query, SimpleExpr};
use sea_orm::Condition;
use sea_orm::{ColumnTrait, EntityTrait, QueryFilter, QuerySelect};
use crate::dao::file::{FileDao, map_cd_and_file};
use crate::dto::FileDto;
macro_rules! apply_ordering_comparator {
($column:expr, $filter:expr) => {

@ -1,10 +1,12 @@
use crate::dao::{DaoContext, DaoProvider};
use crate::dto::{FileDto, FileMetadataDto, ThumbnailDto};
use mediarepo_core::error::RepoResult;
use mediarepo_database::entities::{content_descriptor, file, file_metadata};
use sea_orm::prelude::*;
use tokio::io::AsyncReadExt;
use mediarepo_core::error::RepoResult;
use mediarepo_database::entities::{content_descriptor, file, file_metadata};
use crate::dao::{DaoContext, DaoProvider};
use crate::dto::{FileDto, FileMetadataDto, ThumbnailDto};
pub mod add;
pub mod delete;
pub mod find;

@ -1,18 +1,20 @@
use crate::dto::{FileDto, FileMetadataDto, ThumbnailDto, UpdateFileDto, UpdateFileMetadataDto};
use std::fmt::Debug;
use std::io::Cursor;
use std::str::FromStr;
use sea_orm::prelude::*;
use sea_orm::ActiveValue::{Set, Unchanged};
use sea_orm::{ConnectionTrait, NotSet};
use mediarepo_core::error::{RepoError, RepoResult};
use mediarepo_core::fs::thumbnail_store::Dimensions;
use mediarepo_core::thumbnailer;
use mediarepo_core::thumbnailer::{Thumbnail, ThumbnailSize};
use mediarepo_core::thumbnailer::{ThumbnailSize};
use mediarepo_database::entities::{content_descriptor, file, file_metadata};
use sea_orm::prelude::*;
use sea_orm::ActiveValue::{Set, Unchanged};
use sea_orm::{ConnectionTrait, NotSet};
use std::fmt::Debug;
use std::io::Cursor;
use std::str::FromStr;
use crate::dao::file::FileDao;
use crate::dao::opt_to_active_val;
use crate::dto::{FileDto, FileMetadataDto, ThumbnailDto, UpdateFileDto, UpdateFileMetadataDto};
impl FileDao {
#[tracing::instrument(level = "debug", skip(self))]

@ -1,12 +1,14 @@
use crate::dao::{DaoContext, DaoProvider};
use sea_orm::ActiveValue::Set;
use sea_orm::ConnectionTrait;
use sea_orm::prelude::*;
use mediarepo_core::content_descriptor::{
convert_v1_descriptor_to_v2, encode_content_descriptor, is_v1_content_descriptor,
};
use mediarepo_core::error::RepoResult;
use mediarepo_database::entities::content_descriptor;
use sea_orm::prelude::*;
use sea_orm::ActiveValue::Set;
use sea_orm::ConnectionTrait;
use crate::dao::{DaoContext, DaoProvider};
pub struct JobDao {
ctx: DaoContext,
@ -30,13 +32,13 @@ impl JobDao {
tracing::info!("Converting content descriptors to v2 format...");
let mut converted_count = 0;
for mut cd in cds {
for cd in cds {
if is_v1_content_descriptor(&cd.descriptor) {
let trx = self.ctx.db.begin().await?;
let src_cd = cd.descriptor;
let dst_cd = convert_v1_descriptor_to_v2(&src_cd)?;
let active_model = content_descriptor::ActiveModel {
let _active_model = content_descriptor::ActiveModel {
id: Set(cd.id),
descriptor: Set(dst_cd.clone()),
};

@ -1,14 +1,16 @@
pub mod file;
pub mod job;
pub mod repo;
pub mod tag;
use sea_orm::{ActiveValue, DatabaseConnection};
use mediarepo_core::fs::file_hash_store::FileHashStore;
use mediarepo_core::fs::thumbnail_store::ThumbnailStore;
use crate::dao::file::FileDao;
use crate::dao::job::JobDao;
use crate::dao::tag::TagDao;
use mediarepo_core::fs::file_hash_store::FileHashStore;
use mediarepo_core::fs::thumbnail_store::ThumbnailStore;
use sea_orm::{ActiveValue, DatabaseConnection};
pub mod file;
pub mod job;
pub mod repo;
pub mod tag;
#[derive(Clone)]
pub struct DaoContext {

@ -1,29 +1,30 @@
use crate::dao::{DaoContext, DaoProvider};
use crate::file_metadata::FileMetadata;
use crate::namespace::Namespace;
use crate::tag::Tag;
use chrono::{Local, NaiveDateTime};
use mediarepo_core::content_descriptor::{
convert_v1_descriptor_to_v2, encode_content_descriptor, is_v1_content_descriptor,
};
use mediarepo_core::error::{RepoError, RepoResult};
use mediarepo_core::fs::file_hash_store::FileHashStore;
use mediarepo_core::fs::thumbnail_store::{Dimensions, ThumbnailStore};
use mediarepo_core::itertools::Itertools;
use mediarepo_core::thumbnailer::ThumbnailSize;
use mediarepo_core::utils::parse_namespace_and_tag;
use mediarepo_database::entities::content_descriptor;
use mediarepo_database::get_database;
use mediarepo_database::queries::analysis::{get_all_counts, Counts};
use sea_orm::DatabaseConnection;
use std::collections::{HashMap, HashSet};
use std::fmt::Debug;
use std::io::Cursor;
use std::iter::FromIterator;
use std::path::PathBuf;
use std::str::FromStr;
use tokio::fs::OpenOptions;
use tokio::io::AsyncReadExt;
use sea_orm::DatabaseConnection;
use mediarepo_core::error::{RepoResult};
use mediarepo_core::fs::file_hash_store::FileHashStore;
use mediarepo_core::fs::thumbnail_store::{ThumbnailStore};
use mediarepo_core::itertools::Itertools;
use mediarepo_core::utils::parse_namespace_and_tag;
use mediarepo_database::get_database;
use mediarepo_database::queries::analysis::{Counts, get_all_counts};
use crate::dao::{DaoContext, DaoProvider};
use crate::file_metadata::FileMetadata;
use crate::namespace::Namespace;
use crate::tag::Tag;
#[derive(Clone)]
pub struct Repo {

@ -1,9 +1,11 @@
use crate::dao::tag::TagDao;
use sea_orm::{ConnectionTrait, DatabaseTransaction};
use sea_orm::ActiveValue::Set;
use sea_orm::prelude::*;
use mediarepo_core::error::RepoResult;
use mediarepo_database::entities::content_descriptor_tag;
use sea_orm::prelude::*;
use sea_orm::ActiveValue::Set;
use sea_orm::{ConnectionTrait, DatabaseTransaction};
use crate::dao::tag::TagDao;
impl TagDao {
#[tracing::instrument(level = "debug", skip(self))]

@ -1,12 +1,14 @@
pub mod mappings;
use sea_orm::prelude::*;
use sea_orm::QuerySelect;
use sea_orm::{JoinType};
use crate::dao::{DaoContext, DaoProvider};
use crate::dto::TagDto;
use mediarepo_core::error::RepoResult;
use mediarepo_database::entities::{content_descriptor, content_descriptor_tag, namespace, tag};
use sea_orm::prelude::*;
use sea_orm::QuerySelect;
use sea_orm::{DatabaseConnection, JoinType};
use crate::dao::{DaoContext, DaoProvider};
use crate::dto::TagDto;
pub mod mappings;
pub struct TagDao {
ctx: DaoContext,

@ -1,11 +1,13 @@
use crate::dto::FileMetadataDto;
use chrono::NaiveDateTime;
use mediarepo_core::content_descriptor::encode_content_descriptor;
use mediarepo_core::mediarepo_api::types::files::FileStatus as ApiFileStatus;
use mediarepo_database::entities::content_descriptor;
use mediarepo_database::entities::file;
use mediarepo_database::entities::file_metadata;
use crate::dto::FileMetadataDto;
#[derive(Clone, Debug)]
pub struct FileDto {
model: file::Model,

@ -1,4 +1,5 @@
use chrono::NaiveDateTime;
use mediarepo_database::entities::file_metadata;
#[derive(Clone, Debug)]

@ -1,11 +1,12 @@
pub use file::*;
pub use file_metadata::*;
pub use namespace::*;
pub use tag::*;
pub use thumbnail::*;
mod file;
mod file_metadata;
mod tag;
mod namespace;
mod thumbnail;
pub use file::*;
pub use file_metadata::*;
pub use tag::*;
pub use namespace::*;
pub use thumbnail::*;

@ -1,5 +1,6 @@
pub use mediarepo_database::entities::tag;
pub use mediarepo_database::entities::namespace;
pub use mediarepo_database::entities::tag;
use crate::dto::NamespaceDto;
#[derive(Clone, Debug)]
@ -12,7 +13,7 @@ impl TagDto {
pub(crate) fn new(model: tag::Model, namespace_model: Option<namespace::Model>) -> Self {
Self {
model,
namespace: namespace_model.map(NamespaceDto::new)
namespace: namespace_model.map(NamespaceDto::new),
}
}

@ -1,10 +1,12 @@
use mediarepo_core::error::RepoResult;
use mediarepo_core::fs::thumbnail_store::Dimensions;
use std::path::PathBuf;
use tokio::fs;
use tokio::fs::{File, OpenOptions};
use tokio::io::BufReader;
use mediarepo_core::error::RepoResult;
use mediarepo_core::fs::thumbnail_store::Dimensions;
#[derive(Clone, Debug)]
pub struct ThumbnailDto {
path: PathBuf,

@ -1,10 +1,12 @@
use mediarepo_core::error::RepoResult;
use mediarepo_database::entities::namespace;
use sea_orm::prelude::*;
use std::fmt::Debug;
use sea_orm::{
Condition, ConnectionTrait, DatabaseBackend, DatabaseConnection, InsertResult, Set, Statement,
};
use std::fmt::Debug;
use sea_orm::prelude::*;
use mediarepo_core::error::RepoResult;
use mediarepo_database::entities::namespace;
#[derive(Clone)]
pub struct Namespace {

@ -1,15 +1,16 @@
use std::fmt::Debug;
use sea_orm::{Condition, DatabaseBackend, DatabaseConnection, JoinType, Set, Statement};
use sea_orm::{InsertResult, QuerySelect};
use sea_orm::prelude::*;
use sea_orm::query::ConnectionTrait;
use sea_orm::sea_query::Expr;
use mediarepo_core::error::RepoResult;
use mediarepo_database::entities::content_descriptor;
use mediarepo_database::entities::content_descriptor_tag;
use mediarepo_database::entities::namespace;
use mediarepo_database::entities::tag;
use sea_orm::prelude::*;
use sea_orm::query::ConnectionTrait;
use sea_orm::sea_query::Expr;
use sea_orm::{Condition, DatabaseBackend, DatabaseConnection, JoinType, Set, Statement};
use sea_orm::{InsertResult, QuerySelect};
use crate::namespace::Namespace;

@ -1,7 +1,9 @@
use crate::dao::repo::Repo;
use std::sync::Arc;
use typemap_rev::TypeMapKey;
use crate::dao::repo::Repo;
pub struct RepoKey;
impl TypeMapKey for RepoKey {

@ -1,3 +1,10 @@
use std::net::SocketAddr;
use std::path::PathBuf;
use std::sync::Arc;
use tokio::net::TcpListener;
use tokio::task::JoinHandle;
use mediarepo_core::bromine::prelude::*;
use mediarepo_core::error::{RepoError, RepoResult};
use mediarepo_core::mediarepo_api::types::misc::InfoResponse;
@ -6,11 +13,6 @@ use mediarepo_core::tokio_graceful_shutdown::SubsystemHandle;
use mediarepo_core::type_keys::{RepoPathKey, SettingsKey, SizeMetadataKey, SubsystemKey};
use mediarepo_logic::dao::repo::Repo;
use mediarepo_logic::type_keys::RepoKey;
use std::net::SocketAddr;
use std::path::PathBuf;
use std::sync::Arc;
use tokio::net::TcpListener;
use tokio::task::JoinHandle;
mod from_model;
mod namespaces;

@ -1,10 +1,5 @@
mod searching;
mod sorting;
use tokio::io::AsyncReadExt;
use crate::from_model::FromModel;
use crate::namespaces::files::searching::find_files_for_filters;
use crate::namespaces::files::sorting::sort_files_by_properties;
use crate::utils::{cd_by_identifier, file_by_identifier, get_repo_from_context};
use mediarepo_core::bromine::prelude::*;
use mediarepo_core::content_descriptor::{create_content_descriptor, encode_content_descriptor};
use mediarepo_core::error::RepoError;
@ -21,7 +16,14 @@ use mediarepo_core::thumbnailer::ThumbnailSize;
use mediarepo_core::utils::parse_namespace_and_tag;
use mediarepo_logic::dao::DaoProvider;
use mediarepo_logic::dto::{AddFileDto, UpdateFileDto, UpdateFileMetadataDto};
use tokio::io::AsyncReadExt;
use crate::from_model::FromModel;
use crate::namespaces::files::searching::find_files_for_filters;
use crate::namespaces::files::sorting::sort_files_by_properties;
use crate::utils::{cd_by_identifier, file_by_identifier, get_repo_from_context};
mod searching;
mod sorting;
pub struct FilesNamespace;

@ -1,15 +1,16 @@
use std::collections::HashMap;
use mediarepo_core::content_descriptor::decode_content_descriptor;
use mediarepo_core::error::RepoResult;
use mediarepo_core::mediarepo_api::types::files::FileStatus as ApiFileStatus;
use mediarepo_core::mediarepo_api::types::filtering::{
FilterExpression, FilterQuery, PropertyQuery, TagQuery, ValueComparator,
};
use mediarepo_logic::dao::file::find::NegatableComparator::{Is, IsNot};
use mediarepo_logic::dao::DaoProvider;
use mediarepo_logic::dao::file::find::{FilterFileProperty, FilterProperty, OrderingComparator};
use mediarepo_logic::dao::file::find::NegatableComparator::{Is, IsNot};
use mediarepo_logic::dao::repo::Repo;
use mediarepo_logic::dao::DaoProvider;
use mediarepo_logic::dto::{FileDto, FileStatus};
use std::collections::HashMap;
#[tracing::instrument(level = "debug", skip(repo))]
pub async fn find_files_for_filters(

@ -1,18 +1,20 @@
use std::cmp::Ordering;
use std::collections::HashMap;
use std::iter::FromIterator;
use chrono::NaiveDateTime;
use compare::Compare;
use rayon::iter::{IntoParallelRefIterator, ParallelIterator};
use mediarepo_core::error::RepoResult;
use mediarepo_core::mediarepo_api::types::filtering::{SortDirection, SortKey};
use mediarepo_database::queries::tags::{
get_cids_with_namespaced_tags, get_content_descriptors_with_tag_count,
};
use mediarepo_logic::dao::repo::Repo;
use mediarepo_logic::dao::DaoProvider;
use mediarepo_logic::dao::repo::Repo;
use mediarepo_logic::dto::{FileDto, FileMetadataDto};
use mediarepo_logic::file_metadata::FileMetadata;
use rayon::iter::{IntoParallelRefIterator, ParallelIterator};
use std::cmp::Ordering;
use std::collections::HashMap;
use std::iter::FromIterator;
pub struct FileSortContext {
name: Option<String>,

@ -1,4 +1,3 @@
use crate::utils::{calculate_size, get_repo_from_context};
use mediarepo_core::bromine::prelude::*;
use mediarepo_core::error::RepoResult;
use mediarepo_core::mediarepo_api::types::jobs::{JobType, RunJobRequest};
@ -6,6 +5,8 @@ use mediarepo_core::mediarepo_api::types::repo::SizeType;
use mediarepo_core::type_keys::SizeMetadataKey;
use mediarepo_logic::dao::DaoProvider;
use crate::utils::{calculate_size, get_repo_from_context};
pub struct JobsNamespace;
impl NamespaceProvider for JobsNamespace {

@ -1,5 +1,5 @@
use crate::from_model::FromModel;
use crate::utils::{file_by_identifier, get_repo_from_context};
use rayon::iter::{IntoParallelIterator, ParallelIterator};
use mediarepo_core::bromine::prelude::*;
use mediarepo_core::content_descriptor::decode_content_descriptor;
use mediarepo_core::mediarepo_api::types::files::{GetFileTagsRequest, GetFilesTagsRequest};
@ -7,7 +7,9 @@ use mediarepo_core::mediarepo_api::types::tags::{
ChangeFileTagsRequest, NamespaceResponse, TagResponse,
};
use mediarepo_logic::dao::DaoProvider;
use rayon::iter::{IntoParallelIterator, ParallelIterator};
use crate::from_model::FromModel;
use crate::utils::{file_by_identifier, get_repo_from_context};
pub struct TagsNamespace;

@ -1,3 +1,7 @@
use std::sync::Arc;
use tokio::fs;
use mediarepo_core::bromine::ipc::context::Context;
use mediarepo_core::content_descriptor::decode_content_descriptor;
use mediarepo_core::error::{RepoError, RepoResult};
@ -5,12 +9,10 @@ use mediarepo_core::mediarepo_api::types::identifier::FileIdentifier;
use mediarepo_core::mediarepo_api::types::repo::SizeType;
use mediarepo_core::type_keys::{RepoPathKey, SettingsKey};
use mediarepo_core::utils::get_folder_size;
use mediarepo_logic::dao::repo::Repo;
use mediarepo_logic::dao::DaoProvider;
use mediarepo_logic::dao::repo::Repo;
use mediarepo_logic::dto::FileDto;
use mediarepo_logic::type_keys::RepoKey;
use std::sync::Arc;
use tokio::fs;
pub async fn get_repo_from_context(ctx: &Context) -> Arc<Repo> {
let data = ctx.data.read().await;

@ -1,21 +1,22 @@
use console_subscriber::ConsoleLayer;
use rolling_file::RollingConditionBasic;
use std::fs;
use std::path::PathBuf;
use mediarepo_core::settings::LoggingSettings;
use console_subscriber::ConsoleLayer;
use rolling_file::RollingConditionBasic;
use tracing::Level;
use tracing_appender::non_blocking::{NonBlocking, WorkerGuard};
use tracing_flame::FlameLayer;
use tracing_log::LogTracer;
use tracing_subscriber::filter::{self, Targets};
use tracing_subscriber::fmt::format::FmtSpan;
use tracing_subscriber::layer::SubscriberExt;
use tracing_subscriber::util::SubscriberInitExt;
use tracing_subscriber::{
fmt::{self},
Layer, Registry,
};
use tracing_subscriber::filter::{self, Targets};
use tracing_subscriber::fmt::format::FmtSpan;
use tracing_subscriber::layer::SubscriberExt;
use tracing_subscriber::util::SubscriberInitExt;
use mediarepo_core::settings::LoggingSettings;
#[allow(dyn_drop)]
pub type DropGuard = Box<dyn Drop>;

@ -1,7 +1,10 @@
use std::env;
use std::path::PathBuf;
use std::time::Duration;
use structopt::StructOpt;
use tokio::fs;
use tokio::io::AsyncWriteExt;
use tokio::runtime;
use tokio::runtime::Runtime;
@ -11,9 +14,6 @@ use mediarepo_core::settings::{PathSettings, Settings};
use mediarepo_core::tokio_graceful_shutdown::{SubsystemHandle, Toplevel};
use mediarepo_logic::dao::repo::Repo;
use mediarepo_socket::start_tcp_server;
use std::env;
use std::time::Duration;
use tokio::io::AsyncWriteExt;
use crate::utils::{create_paths_for_repo, get_repo, load_settings};

@ -1,9 +1,11 @@
use std::path::PathBuf;
use tokio::fs;
use mediarepo_core::error::RepoResult;
use mediarepo_core::settings::v1::SettingsV1;
use mediarepo_core::settings::{PathSettings, Settings};
use mediarepo_core::settings::v1::SettingsV1;
use mediarepo_logic::dao::repo::Repo;
use std::path::PathBuf;
use tokio::fs;
/// Loads the settings from a toml path
pub fn load_settings(root_path: &PathBuf) -> RepoResult<Settings> {

Loading…
Cancel
Save