diff --git a/src/backend/fs/boot-fs-server/src/main/kotlin/com/tencent/bkrepo/fs/server/config/RouteConfiguration.kt b/src/backend/fs/boot-fs-server/src/main/kotlin/com/tencent/bkrepo/fs/server/config/RouteConfiguration.kt index b3f1ac8276..9207e545be 100644 --- a/src/backend/fs/boot-fs-server/src/main/kotlin/com/tencent/bkrepo/fs/server/config/RouteConfiguration.kt +++ b/src/backend/fs/boot-fs-server/src/main/kotlin/com/tencent/bkrepo/fs/server/config/RouteConfiguration.kt @@ -94,6 +94,7 @@ class RouteConfiguration( POST("/create$DEFAULT_MAPPING_URI", nodeOperationsHandler::createNode) DELETE("/delete$DEFAULT_MAPPING_URI", nodeOperationsHandler::deleteNode) POST("/mkdir$DEFAULT_MAPPING_URI", nodeOperationsHandler::mkdir) + POST("/mknod$DEFAULT_MAPPING_URI", nodeOperationsHandler::mknod) PUT("/set-length$DEFAULT_MAPPING_URI", nodeOperationsHandler::setLength) GET("/stat$DEFAULT_MAPPING_URI", nodeOperationsHandler::getStat) GET("/info$DEFAULT_MAPPING_URI", nodeOperationsHandler::info) diff --git a/src/backend/fs/boot-fs-server/src/main/kotlin/com/tencent/bkrepo/fs/server/handler/NodeOperationsHandler.kt b/src/backend/fs/boot-fs-server/src/main/kotlin/com/tencent/bkrepo/fs/server/handler/NodeOperationsHandler.kt index 69dab97332..59826aaeb6 100644 --- a/src/backend/fs/boot-fs-server/src/main/kotlin/com/tencent/bkrepo/fs/server/handler/NodeOperationsHandler.kt +++ b/src/backend/fs/boot-fs-server/src/main/kotlin/com/tencent/bkrepo/fs/server/handler/NodeOperationsHandler.kt @@ -136,6 +136,8 @@ class NodeOperationsHandler( gid = attrMap[NodeAttribute::gid.name] as? String ?: NOBODY, mode = attrMap[NodeAttribute::mode.name] as? Int ?: DEFAULT_MODE, flags = attrMap[NodeAttribute::flags.name] as? Int, + rdev = attrMap[NodeAttribute::rdev.name] as? Int, + type = attrMap[NodeAttribute::type.name] as? Int ) val attributes = NodeAttribute( @@ -143,6 +145,8 @@ class NodeOperationsHandler( gid = gid ?: preFsAttribute.gid, mode = mode ?: preFsAttribute.mode, flags = flags ?: preFsAttribute.flags, + rdev = rdev ?: preFsAttribute.rdev, + type = type ?: preFsAttribute.type ) val fsAttr = MetadataModel( key = FS_ATTR_KEY, @@ -243,6 +247,11 @@ class NodeOperationsHandler( return ReactiveResponseBuilder.success(node.nodeInfo.toNode()) } + suspend fun mknod(request: ServerRequest): ServerResponse { + val node = createNode(request, false) + return ReactiveResponseBuilder.success(node.nodeInfo.toNode()) + } + private suspend fun createNode(request: ServerRequest, folder: Boolean): NodeDetail { with(NodeRequest(request)) { val user = ReactiveSecurityUtils.getUser() @@ -251,7 +260,9 @@ class NodeOperationsHandler( uid = NOBODY, gid = NOBODY, mode = mode ?: DEFAULT_MODE, - flags = flags + flags = flags, + rdev = rdev, + type = type ) val fsAttr = MetadataModel( key = FS_ATTR_KEY, diff --git a/src/backend/fs/boot-fs-server/src/main/kotlin/com/tencent/bkrepo/fs/server/model/NodeAttribute.kt b/src/backend/fs/boot-fs-server/src/main/kotlin/com/tencent/bkrepo/fs/server/model/NodeAttribute.kt index 32521c02b9..ea6d2001d3 100644 --- a/src/backend/fs/boot-fs-server/src/main/kotlin/com/tencent/bkrepo/fs/server/model/NodeAttribute.kt +++ b/src/backend/fs/boot-fs-server/src/main/kotlin/com/tencent/bkrepo/fs/server/model/NodeAttribute.kt @@ -1,10 +1,18 @@ package com.tencent.bkrepo.fs.server.model data class NodeAttribute( + // 用户id val uid: String, + // 组id val gid: String, + // 文件权限,八进制 val mode: Int? = DEFAULT_MODE, + // windows文件flag,十六进制 val flags: Int? = null, + // 设备文件设备号 + val rdev: Int? = null, + // 文件类型 + val type: Int? = null ) { companion object { const val DEFAULT_MODE = 644 diff --git a/src/backend/fs/boot-fs-server/src/main/kotlin/com/tencent/bkrepo/fs/server/request/NodeRequest.kt b/src/backend/fs/boot-fs-server/src/main/kotlin/com/tencent/bkrepo/fs/server/request/NodeRequest.kt index 0c77db48a1..1119c5c066 100644 --- a/src/backend/fs/boot-fs-server/src/main/kotlin/com/tencent/bkrepo/fs/server/request/NodeRequest.kt +++ b/src/backend/fs/boot-fs-server/src/main/kotlin/com/tencent/bkrepo/fs/server/request/NodeRequest.kt @@ -49,6 +49,8 @@ open class NodeRequest( open val category: String = RepositoryCategory.LOCAL.name, open val mode: Int? = null, open val flags: Int? = null, + open val rdev: Int? = null, + open val type: Int? = null, ) { constructor(request: ServerRequest) : this( projectId = request.pathVariable(PROJECT_ID), @@ -57,6 +59,8 @@ open class NodeRequest( category = request.queryParamOrNull("category") ?: RepositoryCategory.LOCAL.name, mode = request.queryParamOrNull("mode")?.toIntOrNull(), flags = request.queryParamOrNull("flags")?.toIntOrNull(), + rdev = request.queryParamOrNull("rdev")?.toIntOrNull(), + type = request.queryParamOrNull("type")?.toIntOrNull() ) override fun toString(): String {