|
6 | 6 | | |
|
7 | 7 | | hprose.go |
|
8 | 8 | | |
|
9 |
| -| LastModified: Feb 22, 2020 | |
| 9 | +| LastModified: May 24, 2021 | |
10 | 10 | | Author: Ma Bingyao <[email protected]> |
|
11 | 11 | | |
|
12 | 12 | \*________________________________________________________*/
|
13 | 13 |
|
14 | 14 | package hprose
|
| 15 | + |
| 16 | +import ( |
| 17 | + "github.com/hprose/hprose-golang/v3/io" |
| 18 | + "github.com/hprose/hprose-golang/v3/rpc" |
| 19 | + "github.com/hprose/hprose-golang/v3/rpc/codec/jsonrpc" |
| 20 | + "github.com/hprose/hprose-golang/v3/rpc/plugins/circuitbreaker" |
| 21 | + "github.com/hprose/hprose-golang/v3/rpc/plugins/cluster" |
| 22 | + "github.com/hprose/hprose-golang/v3/rpc/plugins/forward" |
| 23 | + "github.com/hprose/hprose-golang/v3/rpc/plugins/limiter" |
| 24 | + "github.com/hprose/hprose-golang/v3/rpc/plugins/loadbalance" |
| 25 | + "github.com/hprose/hprose-golang/v3/rpc/plugins/log" |
| 26 | + "github.com/hprose/hprose-golang/v3/rpc/plugins/oneway" |
| 27 | + "github.com/hprose/hprose-golang/v3/rpc/plugins/push" |
| 28 | + "github.com/hprose/hprose-golang/v3/rpc/plugins/reverse" |
| 29 | + "github.com/hprose/hprose-golang/v3/rpc/plugins/timeout" |
| 30 | +) |
| 31 | + |
| 32 | +type ( |
| 33 | + Decoder = io.Decoder |
| 34 | + Encoder = io.Encoder |
| 35 | + Formatter = io.Formatter |
| 36 | + LongType = io.LongType |
| 37 | + MapType = io.MapType |
| 38 | + RealType = io.RealType |
| 39 | + CastError = io.CastError |
| 40 | + DecodeError = io.DecodeError |
| 41 | + UnsupportedTypeError = io.UnsupportedTypeError |
| 42 | + ValueDecoder = io.ValueDecoder |
| 43 | + ValueEncoder = io.ValueEncoder |
| 44 | + |
| 45 | + Context = rpc.Context |
| 46 | + ClientContext = rpc.ClientContext |
| 47 | + ServiceContext = rpc.ServiceContext |
| 48 | + InvalidRequestError = rpc.InvalidRequestError |
| 49 | + InvalidResponseError = rpc.InvalidResponseError |
| 50 | + PanicError = rpc.PanicError |
| 51 | + UnsupportedProtocolError = rpc.UnsupportedProtocolError |
| 52 | + UnsupportedServerTypeError = rpc.UnsupportedServerTypeError |
| 53 | + NextIOHandler = rpc.NextIOHandler |
| 54 | + NextInvokeHandler = rpc.NextInvokeHandler |
| 55 | + Method = rpc.Method |
| 56 | + ClientCodec = rpc.ClientCodec |
| 57 | + ServiceCodec = rpc.ServiceCodec |
| 58 | + CodecOption = rpc.CodecOption |
| 59 | + Client = rpc.Client |
| 60 | + TransportGetter = rpc.TransportGetter |
| 61 | + Service = rpc.Service |
| 62 | + HandlerGetter = rpc.HandlerGetter |
| 63 | + |
| 64 | + JSONRPCClientCodec = jsonrpc.ClientCodec |
| 65 | + JSONRPCServiceCodec = jsonrpc.ServiceCodec |
| 66 | + |
| 67 | + CircuitBreaker = circuitbreaker.CircuitBreaker |
| 68 | + |
| 69 | + Cluster = cluster.Cluster |
| 70 | + |
| 71 | + Forward = forward.Forward |
| 72 | + |
| 73 | + ConcurrentLimiter = limiter.ConcurrentLimiter |
| 74 | + RateLimiter = limiter.RateLimiter |
| 75 | + |
| 76 | + LeastActiveLoadBalance = loadbalance.LeastActiveLoadBalance |
| 77 | + NginxRoundRobinLoadBalance = loadbalance.NginxRoundRobinLoadBalance |
| 78 | + RandomLoadBalance = loadbalance.RandomLoadBalance |
| 79 | + RoundRobinLoadBalance = loadbalance.RoundRobinLoadBalance |
| 80 | + WeightedLeastActiveLoadBalance = loadbalance.WeightedLeastActiveLoadBalance |
| 81 | + WeightedRandomLoadBalance = loadbalance.WeightedRandomLoadBalance |
| 82 | + WeightedRoundRobinLoadBalance = loadbalance.WeightedRoundRobinLoadBalance |
| 83 | + |
| 84 | + Log = log.Log |
| 85 | + |
| 86 | + Oneway = oneway.Oneway |
| 87 | + |
| 88 | + Broker = push.Broker |
| 89 | + Message = push.Message |
| 90 | + Producer = push.Producer |
| 91 | + Prosumer = push.Prosumer |
| 92 | + |
| 93 | + Caller = reverse.Caller |
| 94 | + ProviderContext = reverse.ProviderContext |
| 95 | + Provider = reverse.Provider |
| 96 | + |
| 97 | + ExecuteTimeout = timeout.ExecuteTimeout |
| 98 | +) |
| 99 | + |
| 100 | +const ( |
| 101 | + // Serialize Type. |
| 102 | + TagInteger byte = io.TagInteger |
| 103 | + TagLong byte = io.TagLong |
| 104 | + TagDouble byte = io.TagDouble |
| 105 | + TagNull byte = io.TagNull |
| 106 | + TagEmpty byte = io.TagEmpty |
| 107 | + TagTrue byte = io.TagTrue |
| 108 | + TagFalse byte = io.TagFalse |
| 109 | + TagNaN byte = io.TagNaN |
| 110 | + TagInfinity byte = io.TagInfinity |
| 111 | + TagDate byte = io.TagDate |
| 112 | + TagTime byte = io.TagTime |
| 113 | + TagUTC byte = io.TagUTC |
| 114 | + TagBytes byte = io.TagBytes |
| 115 | + TagUTF8Char byte = io.TagUTF8Char |
| 116 | + TagString byte = io.TagString |
| 117 | + TagGUID byte = io.TagGUID |
| 118 | + TagList byte = io.TagList |
| 119 | + TagMap byte = io.TagMap |
| 120 | + TagClass byte = io.TagClass |
| 121 | + TagObject byte = io.TagObject |
| 122 | + TagRef byte = io.TagRef |
| 123 | + |
| 124 | + // Serialize Marks. |
| 125 | + TagPos byte = io.TagPos |
| 126 | + TagNeg byte = io.TagNeg |
| 127 | + TagSemicolon byte = io.TagSemicolon |
| 128 | + TagOpenbrace byte = io.TagOpenbrace |
| 129 | + TagClosebrace byte = io.TagClosebrace |
| 130 | + TagQuote byte = io.TagQuote |
| 131 | + TagPoint byte = io.TagPoint |
| 132 | + |
| 133 | + // Protocol Tags. |
| 134 | + TagHeader byte = io.TagHeader |
| 135 | + TagCall byte = io.TagCall |
| 136 | + TagResult byte = io.TagResult |
| 137 | + TagError byte = io.TagError |
| 138 | + TagEnd byte = io.TagEnd |
| 139 | +) |
| 140 | + |
| 141 | +var ( |
| 142 | + ErrInvalidUTF8 = io.ErrInvalidUTF8 |
| 143 | + Marshal = io.Marshal |
| 144 | + Unmarshal = io.Unmarshal |
| 145 | + Register = io.Register |
| 146 | + RegisterName = io.RegisterName |
| 147 | + RegisterValueDecoder = io.RegisterValueDecoder |
| 148 | + RegisterValueEncoder = io.RegisterValueEncoder |
| 149 | + RegisterConverter = io.RegisterConverter |
| 150 | + GetConverter = io.GetConverter |
| 151 | + Convert = io.Convert |
| 152 | + GetStructType = io.GetStructType |
| 153 | + NewDecoder = io.NewDecoder |
| 154 | + NewDecoderFromReader = io.NewDecoderFromReader |
| 155 | + NewEncoder = io.NewEncoder |
| 156 | + GetValueDecoder = io.GetValueDecoder |
| 157 | + GetValueEncoder = io.GetValueEncoder |
| 158 | + |
| 159 | + ErrClosed = rpc.ErrClosed |
| 160 | + ErrRequestEntityTooLarge = rpc.ErrRequestEntityTooLarge |
| 161 | + ErrTimeout = rpc.ErrTimeout |
| 162 | + IsTemporaryError = rpc.IsTemporaryError |
| 163 | + IsTimeoutError = rpc.IsTimeoutError |
| 164 | + RegisterHandler = rpc.RegisterHandler |
| 165 | + RegisterTransport = rpc.RegisterTransport |
| 166 | + WithContext = rpc.WithContext |
| 167 | + GetClientContext = rpc.GetClientContext |
| 168 | + NewClientContext = rpc.NewClientContext |
| 169 | + GetServiceContext = rpc.GetServiceContext |
| 170 | + NewServiceContext = rpc.NewServiceContext |
| 171 | + FromContext = rpc.FromContext |
| 172 | + NewContext = rpc.NewContext |
| 173 | + NewPanicError = rpc.NewPanicError |
| 174 | + MissingMethod = rpc.MissingMethod |
| 175 | + NewMethod = rpc.NewMethod |
| 176 | + NewClientCodec = rpc.NewClientCodec |
| 177 | + NewServiceCodec = rpc.NewServiceCodec |
| 178 | + WithDebug = rpc.WithDebug |
| 179 | + WithLongType = rpc.WithLongType |
| 180 | + WithMapType = rpc.WithMapType |
| 181 | + WithRealType = rpc.WithRealType |
| 182 | + WithSimple = rpc.WithSimple |
| 183 | + NewClient = rpc.NewClient |
| 184 | + NewService = rpc.NewService |
| 185 | + HTTPTransport = rpc.HTTPTransport |
| 186 | + SocketTransport = rpc.SocketTransport |
| 187 | + UDPTransport = rpc.UDPTransport |
| 188 | + WebSocketTransport = rpc.WebSocketTransport |
| 189 | + HTTPHandler = rpc.HTTPHandler |
| 190 | + SocketHandler = rpc.SocketHandler |
| 191 | + UDPHandler = rpc.UDPHandler |
| 192 | + WebSocketHandler = rpc.WebSocketHandler |
| 193 | + |
| 194 | + NewJSONRPCClientCodec = jsonrpc.NewClientCodec |
| 195 | + NewJSONRPCServiceCodec = jsonrpc.NewServiceCodec |
| 196 | + |
| 197 | + WithThreshold = circuitbreaker.WithThreshold |
| 198 | + WithRecoverTime = circuitbreaker.WithRecoverTime |
| 199 | + WithMockService = circuitbreaker.WithMockService |
| 200 | + NewCircuitBreaker = circuitbreaker.New |
| 201 | + |
| 202 | + WithRetry = cluster.WithRetry |
| 203 | + WithIdempotent = cluster.WithIdempotent |
| 204 | + WithMinInterval = cluster.WithMinInterval |
| 205 | + WithMaxInterval = cluster.WithMaxInterval |
| 206 | + FailoverConfig = cluster.FailoverConfig |
| 207 | + FailtryConfig = cluster.FailtryConfig |
| 208 | + FailfastConfig = cluster.FailfastConfig |
| 209 | + NewCluster = cluster.New |
| 210 | + ForkingPlugin = cluster.Forking |
| 211 | + BroadcastPlugin = cluster.Broadcast |
| 212 | + |
| 213 | + NewForward = forward.New |
| 214 | + |
| 215 | + WithMaxPermits = limiter.WithMaxPermits |
| 216 | + WithTimeout = limiter.WithTimeout |
| 217 | + NewRateLimiter = limiter.NewRateLimiter |
| 218 | + NewConcurrentLimiter = limiter.NewConcurrentLimiter |
| 219 | + |
| 220 | + NewLeastActiveLoadBalance = loadbalance.NewLeastActiveLoadBalance |
| 221 | + NewRandomLoadBalance = loadbalance.NewRandomLoadBalance |
| 222 | + NewRoundRobinLoadBalance = loadbalance.NewRoundRobinLoadBalance |
| 223 | + NewNginxRoundRobinLoadBalance = loadbalance.NewNginxRoundRobinLoadBalance |
| 224 | + NewWeightedLeastActiveLoadBalance = loadbalance.NewWeightedLeastActiveLoadBalance |
| 225 | + NewWeightedRandomLoadBalance = loadbalance.NewWeightedRandomLoadBalance |
| 226 | + NewWeightedRoundRobinLoadBalance = loadbalance.NewWeightedRoundRobinLoadBalance |
| 227 | + |
| 228 | + NewLog = log.New |
| 229 | + LogPlugin = log.Plugin |
| 230 | + |
| 231 | + NewBroker = push.NewBroker |
| 232 | + GetProducer = push.GetProducer |
| 233 | + NewProsumer = push.NewProsumer |
| 234 | + |
| 235 | + NewCaller = reverse.NewCaller |
| 236 | + UseService = reverse.UseService |
| 237 | + GetProviderContext = reverse.GetProviderContext |
| 238 | + NewProvider = reverse.NewProvider |
| 239 | + |
| 240 | + NewExecuteTimeout = timeout.New |
| 241 | +) |
0 commit comments