-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: conan 全局search优化#2735 * feat: 索引文件调整,并增加索引文件刷新接口#2735 * feat: 代码调整#2735 * feat: 增加元数据刷新接口#2735 * feat: 增加元数据刷新接口#2735 * feat: 依赖调整#2735 * feat: 代码调整#2735 * feat: 代码调整#2735
- Loading branch information
Showing
20 changed files
with
891 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
...ckend/conan/api-conan/src/main/kotlin/com/tencent/bkrepo/conan/api/ConanMetadataClient.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* Tencent is pleased to support the open source community by making BK-CI 蓝鲸持续集成平台 available. | ||
* | ||
* Copyright (C) 2023 THL A29 Limited, a Tencent company. All rights reserved. | ||
* | ||
* BK-CI 蓝鲸持续集成平台 is licensed under the MIT license. | ||
* | ||
* A copy of the MIT License is included in this file. | ||
* | ||
* | ||
* Terms of the MIT License: | ||
* --------------------------------------------------- | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated | ||
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation the | ||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to | ||
* permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of | ||
* the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT | ||
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN | ||
* NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | ||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
*/ | ||
|
||
package com.tencent.bkrepo.conan.api | ||
|
||
import com.tencent.bkrepo.common.api.constant.MAVEN_SERVICE_NAME | ||
import com.tencent.bkrepo.common.api.pojo.Response | ||
import com.tencent.bkrepo.conan.pojo.metadata.ConanMetadataRequest | ||
import io.swagger.annotations.ApiOperation | ||
import org.springframework.cloud.openfeign.FeignClient | ||
import org.springframework.web.bind.annotation.PostMapping | ||
import org.springframework.web.bind.annotation.RequestBody | ||
import org.springframework.web.bind.annotation.RequestMapping | ||
import org.springframework.web.bind.annotation.RequestParam | ||
|
||
@FeignClient(MAVEN_SERVICE_NAME, contextId = "ConanMetadataClient") | ||
@RequestMapping("/cluster/metadata") | ||
interface ConanMetadataClient { | ||
@ApiOperation("存储conan版本元数据") | ||
@PostMapping("/update") | ||
fun storeMetadata(@RequestBody request: ConanMetadataRequest): Response<Void> | ||
|
||
@ApiOperation("删除conan版本元数据") | ||
@PostMapping("/delete") | ||
fun delete( | ||
@RequestParam projectId: String, | ||
@RequestParam repoName: String, | ||
@RequestParam recipe: String | ||
): Response<Void> | ||
} |
38 changes: 38 additions & 0 deletions
38
.../api-conan/src/main/kotlin/com/tencent/bkrepo/conan/pojo/metadata/ConanMetadataRequest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* Tencent is pleased to support the open source community by making BK-CI 蓝鲸持续集成平台 available. | ||
* | ||
* Copyright (C) 2023 THL A29 Limited, a Tencent company. All rights reserved. | ||
* | ||
* BK-CI 蓝鲸持续集成平台 is licensed under the MIT license. | ||
* | ||
* A copy of the MIT License is included in this file. | ||
* | ||
* | ||
* Terms of the MIT License: | ||
* --------------------------------------------------- | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated | ||
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation the | ||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to | ||
* permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of | ||
* the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT | ||
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN | ||
* NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | ||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
*/ | ||
|
||
package com.tencent.bkrepo.conan.pojo.metadata | ||
|
||
data class ConanMetadataRequest( | ||
val projectId: String, | ||
val repoName: String, | ||
val user: String, | ||
val name: String, | ||
val version: String, | ||
val channel: String, | ||
val recipe: String | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
...an/src/main/kotlin/com/tencent/bkrepo/conan/controller/service/ConanMetadataController.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Tencent is pleased to support the open source community by making BK-CI 蓝鲸持续集成平台 available. | ||
* | ||
* Copyright (C) 2023 THL A29 Limited, a Tencent company. All rights reserved. | ||
* | ||
* BK-CI 蓝鲸持续集成平台 is licensed under the MIT license. | ||
* | ||
* A copy of the MIT License is included in this file. | ||
* | ||
* | ||
* Terms of the MIT License: | ||
* --------------------------------------------------- | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated | ||
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation the | ||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to | ||
* permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of | ||
* the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT | ||
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN | ||
* NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | ||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
*/ | ||
|
||
package com.tencent.bkrepo.conan.controller.service | ||
|
||
import com.tencent.bkrepo.common.api.pojo.Response | ||
import com.tencent.bkrepo.common.service.util.ResponseBuilder | ||
import com.tencent.bkrepo.conan.api.ConanMetadataClient | ||
import com.tencent.bkrepo.conan.pojo.metadata.ConanMetadataRequest | ||
import com.tencent.bkrepo.conan.service.ConanMetadataService | ||
import org.springframework.web.bind.annotation.RestController | ||
|
||
@RestController | ||
class ConanMetadataController(private val conanMetadataService: ConanMetadataService) : ConanMetadataClient { | ||
override fun storeMetadata(request: ConanMetadataRequest): Response<Void> { | ||
conanMetadataService.storeMetadata(request) | ||
return ResponseBuilder.success() | ||
} | ||
|
||
override fun delete(projectId: String, repoName: String, recipe: String): Response<Void> { | ||
conanMetadataService.delete(projectId, repoName, recipe) | ||
return ResponseBuilder.success() | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
src/backend/conan/biz-conan/src/main/kotlin/com/tencent/bkrepo/conan/dao/ConanMetadataDao.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.tencent.bkrepo.conan.dao | ||
|
||
import com.tencent.bkrepo.common.mongo.dao.simple.SimpleMongoDao | ||
import com.tencent.bkrepo.conan.model.TConanMetadataRecord | ||
import com.tencent.bkrepo.conan.pojo.metadata.ConanMetadataRequest | ||
import org.springframework.data.mongodb.core.query.Criteria | ||
import org.springframework.data.mongodb.core.query.Query | ||
import org.springframework.data.mongodb.core.query.Update | ||
import org.springframework.stereotype.Repository | ||
|
||
@Repository | ||
class ConanMetadataDao : SimpleMongoDao<TConanMetadataRecord>() { | ||
|
||
fun findAndModify(request: ConanMetadataRequest) { | ||
with(request) { | ||
val query = Query(buildCriteria(projectId, repoName, recipe)) | ||
val update = Update().set(TConanMetadataRecord::name.name, name) | ||
.set(TConanMetadataRecord::user.name, user) | ||
.set(TConanMetadataRecord::version.name, version) | ||
.set(TConanMetadataRecord::channel.name, channel) | ||
upsert(query, update) | ||
} | ||
} | ||
|
||
fun delete(projectId: String, repoName: String, recipe: String) { | ||
remove(Query(buildCriteria(projectId, repoName, recipe))) | ||
} | ||
|
||
private fun buildCriteria(projectId: String, repoName: String, recipe: String): Criteria { | ||
return Criteria | ||
.where(TConanMetadataRecord::projectId.name).`is`(projectId) | ||
.and(TConanMetadataRecord::repoName.name).`is`(repoName) | ||
.and(TConanMetadataRecord::recipe.name).`is`(recipe) | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
...nd/conan/biz-conan/src/main/kotlin/com/tencent/bkrepo/conan/model/TConanMetadataRecord.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.tencent.bkrepo.conan.model | ||
|
||
import org.springframework.data.mongodb.core.index.CompoundIndex | ||
import org.springframework.data.mongodb.core.index.CompoundIndexes | ||
import org.springframework.data.mongodb.core.mapping.Document | ||
|
||
@Document("conan_metadata") | ||
@CompoundIndexes( | ||
CompoundIndex( | ||
name = "unique_index", | ||
def = "{'projectId':1, 'repoName':1, 'recipe':1}", | ||
background = true, | ||
unique = true | ||
) | ||
) | ||
data class TConanMetadataRecord( | ||
val id: String?, | ||
val projectId: String, | ||
val repoName: String, | ||
val user: String, | ||
val name: String, | ||
val version: String, | ||
val channel: String, | ||
val recipe: String | ||
) |
37 changes: 37 additions & 0 deletions
37
...an/biz-conan/src/main/kotlin/com/tencent/bkrepo/conan/pojo/request/IndexRefreshRequest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Tencent is pleased to support the open source community by making BK-CI 蓝鲸持续集成平台 available. | ||
* | ||
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. | ||
* | ||
* BK-CI 蓝鲸持续集成平台 is licensed under the MIT license. | ||
* | ||
* A copy of the MIT License is included in this file. | ||
* | ||
* | ||
* Terms of the MIT License: | ||
* --------------------------------------------------- | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated | ||
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation the | ||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to | ||
* permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of | ||
* the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT | ||
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN | ||
* NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | ||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
*/ | ||
|
||
package com.tencent.bkrepo.conan.pojo.request | ||
|
||
data class IndexRefreshRequest( | ||
val name: String, | ||
val version: String, | ||
val userName: String, | ||
val channel: String, | ||
val revision: String? = null, | ||
val packageId: String? = null, | ||
) |
Oops, something went wrong.