func (s *store) getDomain(domain string) (*domain, *err.Error) { s.lock.RLock() defer s.lock.RUnlock() d, ok := s.data[domain] if !ok { return nil, err.NewError(err.KeyNotFound, "找不到该domain", nil) } return d, nil }
func (d *domain) getNode(node string) (*node, error) { d.lock.RLock() defer d.lock.RUnlock() if n, ok := d.data[node]; ok { return n, nil } else { return nil, err.NewError(err.KeyNotFound, "找不到该节点", nil) } }