예제 #1
0
파일: service.go 프로젝트: vulcand/vulcand
func (s *Service) newEngine() error {
	box, err := s.newBox()
	if err != nil {
		return err
	}
	var ng engine.Engine

	if s.options.EtcdApiVersion == 3 {
		ng, err = etcdv3ng.New(
			s.options.EtcdNodes,
			s.options.EtcdKey,
			s.registry,
			etcdv3ng.Options{
				EtcdCaFile:              s.options.EtcdCaFile,
				EtcdCertFile:            s.options.EtcdCertFile,
				EtcdKeyFile:             s.options.EtcdKeyFile,
				EtcdConsistency:         s.options.EtcdConsistency,
				EtcdSyncIntervalSeconds: s.options.EtcdSyncIntervalSeconds,
				Box: box,
			})
	} else {
		ng, err = etcdv2ng.New(
			s.options.EtcdNodes,
			s.options.EtcdKey,
			s.registry,
			etcdv2ng.Options{
				EtcdCaFile:              s.options.EtcdCaFile,
				EtcdCertFile:            s.options.EtcdCertFile,
				EtcdKeyFile:             s.options.EtcdKeyFile,
				EtcdConsistency:         s.options.EtcdConsistency,
				EtcdSyncIntervalSeconds: s.options.EtcdSyncIntervalSeconds,
				Box: box,
			})
	}
	if err != nil {
		return err
	}
	s.ng = ng
	return err
}
예제 #2
0
파일: service.go 프로젝트: huhoo/vulcand
func (s *Service) newEngine() error {
	box, err := s.newBox()
	if err != nil {
		return err
	}
	ng, err := etcdv2ng.New(
		s.options.EtcdNodes,
		s.options.EtcdKey,
		s.registry,
		etcdv2ng.Options{
			EtcdCaFile:              s.options.EtcdCaFile,
			EtcdCertFile:            s.options.EtcdCertFile,
			EtcdKeyFile:             s.options.EtcdKeyFile,
			EtcdConsistency:         s.options.EtcdConsistency,
			EtcdSyncIntervalSeconds: s.options.EtcdSyncIntervalSeconds,
			Box: box,
		})
	if err != nil {
		return err
	}
	s.ng = ng
	return err
}