diff options
author | Valery Piashchynski <[email protected]> | 2021-01-25 16:18:26 +0300 |
---|---|---|
committer | GitHub <[email protected]> | 2021-01-25 16:18:26 +0300 |
commit | f1875f5715bf7635e17697ae3513ba3d21e4e524 (patch) | |
tree | f9c0c3876ef542217a8bd7ff17f90bffc018132f /service/entry.go | |
parent | a063ad05b1cab8ec71eecc32f836efa4d431c6b8 (diff) | |
parent | 99bf203511b8af4be37186017e2e0c73a030d4f3 (diff) |
Merge pull request #429 from spiral/2.0
Release 2.0-dev
Diffstat (limited to 'service/entry.go')
-rw-r--r-- | service/entry.go | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/service/entry.go b/service/entry.go deleted file mode 100644 index 497742d1..00000000 --- a/service/entry.go +++ /dev/null @@ -1,59 +0,0 @@ -package service - -import ( - "sync" -) - -const ( - // StatusUndefined when service bus can not find the service. - StatusUndefined = iota - - // StatusInactive when service has been registered in container. - StatusInactive - - // StatusOK when service has been properly configured. - StatusOK - - // StatusServing when service is currently done. - StatusServing - - // StatusStopping when service is currently stopping. - StatusStopping - - // StatusStopped when service being stopped. - StatusStopped -) - -// entry creates association between service instance and given name. -type entry struct { - name string - svc interface{} - mu sync.Mutex - status int -} - -// status returns service status -func (e *entry) getStatus() int { - e.mu.Lock() - defer e.mu.Unlock() - - return e.status -} - -// setStarted indicates that service hasStatus status. -func (e *entry) setStatus(status int) { - e.mu.Lock() - defer e.mu.Unlock() - e.status = status -} - -// hasStatus checks if entry in specific status -func (e *entry) hasStatus(status int) bool { - return e.getStatus() == status -} - -// canServe returns true is service can serve. -func (e *entry) canServe() bool { - _, ok := e.svc.(Service) - return ok -} |