-
-
Notifications
You must be signed in to change notification settings - Fork 21
Added API for packages, repos and resource usage statistics. #28
Conversation
Signed-off-by: Matteo Suppo <matteo.suppo@gmail.com>
Allow the connector to be configured with different urls
type response struct {
Packages []*apt.Package `json:"packages"`
Updates []*apt.Package `json:"updates"`
}
- "upgradable" status is copied in the main list `Package`
- `Upgradable` list has been renamed to `Updates` that better
reflect the meaning of the list
mastrolinux
left a comment
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.
Can be merged as is but if @cmaglie can create the generic handler in a short time frame that it is better.
| status.Publish() | ||
| } | ||
| // StatusEvent replies with the current status of the arduino-connector | ||
| func (status *Status) StatusEvent(client mqtt.Client, msg mqtt.Message) { |
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.
@smellai I am wondering if this one was used by either you in the getting started or @matteosuppo in the backend.
| status.Error("/upload", errors.Wrapf(err, "stop pid %d", sketch.PID)) | ||
| return | ||
| } | ||
| func (status *Status) UploadEvent(client mqtt.Client, msg mqtt.Message) { |
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.
@cmaglie avoiding having interfaces will force us to keep using mqtt. It could be the time to create a generic MessageHandler that does not care about the used protocol.
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.
I've just simplified the usage of callback by removing one indirection, previously UploadCB returned an mqtt.MessageHandler to be registered with mqtt lib
func UploadCB(status *Status) mqtt.MessageHandler {
return func(client mqtt.Client, msg mqtt.Message) {
[...do things with client and msg...]now UploadCB is the mqtt.MessageHandler:
func (status *Status) UploadEvent(client mqtt.Client, msg mqtt.Message) {
[...do things with client and msg...]We are dependent on mqtt exactly as before...
If we want to be protocol-agnostic we should actually try to implement another protocol to see where the hypotetical interface should be placed.
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.
Too see the real extension of this commit is better to filter whitespace-diffs:
d324c03?w=1
packages are all lower-case (I guess it is by policy on debian?) unless the user types upper case chars in the search box there should be no problems. |
|
the frontend directly converts uppercase to lowercase, that was done by @smellai I am going to merge as it is now |
No description provided.