Пример #1
0
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
}
Пример #2
0
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)
	}
}