-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #884 from mrpalide/remove-heartbeat
Remove heartbeat | Add Deregister
- Loading branch information
Showing
15 changed files
with
97 additions
and
235 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package appdisc | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/skycoin/skywire/pkg/servicedisc" | ||
) | ||
|
||
// Updater updates the associated app discovery | ||
type Updater interface { | ||
|
||
// Start starts the updater. | ||
Start() | ||
|
||
// Stop stops the updater. | ||
Stop() | ||
} | ||
|
||
// emptyUpdater is for apps that do not require discovery updates. | ||
type emptyUpdater struct{} | ||
|
||
func (emptyUpdater) Start() {} | ||
func (emptyUpdater) Stop() {} | ||
|
||
// serviceUpdater updates service-discovery entry of locally running App. | ||
type serviceUpdater struct { | ||
client *servicedisc.HTTPClient | ||
} | ||
|
||
func (u *serviceUpdater) Start() { | ||
ctx := context.Background() | ||
if err := u.client.Register(ctx); err != nil { | ||
return | ||
} | ||
} | ||
|
||
func (u *serviceUpdater) Stop() { | ||
ctx := context.Background() | ||
if err := u.client.DeleteEntry(ctx); err != nil { | ||
return | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.