Commit Graph

1354 Commits

Author SHA1 Message Date
Asim Aslam
1b4005e9a5 Go fmt everything 2019-06-21 17:20:41 +01:00
Asim Aslam
3f97743e34 Move router and proxy into network package 2019-06-21 17:20:31 +01:00
Asim Aslam
7936d74602 Update comments 2019-06-21 16:17:12 +01:00
Asim Aslam
6db720b197 Merge branch 'master' of ssh://github.com/micro/go-micro 2019-06-21 15:14:08 +01:00
Asim Aslam
ca5acba0c6 Move selector to client/selector 2019-06-21 15:13:54 +01:00
Asim Aslam
b4acb9bb58
Merge pull request #538 from magodo/consul_path_prefix_leading_slash
config consul source supports slash as prefix
2019-06-21 14:23:53 +01:00
Asim Aslam
c350e19552 Move cmd => config/cmd 2019-06-21 13:36:11 +01:00
Asim Aslam
4aa0192eba Update go mod 2019-06-21 12:55:31 +01:00
magodo
3c82b2e9e8 Merge branch 'consul_path_prefix_leading_slash' into dev 2019-06-21 16:53:21 +08:00
magodo
9514bd7b2a Merge branch 'config_source_consul_support_array' into dev 2019-06-21 16:52:01 +08:00
magodo
7acd249147 config consul source supports slash as prefix
`config.NewConfig()` with consul source will both read from consul
and watch consul for changes. Hence, the `prefix` is used in these
2 cases:

- read case: it is used to strip path based on the `KVPair` returned
from consul `kv.List()` method
- watch case: it is used as the `key` of watch query (`keyprefix` type)

So for *watch case*, the `key` is leagal to be `/` for watching change
on root. While for *read case*, because `KVPair.Key` is always stripped
off the leading slash, so if user specified some `prefix` with leading
slash, we should strip it also.

An extream case would be: user want's to read & watch node in root dir.
One would specify `prefix` as `/`, and it should work then.
2019-06-21 16:35:48 +08:00
magodo
1983b4ae92 variable rename to abstract encoder 2019-06-21 15:30:45 +08:00
magodo
92b998c3ab consul config source support 1st-level array
Check whetehr the 1st level encoded json is array or not, to
support 1st level array in consul config.

During debug, i suspected the incapability of arrray is caused by
json reader, so i added test for array. I think it makes no harm
to also check that in.
2019-06-21 00:25:39 +08:00
Milos Gajdos
1765be049b
router.Start() is now router.Advertise(). Updated code documentation. 2019-06-20 13:04:58 +01:00
Asim Aslam
8d5d812e32 Fix a streaming bug 2019-06-20 12:44:51 +01:00
Asim Aslam
3f910038a3 Move store to data/store 2019-06-19 22:04:13 +01:00
Asim Aslam
a8042adac1
Merge pull request #528 from milosgajdos83/router
Adds router package
2019-06-19 21:33:39 +01:00
Milos Gajdos
10a3636a9f
Renamed variables, options and functions 2019-06-19 21:22:14 +01:00
Milos Gajdos
4e5fbbf7eb
Replaced the debug network string by the correct router local address. 2019-06-19 18:11:16 +01:00
Milos Gajdos
59035ab801
Removed debug logs. advertiseToNetwork() replaced watchTable().
Debug logs that were helpful when squashing bugs have been removed.

advertiseToNetwork replaced the watchTable which originally watched the
routing table entries. We now take a different approach to propagating
the local registry services into the network registry.
2019-06-19 18:03:43 +01:00
Milos Gajdos
d3525ebab3
Debug messages. Squashed Add Route bugs and few others. 2019-06-19 18:03:43 +01:00
Milos Gajdos
2674294cbe
Delete route when no node is available. 2019-06-19 18:03:43 +01:00
Milos Gajdos
b20dd16f92
Watcher now emits events instead of results. 2019-06-19 18:03:43 +01:00
Milos Gajdos
5088c9d916
Increased Network registry TTL. Routing Table remove is now delete.
Remove has been renamed to Delete to be more in line with the framework.

A bunch of comments have been added/updated for the future generations

We have increased the Network Registry TTL to 2 minutes.
2019-06-19 18:03:42 +01:00
Milos Gajdos
f62fcaad76
Added router ID. Deregister remote services when router is stopped.
Added ID function to router interface.

Network registry addresses are deregistered when the router is stopped.

Query has been updated to search for particular GW in lookups.
2019-06-19 18:03:42 +01:00
Milos Gajdos
322eaae529
Small code refactoring. Added more comments and parseToNode func 2019-06-19 18:03:42 +01:00
Milos Gajdos
6a33b7576b
Removed router watcher code duplication. Small code refactor. 2019-06-19 18:03:42 +01:00
Milos Gajdos
6e669d4611
Reorganised source. Renamed files. No Code change. 2019-06-19 18:03:42 +01:00
Milos Gajdos
95fc625e99
Big refactor. New Registry watchers. New options. New names. 2019-06-19 18:03:42 +01:00
Milos Gajdos
338e0fdf18
Lots of refactoring. We now have basic routing table watcher. 2019-06-19 18:03:42 +01:00
Milos Gajdos
5899134b66
Simplified API. Correct Router initialization. Debug printing. 2019-06-19 18:03:41 +01:00
Milos Gajdos
da18ea4ab5
Changed default router table modifications. Entry is now Route. 2019-06-19 18:03:41 +01:00
Milos Gajdos
459f4c8387
Added Router ID and query options to limit number of results 2019-06-19 18:03:41 +01:00
Milos Gajdos
9c57f32f58
Added Entry type. Basic implementation of Router and Table 2019-06-19 18:03:41 +01:00
Milos Gajdos
ad92e6821e
Removed DefaultTable() from global vars
We will not initialize DefaultTable as global var unless the users asks
for it explicitly.
2019-06-19 18:03:41 +01:00
Milos Gajdos
d7f0db04ec
Added network ID option. Added mutex to routing table. 2019-06-19 18:03:41 +01:00
Milos Gajdos
e4311c3a10
Redefined and polished some interfaces and data structures. 2019-06-19 18:03:41 +01:00
Milos Gajdos
ee8b6b3114
Redefeind interfaces; Added better modelled data strauctures
Router interface has been redefined which fits better with what we are
looking for.

Routing table now offers a comprehensive set of information about its
entries which will make up for rich queries in the future

Query interface has been defined to enable current basic and more
advanced queries in the future.
2019-06-19 18:03:41 +01:00
Milos Gajdos
08da7c1283
First commit: Outline of Router interface 2019-06-19 18:03:40 +01:00
Asim Aslam
6587ae07be
Merge pull request #523 from micro/grpc
GRPC Proxy
2019-06-19 15:31:45 +01:00
Asim Aslam
1c1dae0642 Fix the grpc test 2019-06-19 12:34:45 +01:00
Asim Aslam
a0cb105cf6
Merge pull request #525 from magodo/consul_config_prefix_no_leading_slash
`prefix` in consul api starts with no leading slash
2019-06-19 08:12:35 +01:00
magodo
606b1ff7cf prefix in consul api starts with no leading slash
When `consul.StripPrefix(true)` is set, current impl. will pass the
specified prefix (or default prefix) when calling consul api.

However, `prefix` in consul api starts with no leading slash, so
the default prefix (`/micro/config`) doesn't actually work.

I avoid code changes (esp. the one in `util.go`) to eliminate
impact on users who already notice it.
2019-06-19 14:42:09 +08:00
Asim Aslam
73a8b14145
Merge pull request #524 from milosgajdos83/gosssip-remove-node
Properly delete service nodes
2019-06-19 07:11:27 +01:00
Milos Gajdos
c0a628d65b
Simplified delService code; properly delete service nodes 2019-06-18 21:39:00 +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
Asim Aslam
7266c62d09 remove comment 2019-06-18 15:33:31 +01:00
Asim Aslam
6459cdfc21 propagate updates to local watchers 2019-06-18 14:42:56 +01:00
Asim Aslam
ed54384bf4 Update network 2019-06-18 11:56:11 +01:00