From 8fd7adbb9428bc0c14f5f08a321eabd582fbaf48 Mon Sep 17 00:00:00 2001 From: Brinda Santh Date: Thu, 19 Dec 2019 16:11:31 -0500 Subject: Cluster distributed lock service. Included and fixed clustered env properties and utils. Fixed docker compose instance sequence numbers. Issue-ID: CCSDK-2011 Signed-off-by: Brinda Santh Change-Id: Ie28935ae7cb3de8c77cd7110993304eb49799b6c --- .../core/service/BluePrintClusterService.kt | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'ms/blueprintsprocessor/modules/commons/processor-core') 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 index bbaa427c9..6fd443624 100644 --- 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 @@ -35,6 +35,9 @@ interface BluePrintClusterService { /** Create and get or get the distributed data map store with [name] */ suspend fun clusterMapStore(name: String): MutableMap + /** Create and get the distributed lock with [name] */ + suspend fun clusterLock(name: String): ClusterLock + /** Shut down the cluster with [duration] */ suspend fun shutDown(duration: Duration) } @@ -48,4 +51,11 @@ data class ClusterInfo( var storagePath: String ) -data class ClusterMember(val id: String, val memberAddress: String?) +data class ClusterMember(val id: String, val memberAddress: String?, val state: String? = null) + +interface ClusterLock { + suspend fun lock() + suspend fun tryLock(timeout: Long): Boolean + suspend fun unLock() + fun isLocked(): Boolean +} -- cgit 1.2.3-korg