feat: 还在进行的主从节点重构工作.
This commit is contained in:
36
onedrive-transfer-remote-worker/build.gradle.kts
Normal file
36
onedrive-transfer-remote-worker/build.gradle.kts
Normal file
@ -0,0 +1,36 @@
|
||||
plugins {
|
||||
kotlin("jvm") version "2.1.0"
|
||||
application
|
||||
}
|
||||
|
||||
group = "net.lamgc.scext"
|
||||
version = "0.1.0-SNAPSHOT"
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
application {
|
||||
mainClass = ""
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(project(":onedrive-transfer-remote-common"))
|
||||
|
||||
implementation("org.slf4j:slf4j-api:2.0.11")
|
||||
implementation("io.github.microutils:kotlin-logging:3.0.5")
|
||||
implementation("ch.qos.logback:logback-classic:1.5.15")
|
||||
|
||||
implementation("com.github.ajalt.clikt:clikt:5.0.2")
|
||||
implementation("com.github.ajalt.clikt:clikt-markdown:5.0.2")
|
||||
|
||||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0")
|
||||
implementation("org.jetbrains.kotlin:kotlin-reflect:2.1.0")
|
||||
implementation("com.google.code.gson:gson:2.10.1")
|
||||
|
||||
testImplementation(kotlin("test"))
|
||||
}
|
||||
|
||||
tasks.test {
|
||||
useJUnitPlatform()
|
||||
}
|
35
onedrive-transfer-remote-worker/src/main/kotlin/Main.kt
Normal file
35
onedrive-transfer-remote-worker/src/main/kotlin/Main.kt
Normal file
@ -0,0 +1,35 @@
|
||||
package net.lamgc.scext.onedrive_transfer.remote.worker
|
||||
|
||||
import com.github.ajalt.clikt.core.CliktCommand
|
||||
import com.github.ajalt.clikt.core.main
|
||||
import com.github.ajalt.clikt.parameters.options.*
|
||||
import com.github.ajalt.clikt.parameters.types.ulong
|
||||
import java.io.File
|
||||
import kotlin.math.min
|
||||
|
||||
class Main : CliktCommand("overdrive-transfer-worker") {
|
||||
|
||||
private val host: String by option()
|
||||
.required()
|
||||
.help("Controller URL.")
|
||||
|
||||
private val tempDir: String by option()
|
||||
.help("Temp directory.")
|
||||
.default("./work-temp/")
|
||||
|
||||
private val maxAllowedFileSize by option()
|
||||
.ulong()
|
||||
.help("Max allowed file size.")
|
||||
.defaultLazy {
|
||||
// 获取所在硬盘的大小,最大不超过 4 G
|
||||
val disk = File(tempDir).toPath().root.toFile()
|
||||
return@defaultLazy min(disk.usableSpace, 536870912).toULong()
|
||||
}
|
||||
|
||||
override fun run() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun main(args: Array<String>) = Main().main(args)
|
Reference in New Issue
Block a user