diff options
author | Ondrej Fabry <ofabry@cisco.com> | 2019-02-08 08:38:56 +0100 |
---|---|---|
committer | Ondrej Fabry <ofabry@cisco.com> | 2019-02-08 10:04:56 +0100 |
commit | df05a70f90a1486a86a4156b1b0d68c94f2098b4 (patch) | |
tree | 45577756efc2ec766430ed17daa9ddcf9c5709b2 /api | |
parent | fa21c9d726ebb807895a8571af9a16dab5cd8d6e (diff) |
Add support for using multiple generated versions
- added CheckCompatibility for checking if given messages are compatible
- generating Messages global for easier usage of compatibility check
- added ReconnectInterval and MaxReconnectAttempts for reconnecting
- added Failed state that is sent after exceeding max reconnect attempts
Change-Id: I1062ba453f22657c1a2a31aa64cb103ef1223b0f
Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
Diffstat (limited to 'api')
-rw-r--r-- | api/api.go | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -15,7 +15,6 @@ package api import ( - "fmt" "time" ) @@ -89,6 +88,10 @@ type Channel interface { // from VPP before returning an error. SetReplyTimeout(timeout time.Duration) + // CheckCompatibility checks the compatiblity for the given messages. + // It will return an error if any of the given messages are not compatible. + CheckCompatiblity(msgs ...Message) error + // Close closes the API channel and releases all API channel-related resources in the ChannelProvider. Close() } @@ -119,9 +122,10 @@ var registeredMessages = make(map[string]Message) // RegisterMessage is called from generated code to register message. func RegisterMessage(x Message, name string) { - if _, ok := registeredMessages[name]; ok { + name = x.GetMessageName() + "_" + x.GetCrcString() + /*if _, ok := registeredMessages[name]; ok { panic(fmt.Errorf("govpp: duplicate message registered: %s (%s)", name, x.GetCrcString())) - } + }*/ registeredMessages[name] = x } |