-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FR: QOS Ack Implementation #93
Changes from 4 commits
00829d4
4c9945f
e405bd2
7094bbe
a347b65
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,22 +49,22 @@ const ( | |
// where applicable). | ||
func (mt MessageType) SupportsTransaction() bool { | ||
switch mt { | ||
case Invalid0MessageType: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was looking to see how we did similar things as |
||
return false | ||
case Invalid1MessageType: | ||
return false | ||
case AuthorizationMessageType: | ||
case SimpleRequestResponseMessageType, CreateMessageType, RetrieveMessageType, UpdateMessageType, DeleteMessageType: | ||
return true | ||
default: | ||
return false | ||
} | ||
} | ||
|
||
// SupportsQOSAck tests if messages of this type are allowed to participate in QOS Ack | ||
// as specified in https://xmidt.io/docs/wrp/basics/#qos-description-qos . | ||
// If this method returns false, QOS Ack is foregone. | ||
func (mt MessageType) SupportsQOSAck() bool { | ||
switch mt { | ||
case SimpleEventMessageType: | ||
return false | ||
case ServiceRegistrationMessageType: | ||
return false | ||
case ServiceAliveMessageType: | ||
return false | ||
case UnknownMessageType: | ||
return false | ||
default: | ||
return true | ||
default: | ||
return false | ||
} | ||
} | ||
|
||
|
@@ -114,7 +114,7 @@ func init() { | |
func StringToMessageType(value string) (MessageType, error) { | ||
mt, ok := stringToMessageType[value] | ||
if !ok { | ||
return MessageType(-1), fmt.Errorf("Invalid message type: %s", value) | ||
return MessageType(-1), fmt.Errorf("invalid message type: %s", value) | ||
} | ||
|
||
return mt, nil | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,13 @@ const ( | |
// type determine what QOSLevel a message has. | ||
type QOSValue int | ||
|
||
const ( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I found myself wanting a quick default values for the talaria qos implementation and I can imagine other users will too. |
||
QOSLowValue QOSValue = iota * 25 | ||
QOSMediumValue | ||
QOSHighValue | ||
QOSCriticalValue | ||
) | ||
|
||
// Level determines the QOSLevel for this value. Negative values are assumed | ||
// to be QOSLow. Values higher than the highest value (99) are assumed to | ||
// be QOSCritical. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added this to provide a quick way to check whether msgs are able to qos ack.