Commit Graph

397 Commits

Author SHA1 Message Date
Asim Aslam
c145f355dd
Moving to gRPC by default (#1069)
* Step 1

* Fix the test panics
2019-12-29 21:07:55 +00:00
jamsonzan
22aa7d14b3 support streams pool for grpc (#1062)
* Update grpc_pool.go

* Update options.go

* Update grpc.go

* Update grpc_pool_test.go

* streams pool for grpc

* use busy list to speed up allocate while pool is very busy

* fix idle bug
2019-12-27 12:25:58 +00:00
Asim Aslam
d5951f1d7c
Merge pull request #1042 from ZGeomantic/feat-client-mock
support ctx as input params, error as output for MockClient.Call
2019-12-15 15:12:17 +00:00
jamsonzan
572fe58314 comment 2019-12-15 15:05:19 +08:00
gemantic
5602b93d7a support ctx as input params, error as output for MockClient.Call 2019-12-14 10:36:12 +08:00
Asim Aslam
d50f30d743 strip handlers 2019-12-10 11:46:13 +00:00
Asim Aslam
c445aed6b1 Cleanup and speedup network convergence along with direct messaging for connect and solicit 2019-12-07 19:54:29 +00:00
Milos Gajdos
5865e89bed
Fixing dead code and go vet moaning 2019-12-05 16:10:49 +00:00
a1eaf9cc20 linting fixes
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2019-12-04 00:22:02 +03:00
Astone
29fb58db39 improve code quality 2019-12-03 20:59:02 +08:00
90f9b0d0c9 initialize client options context if not provided
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2019-12-03 01:35:59 +03:00
Asim Aslam
00bbb3ac61 revert some protocol changes for now 2019-11-30 21:20:33 +00:00
Asim Aslam
8b63df7a98 regenerate the protos 2019-11-26 13:53:33 +00:00
Asim Aslam
db03a564fb
Merge pull request #980 from unistack-org/issue-940
grpc client goroutine leak fix
2019-11-25 19:10:34 +00:00
9763820c75 grpc client goroutine leak fix
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2019-11-25 22:02:24 +03:00
Asim Aslam
080363e8c4
The mega cruft proxy PR (#974)
* the mega cruft proxy PR

* Rename broker id

* add protocol=grpc

* fix compilation breaks

* Add the tunnel broker to the network

* fix broker id

* continue to be backwards compatible in the protocol
2019-11-25 16:31:43 +00:00
Erik Hollensbe
4107733453 Memory registry from #801 with additional tweaks (#951)
* PoC: memory registry using maps instead of slice madness

* Updated proto and handlers. Fixed tests across codebase.

* Implemented ttl pruning for memory registry

* Added extensive memory registry tests

* Squased a bunch of bugs

* Proto indent; memory.Registry.String() returns "memory"

* Write a test to prove memory registry TTLs are busted

Signed-off-by: Erik Hollensbe <github@hollensbe.org>

* Additional memory testing and fixups:

* DefaultTTL removed
* When TTL == 0, it is automatically removed from expiry conditions
* Additional improvements to new tests

Signed-off-by: Erik Hollensbe <github@hollensbe.org>
2019-11-16 10:55:11 +00:00
Till Knuesting
f67c5e779f preallocated slices (#917) 2019-11-05 17:43:12 +00:00
tegk
f88518d994 used gofmt with -s flag on whole project 2019-11-01 15:07:53 +00:00
Milos Gajdos
1ff65e140a
Change router.Route metric to int64. Set the route metric properly 2019-10-23 16:51:22 +01:00
Asim Aslam
b55018eaa1
Merge pull request #833 from orbli/patch-1
Add dialoptions and calloptions
2019-10-10 07:40:48 +01:00
orb li
77108771db Conceptual deliverable 2019-10-10 13:55:16 +08:00
Asim Aslam
fe94237448
Update router querying method (#834)
* Add address to router query options. Drop Query interface for QueryOptions

* Cleanup isMatch function

* Update network proto
2019-10-09 17:13:52 +01:00
orb li
226d55d752
Adding dependency 2019-10-09 16:48:45 +08:00
orb li
88ef785127 Add dialoptions and calloptions 2019-10-09 15:56:39 +08:00
Asim Aslam
afa1f50435 Revert to creating new connections for stream 2019-09-25 15:21:21 +01:00
Asim Aslam
52d9d75dfa use with stream for client connection 2019-08-31 18:26:48 +01:00
Asim Aslam
0888d2fbbc Add grpc content-type 2019-08-27 08:13:58 +01:00
Asim Aslam
353eade6c3 Update client proto 2019-08-23 12:06:11 +01:00
Asim Aslam
c44fd63301 Force grpc client/server to use grpc codec for broker 2019-08-18 11:28:21 +01:00
Asim Aslam
4495ca3839 Use client.Call for non streaming requests 2019-08-16 17:24:17 +01:00
Asim Aslam
0b0eee41d0 functioning proxy code 2019-08-16 16:46:29 +01:00
Asim Aslam
58bc4c103f go fmt 2019-08-15 20:54:09 +01:00
Asim Aslam
ef04331b86 multiplexing cruft 2019-08-15 20:08:49 +01:00
Asim Aslam
f6b8045dd5 send client error if it exists 2019-08-15 15:22:53 +01:00
johnson
de34f259ba update service not found error tooltip
fixing test failed issue

change back error type
change registry.ErrNotFound back to selector.ErrNotFound

change back error type
change registry.ErrNotFound back to selector.ErrNotFound

remove the single node tunnel test

Fix read yaml config from memory

package main

import (
	"fmt"

	"github.com/micro/go-micro/config"
	"github.com/micro/go-micro/config/source/memory"
)

var configData = []byte(`
---
a: 1234
`)

func main() {
	memorySource := memory.NewSource(
		memory.WithYAML(configData),
	)
	// Create new config
	conf := config.NewConfig()

	// Load file source
	conf.Load(memorySource)

	fmt.Println(string(conf.Bytes()))
}
2019-08-11 19:31:22 +08:00
Asim Aslam
4030ccc27b Move proxy/router 2019-08-05 17:44:33 +01:00
Asim Aslam
4fc9b9821a
Merge pull request #621 from milosgajdos83/no-table-package
[WIP] No table package. router/service package introduced
2019-07-29 12:36:40 +01:00
Asim Aslam
1db98ee0f0 move all the buffer references to util/buf 2019-07-28 19:33:24 +01:00
Asim Aslam
f2669e7b1e Move connection pool to own package 2019-07-28 18:56:18 +01:00
Milos Gajdos
2f1658c213
Table package is no more, hence removed references to it 2019-07-27 16:11:06 +01:00
张三
100cb9db6b
fix bug
https://github.com/micro/micro/issues/293
Send request failed using micro Content-Type application/grpc+json
2019-07-27 11:11:16 +08:00
Bruce Wang
502f6d3e9f
Update client.go
fixed one typo
2019-07-22 15:41:14 +08:00
e688ab0a45 fix ipv6 addr parsing and using
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2019-07-17 12:20:29 +03:00
a3bddf5839 changes to minimize allocations and provide useful info
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2019-07-17 00:21:03 +03:00
Asim Aslam
b23d955536 Use gateway if available 2019-07-10 08:26:33 +01:00
Asim Aslam
64ec0633a3 Fix breaks and go fmt 2019-07-10 07:47:17 +01:00
Asim Aslam
34967e8e33
Merge pull request #573 from milosgajdos83/flap-detection
Router rework. Flap detection. Table package.
2019-07-10 07:12:18 +01:00
Asim Aslam
0bf54c122f move transport back 2019-07-09 18:41:26 +01:00
Milos Gajdos
6cf8bde612
Router selector and proxy modifications due to Route struct changes. 2019-07-09 16:45:31 +01:00
Milos Gajdos
b82245429e
Simplified table logic. Lookup tests. mucp/cient update 2019-07-09 15:46:31 +01:00
Asim Aslam
5cd1e81ba9
Merge pull request #570 from sunfuze/grpc-json-marshal
grpc: using jsonpb.Marshaler to do Marshal, map to jsonpb.Unmarsh
2019-07-08 08:44:51 +01:00
Asim Aslam
e0bf1c2283 Remove Port from registry 2019-07-08 08:01:42 +01:00
Joe
b655f7f55a grpc: using jsonpb.Marshaler to do Marshal, map to jsonpb.Unmarsh 2019-07-08 10:32:10 +08:00
Asim Aslam
4b4ad68eb9 Change Publication to Event 2019-07-07 12:44:09 +01:00
Asim Aslam
777a203f96 gofmt 2019-07-07 12:33:54 +01:00
Asim Aslam
d2d6841f02 Move transport to network/transport 2019-07-07 10:37:34 +01:00
e40307c567 codec grpc: fix extra allocations on message unmarshal
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2019-07-04 14:06:29 +03:00
Joe
e88041dc26 if unmarshal target is proto.Message, using jsonpb 2019-07-04 16:43:36 +08:00
Asim Aslam
9630e153a5 fix grpc proto wrapper 2019-06-27 13:08:06 +01:00
lpxxn
3b0ef425b6 pass parameter to anonymous function 2019-06-27 13:06:53 +08:00
Asim Aslam
0da8256426 Accept a range of addresses 2019-06-26 20:51:13 +01:00
Asim Aslam
940ea94a96 Lookup router via registry 2019-06-26 19:56:40 +01:00
Asim Aslam
cedcef032d Add remote lookup via router selector 2019-06-26 19:27:38 +01:00
Asim Aslam
ac098e4d78 add router selector and network defaults 2019-06-26 16:12:57 +01:00
Asim Aslam
1b4005e9a5 Go fmt everything 2019-06-21 17:20:41 +01:00
Asim Aslam
ca5acba0c6 Move selector to client/selector 2019-06-21 15:13:54 +01:00
Asim Aslam
1c1dae0642 Fix the grpc test 2019-06-19 12:34:45 +01:00
Asim Aslam
e9c2df775a Merge branch 'master' into grpc 2019-06-18 18:51:55 +01:00
Asim Aslam
d3a6297b17 Add working grpc proxy config 2019-06-18 18:51:52 +01:00
johnson
b754c33549 grpc message should be able to set 2019-06-18 17:07:31 +08:00
Asim Aslam
f65694670e add cruft 2019-06-17 20:05:58 +01:00
ab692ff590 remove mock data from memory registry
memory registry can be used as fast inprocess registry,
so mock data needs to be in tests only

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2019-06-13 00:51:56 +03:00
Asim Aslam
235a653f78 check in cruft 2019-06-11 09:52:35 +01:00
Asim Aslam
ed4bce3285 check in this cruft 2019-06-08 19:40:44 +01:00
Asim Aslam
9e23855c37 Fixup the proxy, strip down go.mod. Win bigly 2019-06-07 13:42:39 +01:00
Asim Aslam
44b17b7e4b strip use of cmd 2019-06-03 19:07:09 +01:00
Asim Aslam
b42b6fa0fc Further consolidate the libraries 2019-06-03 18:44:43 +01:00
lpxxn
a86c26d485 fix bug need pass the variable as a parameter to the anonymous function 2019-05-31 14:24:37 +08:00
Hunyadvári Péter
aaf4a5c51a rename reqBody variable to request 2019-05-02 18:06:43 +02:00
Hunyadvári Péter
08d70c9d0a fix and add tests 2019-05-02 18:02:24 +02:00
Hunyadvári Péter
c1c0a8fb30 send requestBody to mock function if it can handle it 2019-05-02 17:14:41 +02:00
Asim Aslam
f824ba0779 non-blocking call chan when retries are 0 2019-04-18 09:05:22 +00:00
Asim Aslam
b8f20924cc proxy publish 2019-02-23 17:06:17 +00:00
Asim Aslam
58adaef339 Add Exchange option 2019-02-23 10:50:53 +00:00
Asim Aslam
b1a31134bd Support micro proxy 2019-01-30 18:42:11 +00:00
Asim Aslam
8090f9968d Update headers to remove X- prefix 2019-01-24 10:11:02 +00:00
Asim Aslam
6468733d98 Use protocol from node metadata 2019-01-18 12:30:39 +00:00
Asim Aslam
2cd2258731 For the legacy 2019-01-18 10:12:57 +00:00
Asim Aslam
e2e426b90c Increase default pool size 2019-01-16 18:54:32 +00:00
Asim Aslam
784a89b488 Allow bytes.Frame to be set to sent just bytes 2019-01-16 15:27:57 +00:00
Asim Aslam
c1d0237370 Add client response 2019-01-14 21:30:43 +00:00
Asim Aslam
39c24baca9 rename mock things to memory 2019-01-14 15:27:25 +00:00
Asim Aslam
c17d0fcc0f grpc request 2019-01-13 19:54:07 +00:00
Asim Aslam
01f6683035 Add router option 2019-01-13 12:15:13 +00:00
Asim Aslam
9897c630ae remove request/response 2019-01-11 14:04:37 +00:00
Asim Aslam
9adebfcf1e rename method to endpoint 2019-01-10 21:25:31 +00:00
Asim Aslam
40ff5b749b Set topic header 2019-01-10 20:35:10 +00:00
Asim Aslam
59d82b0abe Add response 2019-01-10 11:43:36 +00:00
Asim Aslam
648da5494f Change a few things 2019-01-10 11:39:39 +00:00
Asim Aslam
1561ccbc14 remove clientCodec 2019-01-09 17:33:28 +00:00
Asim Aslam
4cb41721f1 further codec changes 2019-01-08 15:38:25 +00:00
Asim Aslam
e8b431c5ff rename codec interface 2019-01-07 18:17:13 +00:00
Asim Aslam
d179c971af Switch default codec and add default codec for server 2019-01-07 13:48:38 +00:00
Asim Aslam
5aeb28dfee Add error header 2019-01-07 09:11:36 +00:00
Asim Aslam
ed580204a8 Add grpc codec 2019-01-02 12:55:06 +00:00
Asim Aslam
e2623d8ef5 Make json/protobuf codecs 2018-12-31 22:01:16 +00:00
Asim Aslam
b3b4bc6059 remove Plus 2018-12-31 20:51:22 +00:00
Asim Aslam
386ced576a Process header/body in one call 2018-12-31 17:53:16 +00:00
Asim Aslam
dcf7a56f9b rename codec 2018-12-31 17:28:19 +00:00
Asim Aslam
ff982b5fd1 add method 2018-12-28 21:27:08 +00:00
Asim Aslam
28324412a4 Add X-Micro-Target header 2018-12-26 14:46:15 +00:00
Asim Aslam
9c2689301c add mock package comments 2018-12-01 12:56:21 +00:00
Asim Aslam
45c05c4e2b Add timeout error 2018-11-25 09:41:28 +00:00
Asim Aslam
172ffee8c3 add rpc package comments 2018-11-20 10:30:53 +00:00
fireyang
ef8b5e28b0 fix rpc client call WARNING: DATA RACE 2018-09-20 10:08:00 +08:00
fireyang
446d3fc72e fix bug: loop variable i captured by func literal 2018-09-19 21:58:20 +08:00
Asim Aslam
88505388c1 Add verbosity to errors 2018-07-26 09:33:50 +01:00
Asim Aslam
d3a76e646a retry only on timeout or internal server error 2018-07-22 17:41:58 +01:00
Asim Aslam
ac2106ced7 strip deadline from stream 2018-07-17 16:39:07 -07:00
Asim Aslam
1b4f7d8a68 a stream should not timeout 2018-07-17 16:32:35 -07:00
Asim Aslam
5eb2e79b86 go fmt 2018-07-17 16:31:09 -07:00
Hunyadvári Péter
52a470532d handle function in mock response 2018-06-13 17:46:30 +02:00
Asim Aslam
ba8582a47a change retries to actually mean retries 2018-05-28 16:01:04 +01:00
Asim Aslam
b4f47b1cc9 Set the default pool size to 1 2018-05-26 09:10:29 +01:00
bogle
541e894507 just update the pool configuration if the options changed, because recreating the pool,existed idleconnection, if any, will be dropped without closing 2018-05-26 15:38:41 +08:00
Asim Aslam
b17a802675 update mock 2018-05-10 17:39:13 +01:00
Asim Aslam
c3c0543733 add message options 2018-05-10 17:33:54 +01:00
Asim Aslam
0315b4480f revert some changes 2018-04-17 11:00:22 +01:00
Asim Aslam
19fdfba0bf move wrapper files 2018-04-14 19:24:17 +01:00
Asim Aslam
65068e8b82 rename Streamer to Stream 2018-04-14 18:15:09 +01:00
Asim Aslam
c2cfe5310c Rework client interface 2018-04-14 18:06:52 +01:00
Asim Aslam
07068379c6 remove remote func methods 2018-04-14 16:16:58 +01:00
Asim Aslam
73e22eb5b1 gofmt 2018-04-06 14:03:00 +01:00
leon.peng
9b99d50396 fix bug #239 2018-03-21 03:17:38 +00:00
Asim Aslam
c9b40cb33b switch to stdlib context 2018-03-03 11:53:52 +00:00
Asim Aslam
32b7ebcfbc use updated error formatting 2017-06-11 13:02:08 +01:00
Asim Aslam
a7312f5c7e log panics 2017-05-16 19:14:00 +01:00
Thinh Nguyen
ea34e23118
Add Retry option for clients 2017-04-12 16:47:40 -04:00
wangkechun
059b9d36d7 fix fmt str 2017-02-25 22:53:25 +08:00
Asim Aslam
71d717a06d strip doc.go files 2016-12-14 15:41:48 +00:00
Asim Aslam
095793ee96 handle codec and transport errors 2016-12-06 19:40:44 +00:00
Asim
b05b42eccd Differentiate between request and call timeouts 2016-11-22 10:44:32 +01:00
Asim
99a3ba7358 wrap before the call, we don't want to rewrap on retry 2016-11-09 18:02:41 +00:00
Asim
2df46131eb fix test 2016-11-07 18:54:44 +00:00
Asim
0d84fb1913 Add wrapper test 2016-11-07 18:51:25 +00:00
Asim
7ee35f50b1 WrapCall rather than WrapCallFunc 2016-11-07 18:06:15 +00:00
Asim
f3b591d722 Strip stream func and rename call wrappers... 2016-11-07 17:58:34 +00:00
Asim
5ee585e77d Rename to CallFuncWrappers 2016-11-07 17:52:19 +00:00
Asim
c6b5237cce Add call func wrapper 2016-11-07 17:49:35 +00:00
Asim
d1d41b5a67 Fix comment 2016-11-07 16:51:28 +00:00
Scott Finlay
1ab59094eb Fixing return value and gofmt 2016-11-07 17:46:12 +01:00
Scott Finlay
a6812ba332 Adjusting the logic around the returned error from the retry function 2016-11-07 17:41:51 +01:00
Scott Finlay
c6737ac64c Adjusting import because of failed build 2016-11-07 17:15:11 +01:00
Scott Finlay
a66bce0e4b Adjusting arguments and return value of retry function and adding new retry logic to stream 2016-11-07 17:10:40 +01:00
Scott Finlay
092d17a74e Adjusting names 2016-11-07 09:40:11 +01:00
Scott Finlay
d7e4062a0e Adding the ability to specify a function to check if micro should retry a failed rpc call 2016-11-03 10:51:47 +01:00
Asim
b8241f3026 specify the Accept header along with Content-Type 2016-08-25 13:34:47 +01:00
Asim
02481c4446 request panic catch all 2016-06-30 16:19:02 +01:00
Asim
ff0bd76905 Add a pool test 2016-06-07 01:18:54 +01:00
Asim
58ad01e3e1 Don't log that cruft 2016-06-07 00:48:34 +01:00
Asim
89401cbb95 Make pool configurable 2016-06-07 00:46:14 +01:00
Asim
38a66817e6 Add a conn lifetime for the pool 2016-06-06 23:37:52 +01:00
Asim
6669248291 gofmt 2016-06-06 23:37:07 +01:00
Asim
739b094cd2 Merge branch 'master' into pool 2016-06-06 14:06:03 +01:00
Mr Talbot
6de507b7b5 MockClient.CallRemote now returns nil on success
CallRemote was not returning nil on success as it should due to a missing return
2016-05-28 20:52:59 +01:00
Asim
1254a87286 Add package comments 2016-05-24 22:22:46 +01:00
Asim
98f295b6b0 Noobed the deadlock 2016-05-13 18:24:01 +01:00
Asim
2e9f4271a8 Pool first attempt 2016-05-13 15:58:53 +01:00
Asim
b6f5e15362 Fix the error returns from done and bail early if we dont have time 2016-05-12 23:56:25 +01:00
Asim
00a26677b8 Continue to return our error types 2016-05-12 23:52:29 +01:00
Asim
8c8573426c Add cascading timeouts 2016-05-12 23:32:58 +01:00
Asim
2254578760 We don't need sync.Once, we can just select 2016-05-11 00:01:32 +01:00
Asim
d6fdfc252e Make it easier to add select filters 2016-04-23 21:37:26 +01:00
Asim
7739e23401 Call it mock TestResponse 2016-04-06 18:38:33 +01:00
Asim
9d060bf6e1 Test struct works with mock client 2016-04-06 18:37:46 +01:00
Asim
ac6b8b730b First stab at mock client 2016-04-06 18:33:57 +01:00
Asim
2f50c74f41 Satisfy the golint gods a little 2016-04-06 17:53:16 +01:00
Asim
7167f998ce First crack at backoff function 2016-04-05 20:04:37 +01:00
Asim
56c6993eb8 Set CallOptions as struct in Options. Can then be overridden easily during Call/Stream 2016-04-05 18:07:07 +01:00
Asim
71764564e7 Add packages for the defaults 2016-03-14 10:45:38 +00:00
Asim
8edb0c4b06 Add client comment 2016-01-30 21:15:08 +00:00
Asim
6b7f2f3bd3 Merge pull request #45 from micro/metadata
Move context to metadata
2016-01-28 18:30:53 +00:00
Asim
1cc621e2d6 FromContext/NewContext methods 2016-01-28 18:23:24 +00:00
Asim
d306559d8f Nitpick Headers to Header 2016-01-28 18:11:13 +00:00
Asim
9ae0956cea Move context to metadata 2016-01-28 17:55:28 +00:00
Asim
7401c44973 This is actually a useless error 2016-01-07 01:58:38 +00:00
Asim
8bf72a3325 Replace map[string]string with Context for extra options. map[string]string is essentially useless. Context can store anything 2016-01-06 16:25:12 +00:00
Asim
ad4637d89b Lets strip out the rpcplus code 2016-01-05 21:13:20 +00:00
Asim
40cd086543 Strip some code from the client 2016-01-05 20:38:01 +00:00
Asim
d43d3e8efa Add transport dial timeout 2016-01-03 21:25:03 +00:00
Asim
332a229169 Add request timeout 2016-01-03 21:14:33 +00:00
Asim
1037663acf Add retries 2016-01-02 23:16:15 +00:00
Asim
3b56a62589 Update the way flags are used 2016-01-02 19:12:17 +00:00
Asim
64b45f7846 Update options to be public. This means people can implement the interfaces and actually use the options 2015-12-31 18:11:46 +00:00
Asim
bffd55f500 Channel rather than mutex to check is closed 2015-12-28 19:11:10 +00:00
Asim
be43d827c7 Add String method to all interfaces 2015-12-19 21:56:14 +00:00
Asim
3b295b16e7 Working bidirectional streaming example 2015-12-18 20:28:50 +00:00
Asim
a5be9ca585 switchup init 2015-12-18 01:21:56 +00:00
Asim
4cba0c57ab Checkpoint the world 2015-12-18 01:01:59 +00:00