Skip to content
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

MF-20 - Refactor service #41

Merged
merged 10 commits into from
May 5, 2020
Merged

Conversation

mteodor
Copy link
Member

@mteodor mteodor commented Apr 29, 2020

closes #20

@@ -16,27 +16,40 @@ const (
device = "device"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we have folder services, and in it service.go? Are these local services on the gateway?

It is a little confusing, because we have service.go which relates to agent and then services which relate to local services...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But I currently have no better idea for naming.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we rename service.go to agent.go
or maybe services/info.go

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well... I am more bothered about the folder name services. I think we should rename service.go into agent.go for sure, and we can leave this services for now, but we need to document it somewhere - maybe add one README.md in the agent or these services folder...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for the folder maybe info, or stats so we have info/service.go
or maybe since it is basically only for heartbeat to call it heartbeat/service.go

mteodor added 5 commits April 30, 2020 11:26
Signed-off-by: Mirko Teodorovic <[email protected]>
Signed-off-by: Mirko Teodorovic <[email protected]>
Signed-off-by: Mirko Teodorovic <[email protected]>
Signed-off-by: Mirko Teodorovic <[email protected]>
Signed-off-by: Mirko Teodorovic <[email protected]>
@@ -16,27 +16,40 @@ const (
device = "device"
)

type Service struct {
type svc struct {
name string
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks very similar to Info{} - maybe one struct should contain another?

pkg/agent/heartbeat.go Show resolved Hide resolved
mteodor added 3 commits April 30, 2020 15:54
Signed-off-by: Mirko Teodorovic <[email protected]>
Signed-off-by: Mirko Teodorovic <[email protected]>
Signed-off-by: Mirko Teodorovic <[email protected]>
Copy link
Member

@drasko drasko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, a small nitpick left.

// Whenservice doesnt send heartbeat for some time gets marked offline
type svc struct {
info Info

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for this whie line IMHO.

Signed-off-by: Mirko Teodorovic <[email protected]>
for {
select {
case <-s.ticker.C:
// TODO - we can disable ticker when the status gets OFFLINE
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you create an issue for this please?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done #42

Copy link
Member

@drasko drasko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link

@manuio manuio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@drasko drasko merged commit 11a9764 into mainflux:master May 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor Service structure to match singleton pattern
3 participants