github.com/m3db/m3@v1.5.1-0.20231129193456-75a402aa583b/src/dbnode/client/calc_transport.go (about) 1 // Copyright (c) 2020 Uber Technologies, Inc. 2 // 3 // Permission is hereby granted, free of charge, to any person obtaining a copy 4 // of this software and associated documentation files (the "Software"), to deal 5 // in the Software without restriction, including without limitation the rights 6 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 // copies of the Software, and to permit persons to whom the Software is 8 // furnished to do so, subject to the following conditions: 9 // 10 // The above copyright notice and this permission notice shall be included in 11 // all copies or substantial portions of the Software. 12 // 13 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 // THE SOFTWARE. 20 21 package client 22 23 import ( 24 "errors" 25 26 "github.com/uber/tchannel-go/thirdparty/github.com/apache/thrift/lib/go/thrift" 27 ) 28 29 var ( 30 errCalcTransportNotImplemented = errors.New("calc transport: not implemented") 31 // Ensure calc transport implements TProtocol. 32 _ thrift.TProtocol = (*calcTransport)(nil) 33 ) 34 35 type calcTransport struct { 36 size int 37 } 38 39 func (t *calcTransport) Reset() { 40 if t == nil { 41 return 42 } 43 t.size = 0 44 } 45 func (t *calcTransport) GetSize() int { 46 if t == nil { 47 return 0 48 } 49 return t.size 50 } 51 func (t *calcTransport) WriteMessageBegin(name string, typeID thrift.TMessageType, seqid int32) error { 52 return nil 53 } 54 func (t *calcTransport) WriteMessageEnd() error { 55 return nil 56 } 57 func (t *calcTransport) WriteStructBegin(name string) error { 58 return nil 59 } 60 func (t *calcTransport) WriteStructEnd() error { 61 return nil 62 } 63 func (t *calcTransport) WriteFieldBegin(name string, typeID thrift.TType, id int16) error { 64 return nil 65 } 66 func (t *calcTransport) WriteFieldEnd() error { 67 return nil 68 } 69 func (t *calcTransport) WriteFieldStop() error { 70 return nil 71 } 72 func (t *calcTransport) WriteMapBegin(keyType thrift.TType, valueType thrift.TType, size int) error { 73 return nil 74 } 75 func (t *calcTransport) WriteMapEnd() error { 76 return nil 77 } 78 func (t *calcTransport) WriteListBegin(elemType thrift.TType, size int) error { 79 return nil 80 } 81 func (t *calcTransport) WriteListEnd() error { 82 return nil 83 } 84 func (t *calcTransport) WriteSetBegin(elemType thrift.TType, size int) error { 85 return nil 86 } 87 func (t *calcTransport) WriteSetEnd() error { 88 return nil 89 } 90 func (t *calcTransport) WriteBool(value bool) error { 91 t.size++ 92 return nil 93 } 94 func (t *calcTransport) WriteByte(value int8) error { 95 t.size++ 96 return nil 97 } 98 func (t *calcTransport) WriteI16(value int16) error { 99 t.size += 2 100 return nil 101 } 102 func (t *calcTransport) WriteI32(value int32) error { 103 t.size += 4 104 return nil 105 } 106 func (t *calcTransport) WriteI64(value int64) error { 107 t.size += 8 108 return nil 109 } 110 func (t *calcTransport) WriteDouble(value float64) error { 111 t.size += 8 112 return nil 113 } 114 func (t *calcTransport) WriteString(value string) error { 115 t.size += len(value) 116 return nil 117 } 118 func (t *calcTransport) WriteBinary(value []byte) error { 119 t.size += len(value) 120 return nil 121 } 122 func (t *calcTransport) ReadMessageBegin() (name string, typeID thrift.TMessageType, seqid int32, err error) { 123 return "", 0, 0, errCalcTransportNotImplemented 124 } 125 func (t *calcTransport) ReadMessageEnd() error { 126 return errCalcTransportNotImplemented 127 } 128 func (t *calcTransport) ReadStructBegin() (name string, err error) { 129 return "", errCalcTransportNotImplemented 130 } 131 func (t *calcTransport) ReadStructEnd() error { 132 return errCalcTransportNotImplemented 133 } 134 func (t *calcTransport) ReadFieldBegin() (name string, typeID thrift.TType, id int16, err error) { 135 return "", 0, 0, errCalcTransportNotImplemented 136 } 137 func (t *calcTransport) ReadFieldEnd() error { 138 return errCalcTransportNotImplemented 139 } 140 func (t *calcTransport) ReadMapBegin() (keyType thrift.TType, valueType thrift.TType, size int, err error) { 141 return 0, 0, 0, errCalcTransportNotImplemented 142 } 143 func (t *calcTransport) ReadMapEnd() error { 144 return errCalcTransportNotImplemented 145 } 146 func (t *calcTransport) ReadListBegin() (elemType thrift.TType, size int, err error) { 147 return 0, 0, errCalcTransportNotImplemented 148 } 149 func (t *calcTransport) ReadListEnd() error { 150 return errCalcTransportNotImplemented 151 } 152 func (t *calcTransport) ReadSetBegin() (elemType thrift.TType, size int, err error) { 153 return 0, 0, errCalcTransportNotImplemented 154 } 155 func (t *calcTransport) ReadSetEnd() error { 156 return errCalcTransportNotImplemented 157 } 158 func (t *calcTransport) ReadBool() (value bool, err error) { 159 return false, errCalcTransportNotImplemented 160 } 161 func (t *calcTransport) ReadByte() (value int8, err error) { 162 return 0, errCalcTransportNotImplemented 163 } 164 func (t *calcTransport) ReadI16() (value int16, err error) { 165 return 0, errCalcTransportNotImplemented 166 } 167 func (t *calcTransport) ReadI32() (value int32, err error) { 168 return 0, errCalcTransportNotImplemented 169 } 170 func (t *calcTransport) ReadI64() (value int64, err error) { 171 return 0, errCalcTransportNotImplemented 172 } 173 func (t *calcTransport) ReadDouble() (value float64, err error) { 174 return 0, errCalcTransportNotImplemented 175 } 176 func (t *calcTransport) ReadString() (value string, err error) { 177 return "", errCalcTransportNotImplemented 178 } 179 func (t *calcTransport) ReadBinary() (value []byte, err error) { 180 return nil, errCalcTransportNotImplemented 181 } 182 func (t *calcTransport) Skip(fieldType thrift.TType) (err error) { 183 return errCalcTransportNotImplemented 184 } 185 func (t *calcTransport) Flush() (err error) { 186 return errCalcTransportNotImplemented 187 } 188 func (t *calcTransport) Transport() thrift.TTransport { return nil }