Commit Graph

51 Commits

Author SHA1 Message Date
Asim Aslam
4e27aac398 regen router proto 2019-07-26 18:07:36 -07:00
Asim Aslam
7ca06f0c1d set router proto package name to go.micro.router 2019-07-26 18:07:14 -07:00
Milos Gajdos
9ad5ae6644
Adds new RPC methods to router service interface
We have added Advertise() and Process() RPCs in this commit.
2019-07-24 21:07:04 +01:00
Milos Gajdos
13a8cfe7f3
Small function documentation update 2019-07-24 17:22:27 +01:00
Milos Gajdos
1e94d9fe5a
Router cleanup and refactoring for win and profit.
This commit adds the following changes to router package:
* it refactors Advertise() function which now does only what
it claims to do: advertising
* various router packages functions/methods have been renamed to make
their functionality more obvious and more in line with what they actually do
* function documentation changes related to the above bullet points
2019-07-24 17:16:52 +01:00
Milos Gajdos
94b6455577
Increment WaitGroup before launching advertiseEvents goroutine 2019-07-17 13:02:47 +01:00
Milos Gajdos
2803146673
Renaming rampage
Addressing the comments in #591, router.String() now returns "default"

Furthermore, a tonne of other renaming has been included in this commit
as a result of running go vet ./... inside the router package.
2019-07-17 00:06:11 +01:00
Milos Gajdos
92495d22db
Fixes advert dampening behaviour.
This commit adds the following changes:
* advert now stores a list of route events as opposed to just last one
* attempt to dedup route events before appending them to advert
* have max suppress threshold for long time suppressed adverts
* decaying events on every advert tick

Originally we werent decaying penalties on every advert tick.
That was incorrect behaviour. Furthermore some events would end up being
accumulated potentially causing memory leaks.

We were also overriding the last received router event which was causing
incorrect sequence of events to be applied when received by a receiver:
Create, Delete would be "squashed" into Delete only which would be
nonsensical since the Create event would never be delivered hence we
would be deleting nonexistent routes.

Not Decaying the events on every tick or not having the max suppression
threshold could lead to DoS by growing the router memory infinitely.
2019-07-16 19:00:25 +01:00
Milos Gajdos
9c851f297b
Added proto.Advert type to protobuf definitions 2019-07-11 21:14:34 +01:00
Milos Gajdos
35a1de91a9
Advertise full table every minute. 2019-07-11 12:39:20 +01:00
Milos Gajdos
a0ee7d2092
Added update action to manageServiceRoutes. Table is embedded; skip opts 2019-07-10 21:28:32 +01:00
Milos Gajdos
163b917ec7
proto.EventType Insert is now Create to mirror table.Event 2019-07-10 18:37:46 +01:00
Milos Gajdos
8f5aed707e
Table.Add is now Table.Create. Insesrt event is now Create event. 2019-07-10 17:46:22 +01:00
Milos Gajdos
86dfa82dfa
Added List and Watch rpc calls. 2019-07-10 17:21:55 +01:00
Asim Aslam
5b565f9f10 update comment 2019-07-10 07:56:52 +01:00
Asim Aslam
9955ed2034 move table 2019-07-10 07:56:18 +01:00
Asim Aslam
c36107e811 cleanup consts 2019-07-10 07:51:24 +01:00
Asim Aslam
a08b64c8ab remove the string methods 2019-07-10 07:50:33 +01:00
Asim Aslam
0a1b657221 visual cleanup of router code 2019-07-10 07:45:27 +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
23cb811f60
Removed fmt.Stringer artistry from all roouter and table structs 2019-07-09 16:17:18 +01:00
Milos Gajdos
c5fb409760
Removed debug logs 2019-07-09 15:55:39 +01:00
Milos Gajdos
70665e5a7d
Route has changed to accomodate Link, Service and Address 2019-07-09 15:46:32 +01:00
Milos Gajdos
449aa0a339
Collect ANNOUNCE mesage events before adding default gateway. 2019-07-09 15:46:31 +01:00
Milos Gajdos
265271008e
Simplified processEvents loop; Added router Announcement. 2019-07-09 15:46:31 +01:00
Milos Gajdos
b82245429e
Simplified table logic. Lookup tests. mucp/cient update 2019-07-09 15:46:31 +01:00
Milos Gajdos
cc590f5f2c
Table now has a dedicated package inside router package. 2019-07-09 15:46:31 +01:00
Milos Gajdos
0c1a28a9b6
Router routing table management. Table route hashes. Status codes changed.
We now manage routing table actions using dedicated functions run on
either registry or services in the registry.

Routing table now uses Route.Hash() instead of maintaining its own hash
struct filed which previously performed these operations.

Various names of variables have been changed to make them more concise.
2019-07-09 15:46:31 +01:00
Milos Gajdos
30d05e34a9
Read and remove routes based on registry event deltas 2019-07-09 15:46:31 +01:00
Milos Gajdos
b68f0e237f
Removed event from eventMap once sent to be advertised 2019-07-09 15:46:31 +01:00
Milos Gajdos
72ef032162
First shot at flapping detection and event advertising.
This commit also adds Route hash function, lots of debug messages for
now and String() methods for various API objects.
2019-07-09 15:46:30 +01:00
Milos Gajdos
d6c07dfb16
Update is now Advert 2019-07-09 15:46:30 +01:00
Milos Gajdos
ea872f6900
Updated error statements; Update ships list of events. 2019-07-09 15:46:30 +01:00
Asim Aslam
e0bf1c2283 Remove Port from registry 2019-07-08 08:01:42 +01:00
Milos Gajdos
0e1fcc4f28
Stop hardcoding table sizes; increment as you move on. 2019-07-01 23:38:49 +01:00
Milos Gajdos
8f22e61a8b
List test function properly named. 2019-07-01 23:38:48 +01:00
Milos Gajdos
956902f641
Added List tests. 2019-07-01 23:38:48 +01:00
Milos Gajdos
ffac0b9a18
First batch of Add/Del/Update tests. 2019-07-01 23:38:48 +01:00
Milos Gajdos
da299ea26b
Simmplified RT Lookup. No more Metric in Query. 2019-07-01 20:33:08 +01:00
Milos Gajdos
f6e064cdbd
Fixed router idempotency. Return registry.ErrWatchStopped from mdns reg 2019-07-01 15:46:26 +01:00
Milos Gajdos
cff46c3fd8
Added Init state. Recreate exit and advertise channels when recovering
In order to differentiate between intialized and other states we
introduced a new state: Init. The router is in this state only when it's
created.

We have cleaned up router status management which is now handled by
manageStatus function only.
2019-07-01 15:46:26 +01:00
Milos Gajdos
32300eadc1
Added Router Status which allows to track router status 2019-07-01 15:46:25 +01:00
Milos Gajdos
8ad2f73ad6
Advertisement is now Update; started bit is now running. 2019-07-01 15:46:25 +01:00
Milos Gajdos
9d7420658d
Changed router interface. Added table watcher. Advertise routes
* Changed router interface to return Advertisement channel
* Added default gateway route to the routing table if supplied
* Watch table for updates and advertise to the network
* We hash the routes on 3-tuple (Destination, Gateway, Network)
2019-07-01 15:46:25 +01:00
Asim Aslam
67e3d560fe Lookup every service. FML 2019-06-27 14:37:52 +01:00
Asim Aslam
9630e153a5 fix grpc proto wrapper 2019-06-27 13:08:06 +01:00
Asim Aslam
43297f731c Add default router 2019-06-27 12:57:23 +01:00
Milos Gajdos
76011b151d
Bugfix: Set gateway to node.Address
gw has not been initialized; it was basically an empty string and only
got populated by Sprintf-ing the addr:port IF the port has been set.
This commit sets the gw to node.Address to it's never an empty string.
2019-06-26 16:28:33 +01:00
Asim Aslam
27b145f968 add router proto 2019-06-26 16:23:10 +01:00
Milos Gajdos
fe84a2d726
Route per service node. No Network Registry for now. 2019-06-26 16:03:19 +01:00