mirror of
https://github.com/tim-beatham/smegmesh.git
synced 2025-08-19 01:15:58 +02:00
Interfacing out components for unit testing
This commit is contained in:
@@ -7,12 +7,14 @@ import (
|
||||
"google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// SyncErrorHandler: Handles errors when attempting to sync
|
||||
type SyncErrorHandler interface {
|
||||
Handle(meshId string, endpoint string, err error) bool
|
||||
}
|
||||
|
||||
// SyncErrorHandlerImpl Is an implementation of the SyncErrorHandler
|
||||
type SyncErrorHandlerImpl struct {
|
||||
meshManager *mesh.MeshManger
|
||||
meshManager *mesh.MeshManager
|
||||
}
|
||||
|
||||
func (s *SyncErrorHandlerImpl) incrementFailedCount(meshId string, endpoint string) bool {
|
||||
@@ -22,12 +24,6 @@ func (s *SyncErrorHandlerImpl) incrementFailedCount(meshId string, endpoint stri
|
||||
return false
|
||||
}
|
||||
|
||||
err := mesh.IncrementFailedCount(endpoint)
|
||||
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -44,6 +40,6 @@ func (s *SyncErrorHandlerImpl) Handle(meshId string, endpoint string, err error)
|
||||
return false
|
||||
}
|
||||
|
||||
func NewSyncErrorHandler(m *mesh.MeshManger) SyncErrorHandler {
|
||||
func NewSyncErrorHandler(m *mesh.MeshManager) SyncErrorHandler {
|
||||
return &SyncErrorHandlerImpl{meshManager: m}
|
||||
}
|
||||
|
Reference in New Issue
Block a user