Class SessionManager
- java.lang.Object
-
- org.apache.iotdb.db.query.control.SessionManager
-
public class SessionManager extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static org.slf4j.LoggerAUDIT_LOGGERstatic org.apache.iotdb.service.rpc.thrift.TSProtocolVersionCURRENT_RPC_VERSION
-
Constructor Summary
Constructors Modifier Constructor Description protectedSessionManager()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.iotdb.common.rpc.thrift.TSStatuscheckAuthority(PhysicalPlan plan, long sessionId)Check whether specific Session has the authorization to given plan.booleancheckAuthorization(PhysicalPlan plan, java.lang.String username)Check whether specific user has the authorization to given plan.booleancheckLogin(long sessionId)Check whether current user has logged in.voidcloseDataset(java.lang.Long statementId, java.lang.Long queryId, java.util.function.Consumer<java.lang.Long> releaseByQueryId)org.apache.iotdb.common.rpc.thrift.TSStatuscloseOperation(long sessionId, long queryId, long statementId, boolean haveStatementId, boolean haveSetQueryId)org.apache.iotdb.common.rpc.thrift.TSStatuscloseOperation(long sessionId, long queryId, long statementId, boolean haveStatementId, boolean haveSetQueryId, java.util.function.Consumer<java.lang.Long> releaseByQueryId)booleancloseSession(long sessionId)voidcloseStatement(long sessionId, long statementId, java.util.function.Consumer<java.lang.Long> releaseByQueryId)org.apache.iotdb.commons.conf.IoTDBConstant.ClientVersiongetClientVersion(java.lang.Long sessionId)java.lang.LonggetCurrSessionId()java.util.TimeZonegetCurrSessionTimeZone()org.apache.iotdb.tsfile.read.query.dataset.QueryDataSetgetDataset(java.lang.Long queryId)static SessionManagergetInstance()longgetSessionIdByQueryId(long queryId)SessionInfogetSessionInfo(long sessionId)java.lang.StringgetUsername(java.lang.Long sessionId)java.time.ZoneIdgetZoneId(java.lang.Long sessionId)booleanhasDataset(java.lang.Long queryId)BasicOpenSessionRespopenSession(java.lang.String username, java.lang.String password, java.lang.String zoneId, org.apache.iotdb.service.rpc.thrift.TSProtocolVersion tsProtocolVersion)BasicOpenSessionRespopenSession(java.lang.String username, java.lang.String password, java.lang.String zoneId, org.apache.iotdb.service.rpc.thrift.TSProtocolVersion tsProtocolVersion, org.apache.iotdb.commons.conf.IoTDBConstant.ClientVersion clientVersion)voidreleaseQueryResource(long queryId)voidreleaseQueryResourceNoExceptions(long queryId)booleanreleaseSessionResource(long sessionId)booleanreleaseSessionResource(long sessionId, java.util.function.Consumer<java.lang.Long> releaseQueryResource)voidremoveDataset(java.lang.Long queryId)longrequestQueryId(boolean isDataQuery)longrequestQueryId(java.lang.Long statementId, boolean isDataQuery)longrequestSessionId(java.lang.String username, java.lang.String zoneId, org.apache.iotdb.commons.conf.IoTDBConstant.ClientVersion clientVersion)longrequestStatementId(long sessionId)voidsetDataset(java.lang.Long queryId, org.apache.iotdb.tsfile.read.query.dataset.QueryDataSet dataSet)voidsetTimezone(java.lang.Long sessionId, java.lang.String zone)
-
-
-
Method Detail
-
openSession
public BasicOpenSessionResp openSession(java.lang.String username, java.lang.String password, java.lang.String zoneId, org.apache.iotdb.service.rpc.thrift.TSProtocolVersion tsProtocolVersion, org.apache.iotdb.commons.conf.IoTDBConstant.ClientVersion clientVersion) throws org.apache.thrift.TException
- Throws:
org.apache.thrift.TException
-
openSession
public BasicOpenSessionResp openSession(java.lang.String username, java.lang.String password, java.lang.String zoneId, org.apache.iotdb.service.rpc.thrift.TSProtocolVersion tsProtocolVersion) throws org.apache.thrift.TException
- Throws:
org.apache.thrift.TException
-
closeSession
public boolean closeSession(long sessionId)
-
closeOperation
public org.apache.iotdb.common.rpc.thrift.TSStatus closeOperation(long sessionId, long queryId, long statementId, boolean haveStatementId, boolean haveSetQueryId, java.util.function.Consumer<java.lang.Long> releaseByQueryId)
-
closeOperation
public org.apache.iotdb.common.rpc.thrift.TSStatus closeOperation(long sessionId, long queryId, long statementId, boolean haveStatementId, boolean haveSetQueryId)
-
checkLogin
public boolean checkLogin(long sessionId)
Check whether current user has logged in.- Returns:
- true: If logged in; false: If not logged in
-
requestSessionId
public long requestSessionId(java.lang.String username, java.lang.String zoneId, org.apache.iotdb.commons.conf.IoTDBConstant.ClientVersion clientVersion)
-
releaseSessionResource
public boolean releaseSessionResource(long sessionId)
-
releaseSessionResource
public boolean releaseSessionResource(long sessionId, java.util.function.Consumer<java.lang.Long> releaseQueryResource)
-
getSessionIdByQueryId
public long getSessionIdByQueryId(long queryId)
-
requestStatementId
public long requestStatementId(long sessionId)
-
closeStatement
public void closeStatement(long sessionId, long statementId, java.util.function.Consumer<java.lang.Long> releaseByQueryId)
-
requestQueryId
public long requestQueryId(java.lang.Long statementId, boolean isDataQuery)
-
requestQueryId
public long requestQueryId(boolean isDataQuery)
-
releaseQueryResource
public void releaseQueryResource(long queryId) throws StorageEngineException- Throws:
StorageEngineException
-
releaseQueryResourceNoExceptions
public void releaseQueryResourceNoExceptions(long queryId)
-
checkAuthorization
public boolean checkAuthorization(PhysicalPlan plan, java.lang.String username) throws org.apache.iotdb.commons.auth.AuthException
Check whether specific user has the authorization to given plan.- Throws:
org.apache.iotdb.commons.auth.AuthException
-
checkAuthority
public org.apache.iotdb.common.rpc.thrift.TSStatus checkAuthority(PhysicalPlan plan, long sessionId)
Check whether specific Session has the authorization to given plan.
-
getCurrSessionId
public java.lang.Long getCurrSessionId()
-
getCurrSessionTimeZone
public java.util.TimeZone getCurrSessionTimeZone()
-
getUsername
public java.lang.String getUsername(java.lang.Long sessionId)
-
getZoneId
public java.time.ZoneId getZoneId(java.lang.Long sessionId)
-
setTimezone
public void setTimezone(java.lang.Long sessionId, java.lang.String zone)
-
hasDataset
public boolean hasDataset(java.lang.Long queryId)
-
getDataset
public org.apache.iotdb.tsfile.read.query.dataset.QueryDataSet getDataset(java.lang.Long queryId)
-
setDataset
public void setDataset(java.lang.Long queryId, org.apache.iotdb.tsfile.read.query.dataset.QueryDataSet dataSet)
-
removeDataset
public void removeDataset(java.lang.Long queryId)
-
closeDataset
public void closeDataset(java.lang.Long statementId, java.lang.Long queryId, java.util.function.Consumer<java.lang.Long> releaseByQueryId)
-
getClientVersion
public org.apache.iotdb.commons.conf.IoTDBConstant.ClientVersion getClientVersion(java.lang.Long sessionId)
-
getInstance
public static SessionManager getInstance()
-
getSessionInfo
public SessionInfo getSessionInfo(long sessionId)
-
-