-
Notifications
You must be signed in to change notification settings - Fork 12
Modules
Christopher McGregor edited this page Mar 19, 2018
·
35 revisions
Modules "building blocks" that integrate with Disgo are called services that implement the interface IService located in the disgo_commons repo.
// IService
type IService interface {
IsRunning() bool
Go(waitGroup *sync.WaitGroup)
}
- IsRunning() returns if the service is still running
- Go(waitGroup *sync.WaitGroup) is the main entry point of the service
The following is a shell implementation of the DAPoS service:
package core
import (
"sync"
log "github.com/sirupsen/logrus"
)
// DAPoSService
type DAPoSService struct {
running bool
}
// NewDAPoSService
func NewDAPoSService() *DAPoSService {
return &DAPoSService{
running: false,
}
}
// IsRunning
func (daposService *DAPoSService) IsRunning() bool {
return daposService.running
}
// Go
func (daposService *DAPoSService) Go(waitGroup *sync.WaitGroup) {
daposService.running = true
}