func (l *localState) RemoveCheck(checkID string) {
	l.Lock()
	defer l.Unlock()
	delete(l.checks, checkID)
	l.checkStatus[checkID] = syncStatus{remoteDelete: true}
	l.changeMade()
}
RemoveCheck is used to remove a health check from the local state.
The agent will make a best effort to ensure it is deregistered
package agent
import (
	"log"
	"reflect"
	"strings"
	"sync"
	"sync/atomic"
	"time"
	"github.com/socketplane/socketplane/Godeps/_workspace/src/github.com/hashicorp/consul/consul"
	"github.com/socketplane/socketplane/Godeps/_workspace/src/github.com/hashicorp/consul/consul/structs"
)
const (
	syncStaggerIntv = 3 * time.Second
	syncRetryIntv   = 15 * time.Second
	permissionDenied = "Permission denied"
)
type syncStatus struct {
	remoteDelete bool  
	inSync       bool  
}
type localState struct {
	paused int32
	sync.Mutex
	logger *log.Logger
	config *Config
	iface consul.Interface
	services      map[string]*structs.NodeService
	serviceStatus map[string]syncStatus
	checks      map[string]*structs.HealthCheck
	checkStatus map[string]syncStatus
	deferCheck map[string]*time.Timer
	consulCh chan struct{}
	triggerCh chan struct{}
}
func (l *localState) Init(config *Config, logger *log.Logger) {
	l.config = config
	l.logger = logger
	l.services = make(map[string]*structs.NodeService)
	l.serviceStatus = make(map[string]syncStatus)
	l.checks = make(map[string]*structs.HealthCheck)
	l.checkStatus = make(map[string]syncStatus)
	l.deferCheck = make(map[string]*time.Timer)
	l.consulCh = make(chan struct{}, 1)
	l.triggerCh = make(chan struct{}, 1)
}
func (l *localState) SetIface(iface consul.Interface) {
	l.iface = iface
}
func (l *localState) changeMade() {
	select {
	case l.triggerCh <- struct{}{}:
	default:
	}
}
func (l *localState) ConsulServerUp() {
	select {
	case l.consulCh <- struct{}{}:
	default:
	}
}
func (l *localState) Pause() {
	atomic.StoreInt32(&l.paused, 1)
}
func (l *localState) Resume() {
	atomic.StoreInt32(&l.paused, 0)
	l.changeMade()
}
func (l *localState) isPaused() bool {
	return atomic.LoadInt32(&l.paused) == 1
}
func (l *localState) AddService(service *structs.NodeService) {
	if service.ID == "" && service.Service != "" {
		service.ID = service.Service
	}
	l.Lock()
	defer l.Unlock()
	l.services[service.ID] = service
	l.serviceStatus[service.ID] = syncStatus{}
	l.changeMade()
}
func (l *localState) RemoveService(serviceID string) {
	l.Lock()
	defer l.Unlock()
	delete(l.services, serviceID)
	l.serviceStatus[serviceID] = syncStatus{remoteDelete: true}
	l.changeMade()
}
func (l *localState) Services() map[string]*structs.NodeService {
	services := make(map[string]*structs.NodeService)
	l.Lock()
	defer l.Unlock()
	for name, serv := range l.services {
		services[name] = serv
	}
	return services
}
func (l *localState) AddCheck(check *structs.HealthCheck) {
	check.Node = l.config.NodeName
	l.Lock()
	defer l.Unlock()
	l.checks[check.CheckID] = check
	l.checkStatus[check.CheckID] = syncStatus{}
	l.changeMade()
}