diff options
Diffstat (limited to 'ms/blueprintsprocessor/modules/commons/processor-core')
-rw-r--r-- | ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/service/BluePrintClusterService.kt | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/service/BluePrintClusterService.kt b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/service/BluePrintClusterService.kt new file mode 100644 index 000000000..bbaa427c9 --- /dev/null +++ b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/service/BluePrintClusterService.kt @@ -0,0 +1,51 @@ +/* + * Copyright © 2018-2019 AT&T Intellectual Property. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.ccsdk.cds.blueprintsprocessor.core.service + +import java.time.Duration + +interface BluePrintClusterService { + + /** Start the cluster with [clusterInfo], By default clustering service is disabled. + * Application module has to start cluster */ + suspend fun startCluster(clusterInfo: ClusterInfo) + + fun clusterJoined(): Boolean + + /** Returns all the data cluster members */ + suspend fun allMembers(): Set<ClusterMember> + + /** Returns data cluster members starting with prefix */ + suspend fun clusterMembersForPrefix(memberPrefix: String): Set<ClusterMember> + + /** Create and get or get the distributed data map store with [name] */ + suspend fun <T> clusterMapStore(name: String): MutableMap<String, T> + + /** Shut down the cluster with [duration] */ + suspend fun shutDown(duration: Duration) +} + +data class ClusterInfo( + val id: String, + var configFile: String? = null, + val nodeId: String, + val nodeAddress: String, + var clusterMembers: List<String>, + var storagePath: String +) + +data class ClusterMember(val id: String, val memberAddress: String?) |