Skip to content

Commit

Permalink
feat: Node提取到common-metadata #2619
Browse files Browse the repository at this point in the history
  • Loading branch information
yaoxuwan committed Oct 23, 2024
1 parent 6c43d19 commit b237ba7
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

package com.tencent.bkrepo.common.artifact.event
package com.tencent.bkrepo.common.artifact.properties

import org.springframework.boot.context.properties.ConfigurationProperties
import java.time.Duration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ package com.tencent.bkrepo.common.artifact.event
import com.tencent.bkrepo.common.artifact.event.listener.ArtifactDownloadListener
import com.tencent.bkrepo.common.artifact.event.listener.ArtifactTransferListener
import com.tencent.bkrepo.common.artifact.event.listener.ArtifactWebHookListener
import com.tencent.bkrepo.common.artifact.properties.ArtifactEventProperties
import com.tencent.bkrepo.common.artifact.webhook.WebHookService
import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.context.annotation.Configuration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import com.google.common.util.concurrent.ThreadFactoryBuilder
import com.tencent.bkrepo.common.api.constant.HttpHeaders
import com.tencent.bkrepo.common.api.constant.StringPool
import com.tencent.bkrepo.common.artifact.event.ArtifactDownloadedEvent
import com.tencent.bkrepo.common.artifact.event.ArtifactEventProperties
import com.tencent.bkrepo.common.artifact.properties.ArtifactEventProperties
import com.tencent.bkrepo.common.artifact.event.node.NodeDownloadedEvent
import com.tencent.bkrepo.common.artifact.event.node.NodeUpdateAccessDateEvent
import com.tencent.bkrepo.common.artifact.repository.context.ArtifactClient
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,21 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

package com.tencent.bkrepo.repository.listener
package com.tencent.bkrepo.common.metadata.listener

import com.tencent.bkrepo.common.artifact.event.base.ArtifactEvent
import com.tencent.bkrepo.common.metadata.service.log.OperateLogService
import com.tencent.bkrepo.common.metadata.condition.SyncCondition
import com.tencent.bkrepo.common.operate.api.OperateLogService
import com.tencent.bkrepo.common.service.util.HttpContextHolder
import org.springframework.context.annotation.Conditional
import org.springframework.context.event.EventListener
import org.springframework.stereotype.Component

/**
* 事件审计记录监听器
*/
@Component
@Conditional(SyncCondition::class)
class EventAuditListener(
private val operateLogService: OperateLogService
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,20 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

package com.tencent.bkrepo.repository.listener
package com.tencent.bkrepo.common.metadata.listener

import com.tencent.bkrepo.common.artifact.event.base.ArtifactEvent
import com.tencent.bkrepo.common.metadata.condition.SyncCondition
import com.tencent.bkrepo.common.stream.event.supplier.MessageSupplier
import org.springframework.context.annotation.Conditional
import org.springframework.context.event.EventListener
import org.springframework.stereotype.Component

/**
* 用于将事件发送到消息流的监听器
*/
@Component
@Conditional(SyncCondition::class)
class EventStreamListener(
private val messageSupplier: MessageSupplier
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

package com.tencent.bkrepo.repository.listener
package com.tencent.bkrepo.common.metadata.listener

import com.google.common.cache.CacheBuilder
import com.google.common.cache.CacheLoader
Expand All @@ -45,12 +45,14 @@ import com.tencent.bkrepo.common.artifact.event.node.NodeMovedEvent
import com.tencent.bkrepo.common.artifact.event.node.NodeRenamedEvent
import com.tencent.bkrepo.common.artifact.path.PathUtils
import com.tencent.bkrepo.common.artifact.path.PathUtils.combineFullPath
import com.tencent.bkrepo.common.metadata.condition.SyncCondition
import com.tencent.bkrepo.common.mongo.dao.AbstractMongoDao
import com.tencent.bkrepo.common.mongo.dao.util.Pages
import com.tencent.bkrepo.common.metadata.dao.node.NodeDao
import com.tencent.bkrepo.common.metadata.model.TNode
import com.tencent.bkrepo.common.metadata.service.node.NodeService
import org.slf4j.LoggerFactory
import org.springframework.context.annotation.Conditional
import org.springframework.context.event.EventListener
import org.springframework.data.domain.Sort
import org.springframework.data.mongodb.core.query.Query
Expand All @@ -69,6 +71,7 @@ import java.util.concurrent.atomic.LongAdder
* 节点事件监听,用户统计目录size以及目录下文件个数
*/
@Component
@Conditional(SyncCondition::class)
class NodeModifyEventListener(
private val nodeService: NodeService,
private val nodeDao: NodeDao,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,17 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

package com.tencent.bkrepo.repository.listener
package com.tencent.bkrepo.common.metadata.listener

import com.tencent.bkrepo.common.artifact.event.ArtifactEventProperties
import com.tencent.bkrepo.common.artifact.properties.ArtifactEventProperties
import com.tencent.bkrepo.common.artifact.event.base.ArtifactEvent
import com.tencent.bkrepo.common.artifact.event.base.EventType
import com.tencent.bkrepo.common.metadata.condition.SyncCondition
import com.tencent.bkrepo.common.mongo.constant.ID
import com.tencent.bkrepo.common.metadata.dao.node.NodeDao
import com.tencent.bkrepo.common.metadata.model.TNode
import org.slf4j.LoggerFactory
import org.springframework.context.annotation.Conditional
import org.springframework.data.mongodb.core.query.Query
import org.springframework.data.mongodb.core.query.Update
import org.springframework.data.mongodb.core.query.isEqualTo
Expand All @@ -48,6 +50,7 @@ import java.time.format.DateTimeFormatter
* 消费基于MQ传递的事件去更新对应access date
*/
@Component
@Conditional(SyncCondition::class)
class NodeUpdateAccessDateEventListener(
private val nodeDao: NodeDao,
private val artifactEventProperties: ArtifactEventProperties,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
package com.tencent.bkrepo.repository.config

import com.tencent.bkrepo.common.artifact.event.base.ArtifactEvent
import com.tencent.bkrepo.repository.listener.NodeUpdateAccessDateEventListener
import com.tencent.bkrepo.common.metadata.listener.NodeUpdateAccessDateEventListener
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.messaging.Message
Expand Down

0 comments on commit b237ba7

Please sign in to comment.