Skip to content

Commit

Permalink
GH-458 Remove pointless StorageProvider#isFull method
Browse files Browse the repository at this point in the history
  • Loading branch information
dzikoysk committed Sep 7, 2021
1 parent 3c1a1dd commit b430c44
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import com.reposilite.web.http.ErrorResponse
import com.reposilite.web.http.errorResponse
import io.javalin.http.HttpCode
import io.javalin.http.HttpCode.BAD_REQUEST
import io.javalin.http.HttpCode.INSUFFICIENT_STORAGE
import io.javalin.http.HttpCode.NOT_FOUND
import io.javalin.http.HttpCode.UNAUTHORIZED
import panda.std.Result
Expand Down Expand Up @@ -96,10 +95,6 @@ class MavenFacade internal constructor(
return errorResponse(HttpCode.CONFLICT, "Redeployment is not allowed")
}

if (repository.isFull()) {
return errorResponse(INSUFFICIENT_STORAGE, "Not enough storage space available")
}

return repository.putFile(path, deployRequest.content)
.peek { logger.info("DEPLOY Artifact successfully deployed $path by ${deployRequest.by}") }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,6 @@ class Repository internal constructor(
fun isDirectory(file: Path): Boolean =
storageProvider.isDirectory(file)

fun isFull(): Boolean =
storageProvider.isFull()

fun getUsage(): Result<Long, ErrorResponse> =
storageProvider.usage()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ interface StorageProvider {

fun isDirectory(file: Path): Boolean

fun isFull(): Boolean

fun usage(): Result<Long, ErrorResponse>

fun canHold(contentLength: Long): Result<*, ErrorResponse>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,6 @@ internal abstract class FileSystemStorageProvider protected constructor(
override fun usage(): Result<Long, ErrorResponse> =
rootDirectory.size()

override fun isFull(): Boolean =
canHold(0).isErr

override fun shutdown() {}

private fun resolved(file: Path): Path =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import io.javalin.http.ContentType.Companion.OCTET_STREAM
import io.javalin.http.HttpCode
import io.javalin.http.HttpCode.NOT_FOUND
import panda.std.Result
import panda.std.Result.ok
import panda.std.asSuccess
import software.amazon.awssdk.core.sync.RequestBody
import software.amazon.awssdk.services.s3.S3Client
Expand Down Expand Up @@ -223,16 +224,11 @@ internal class S3StorageProvider(
}
*/

override fun isFull(): Boolean {
TODO("Not yet implemented")
}

override fun usage(): Result<Long, ErrorResponse> {
TODO("Not yet implemented")
}
override fun usage(): Result<Long, ErrorResponse> =
ok(-1)

override fun canHold(contentLength: Long): Result<*, ErrorResponse> =
true.asSuccess()
ok(true)

override fun getLogger(): Logger =
journalist.logger
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

0 comments on commit b430c44

Please sign in to comment.