Skip to content

Commit

Permalink
Merge pull request #1332 from felixncheng/release-1.3.23
Browse files Browse the repository at this point in the history
feat: 增加归档文件报错信息 #1330
  • Loading branch information
owenlxu authored Oct 26, 2023
2 parents 49ad401 + 7e953da commit cee8a44
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ enum class CommonMessageCode(private val key: String) : MessageCode {
RESOURCE_EXISTED("system.resource.existed"),
RESOURCE_NOT_FOUND("system.resource.not-found"),
RESOURCE_EXPIRED("system.resource.expired"),
RESOURCE_ARCHIVED("system.resource.archived"),
METHOD_NOT_ALLOWED("system.method.not-allowed"),
REQUEST_DENIED("system.request.denied"),
REQUEST_UNAUTHENTICATED("system.request.unauthenticated"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ class StorageManager(
if (range.isEmpty() || request?.method == HttpMethod.HEAD.name) {
return ArtifactInputStream(EmptyInputStream.INSTANCE, range)
}
if (node.archived == true) {
throw ErrorCodeException(CommonMessageCode.RESOURCE_ARCHIVED, node.fullPath)
}
val nodeResource = nodeResourceFactoryImpl.getNodeResource(node, range, storageCredentials)
return nodeResource.getArtifactInputStream()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ system.parameter.empty=Parameter [{0}] should not be empty
system.parameter.invalid=Parameter [{0}] is invalid
system.request.content.invalid=Invalid request content
system.resource.existed=Resource [{0}] existed
system.resource.archived=Resource [{0}] archived
system.resource.not-found=Resource [{0}] not found
system.resource.expired=Resource [{0}] expired
system.method.not-allowed=Method not allowed, reason: {0}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ system.parameter.empty=参数[{0}]不能为空
system.parameter.invalid=参数[{0}]无效
system.request.content.invalid=请求内容无效
system.resource.exist=资源[{0}]已存在
system.resource.archived=资源[{0}]已归档
system.resource.not-found=资源[{0}]不存在
system.resource.expired=资源[{0}]已过期
system.method.not-allowed=不支持的操作, 原因: {0}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ system.request.content.invalid=請求內容無效
system.resource.existed=資源[{0}]已存在
system.resource.not-found=資源[{0}]不存在
system.resource.expired=資源[{0}]已過期
system.resource.archived=資源[{0}]已歸檔
system.method.not-allowed=不支持的操作, 原因: {0}
system.request.denied=訪問被拒絕: {0}
system.request.unauthenticated=認證失敗: {0}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ data class NodeDetail(
@ApiModelProperty("所属仓库名称")
val repoName: String = nodeInfo.repoName,
@ApiModelProperty("集群信息")
val clusterNames: Set<String>? = nodeInfo.clusterNames
val clusterNames: Set<String>? = nodeInfo.clusterNames,
@ApiModelProperty("是否归档")
val archived: Boolean? = nodeInfo.archived,
) {
/**
* 获取node所属package的name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,7 @@ data class NodeInfo(
@JsonInclude(JsonInclude.Include.NON_NULL)
val deleted: String? = null,
@ApiModelProperty("集群信息")
val clusterNames: Set<String>? = null
val clusterNames: Set<String>? = null,
@ApiModelProperty("是否归档")
val archived: Boolean? = null,
)
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ import java.time.LocalDateTime
CompoundIndex(name = SHA256_IDX, def = SHA256_IDX_DEF, background = true),
CompoundIndex(name = COPY_FROM_IDX, def = COPY_FROM_IDX_DEF, background = true),
CompoundIndex(name = FOLDER_IDX, def = FOLDER_IDX_DEF, background = true),
CompoundIndex(name = CLUSTER_NAMES_IDX, def = CLUSTER_NAMES_IDX_DEF, background = true)
CompoundIndex(name = CLUSTER_NAMES_IDX, def = CLUSTER_NAMES_IDX_DEF, background = true),
)
data class TNode(
var id: String? = null,
Expand All @@ -87,6 +87,7 @@ data class TNode(
var metadata: MutableList<TMetadata>? = null,
var clusterNames: Set<String>? = null,
var nodeNum: Long? = null,
var archived: Boolean? = null,

@ShardingKey(count = SHARDING_COUNT)
var projectId: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,8 @@ abstract class NodeBaseService(
copyIntoCredentialsKey = it.copyIntoCredentialsKey,
deleted = it.deleted?.format(DateTimeFormatter.ISO_DATE_TIME),
lastAccessDate = it.lastAccessDate?.format(DateTimeFormatter.ISO_DATE_TIME),
clusterNames = it.clusterNames
clusterNames = it.clusterNames,
archived = it.archived
)
}
}
Expand Down

0 comments on commit cee8a44

Please sign in to comment.