1 /*
2  * Copyright (C) 2019, HuntLabs
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17 
18 module hunt.database.base.impl.Connection;
19 
20 import hunt.database.base.AsyncResult;
21 import hunt.database.base.impl.command.CommandBase;
22 import hunt.Functions;
23 
24 // alias DbConnection = Connection;
25 
26 alias AsyncDbConnectionHandler = AsyncResultHandler!DbConnection; 
27 alias DbConnectionAsyncResult = AsyncResult!DbConnection;
28 
29 /**
30  * 
31  */
32 interface DbConnection {
33 
34     void initHolder(Holder holder);
35 
36     bool isSsl();
37 
38     bool isConnected();
39 
40     void schedule(ICommand cmd);
41 
42     void close();
43 
44     int getProcessId();
45 
46     int getSecretKey();
47 
48     interface Holder {
49 
50         void handleNotification(int processId, string channel, string payload);
51 
52         void handleClosing();
53 
54         void handleClosed();
55 
56         void handleException(Throwable err);
57 
58     }
59 }