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 module hunt.database.driver.mysql.impl.codec.MySQLCodec; 18 19 import hunt.database.driver.mysql.impl.codec.CommandCodec; 20 import hunt.database.driver.mysql.impl.codec.MySQLDecoder; 21 import hunt.database.driver.mysql.impl.codec.MySQLEncoder; 22 23 import hunt.database.base.impl.command.CommandBase; 24 import hunt.database.base.impl.command.CommandResponse; 25 26 import hunt.net.codec.Codec; 27 import hunt.net.codec.Encoder; 28 import hunt.net.codec.Decoder; 29 30 import std.container.dlist; 31 32 /** 33 * 34 */ 35 class MySQLCodec : Codec { 36 37 // private final ArrayDeque<CommandCodec<?, ?>> inflight = new ArrayDeque<>(); 38 private DList!(CommandCodecBase) inflight; 39 private MySQLDecoder decoder; 40 private MySQLEncoder encoder; 41 42 this() { 43 encoder = new MySQLEncoder(inflight); 44 decoder = new MySQLDecoder(inflight, encoder); 45 // init(decoder, encoder); 46 } 47 48 Encoder getEncoder() { 49 return encoder; 50 } 51 52 Decoder getDecoder() { 53 return decoder; 54 } 55 }