All Downloads are FREE. Search and download functionalities are using the official Maven repository.

orbit.server.pipeline.step.VerifyStep.kt Maven / Gradle / Ivy

/*
 Copyright (C) 2015 - 2019 Electronic Arts Inc.  All rights reserved.
 This file is part of the Orbit Project .
 See license in LICENSE.
 */

package orbit.server.pipeline.step

import orbit.server.mesh.ClusterManager
import orbit.server.pipeline.PipelineContext
import orbit.shared.exception.InvalidNodeId
import orbit.shared.net.Message

class VerifyStep(
    private val clusterManager: ClusterManager
) : PipelineStep {
    override suspend fun onInbound(context: PipelineContext, msg: Message) {
        val source = msg.source

        checkNotNull(source) { "Source should not be null at this point" }

        if (clusterManager.getNode(source) == null) {
            throw InvalidNodeId(source)
        }

        context.next(msg)
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy