func (store *NodeStore) GetWorker(key string) *Worker {
	store.RLock()
	defer store.RUnlock()
	for _, workers := range store.nodesData {
		for _, worker := range workers {
			if worker.Key == key {
				return worker
			}
		}
	}
	return nil
}
GetWorker is exported
package cache
import "github.com/cloudtask/common/models"
import "github.com/cloudtask/libtools/gounits/algorithm"
import (
	"hash/crc32"
	"sort"
	"strings"
	"sync"
)
type NodeEvent int
const (
	NODE_CREATED_EVENT NodeEvent = iota + 1
	NODE_CHANGED_EVENT
	NODE_REMOVED_EVENT
)
func (event NodeEvent) String() string {
	switch event {
	case NODE_CREATED_EVENT:
		return "NODE_CREATED_EVENT"
	case NODE_CHANGED_EVENT:
		return "NODE_CHANGED_EVENT"
	case NODE_REMOVED_EVENT:
		return "NODE_REMOVED_EVENT"
	}
	return ""
}
type NodeCacheEventHandlerFunc func(event NodeEvent, location string, worker *Worker)
type Worker struct {
	Location string
	*models.AttachData
	*models.Server
}
type NodeStore struct {
	sync.RWMutex
	nodesData map[string][]*Worker
	circle    map[string]*algorithm.Consistent
	callback  NodeCacheEventHandlerFunc
}
func NewNodeStore(callback NodeCacheEventHandlerFunc) *NodeStore {
	return &NodeStore{
		nodesData: make(map[string][]*Worker, 0),
		circle:    make(map[string]*algorithm.Consistent, 0),
		callback:  callback,
	}
}