2 * ============LICENSE_START==========================================
4 * ===================================================================
5 * Copyright (c) 2017 AT&T Intellectual Property
6 * ===================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
19 * ============LICENSE_END=============================================
20 * ====================================================================
23 package org.onap.music.service;
25 import java.util.List;
28 import org.onap.music.datastore.PreparedQueryObject;
29 import org.onap.music.exceptions.MusicLockingException;
30 import org.onap.music.exceptions.MusicQueryException;
31 import org.onap.music.exceptions.MusicServiceException;
32 import org.onap.music.lockingservice.cassandra.MusicLockState;
33 import org.onap.music.main.ResultType;
34 import org.onap.music.main.ReturnType;
35 import org.onap.music.datastore.*;
37 import com.datastax.driver.core.ResultSet;
39 public interface MusicCoreService {
42 // Core Music Database Methods
45 public ReturnType eventualPut(PreparedQueryObject queryObject);
47 public ReturnType eventualPut_nb(PreparedQueryObject queryObject,String keyspace,String tablename,String primaryKey);
49 public ReturnType criticalPut(String keyspaceName, String tableName, String primaryKey,
50 PreparedQueryObject queryObject, String lockId, Condition conditionInfo);
52 public ResultType nonKeyRelatedPut(PreparedQueryObject queryObject, String consistency)
53 throws MusicServiceException;
55 public ResultSet get(PreparedQueryObject queryObject) throws MusicServiceException;
57 public ResultSet atomicGet(String keyspaceName, String tableName, String primaryKey,
58 PreparedQueryObject queryObject) throws MusicServiceException, MusicLockingException, MusicQueryException;
60 public ReturnType atomicPutWithDeleteLock(String keyspaceName, String tableName, String primaryKey,
61 PreparedQueryObject queryObject, Condition conditionInfo) throws MusicLockingException;
63 public ResultSet atomicGetWithDeleteLock(String keyspaceName, String tableName, String primaryKey,
64 PreparedQueryObject queryObject) throws MusicServiceException, MusicLockingException;
66 public ReturnType atomicPut(String keyspaceName, String tableName, String primaryKey,
67 PreparedQueryObject queryObject, Condition conditionInfo)
68 throws MusicLockingException, MusicQueryException, MusicServiceException;
70 public ResultSet criticalGet(String keyspaceName, String tableName, String primaryKey,
71 PreparedQueryObject queryObject, String lockId) throws MusicServiceException;
73 // Core Music Locking Service Methods
75 public String createLockReference(String fullyQualifiedKey); // lock name
77 public ReturnType acquireLockWithLease(String key, String lockReference, long leasePeriod)
78 throws MusicLockingException, MusicQueryException, MusicServiceException; // key,lock id,time
80 public ReturnType acquireLock(String key, String lockReference)
81 throws MusicLockingException, MusicQueryException, MusicServiceException; // key,lock id
83 public ResultType createTable(String keyspace, String table, PreparedQueryObject tableQueryObject,
84 String consistency) throws MusicServiceException;
86 public ResultSet quorumGet(PreparedQueryObject query);
88 public String whoseTurnIsIt(String fullyQualifiedKey);// lock name
90 public void destroyLockRef(String lockId);
92 //public MusicLockState destroyLockRef(String fullyQualifiedKey, String lockReference); // lock name, lock id
94 //public MusicLockState voluntaryReleaseLock(String fullyQualifiedKey, String lockReference)
95 // throws MusicLockingException;// lock name,lock id
97 public void deleteLock(String lockName) throws MusicLockingException;
99 //public MusicLockState forciblyReleaseLock(String fullyQualifiedKey, String lockReference) throws MusicLockingException, MusicServiceException, MusicQueryException;
101 public List<String> getLockQueue(String fullyQualifiedKey)
102 throws MusicServiceException, MusicQueryException, MusicLockingException;
104 public long getLockQueueSize(String fullyQualifiedKey)
105 throws MusicServiceException, MusicQueryException, MusicLockingException;
107 public Map<String, Object> validateLock(String lockName);
109 public MusicLockState releaseLock(String lockId, boolean voluntaryRelease);