当前位置: 首页>>代码示例>>Golang>>正文


Golang datastore.Get函数代码示例

本文整理汇总了Golang中github.com/control-center/serviced/datastore.Get函数的典型用法代码示例。如果您正苦于以下问题:Golang Get函数的具体用法?Golang Get怎么用?Golang Get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Get函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: AddUpdateResourcePool

func (s *scheduler) AddUpdateResourcePool(pool *pool.ResourcePool) error {
	if p, err := s.facade.GetResourcePool(datastore.Get(), pool.ID); err != nil {
		return err
	} else if p == nil {
		return s.facade.AddResourcePool(datastore.Get(), pool)
	}

	return s.facade.UpdateResourcePool(datastore.Get(), pool)
}
开发者ID:eval01-tts,项目名称:serviced,代码行数:9,代码来源:remotesync.go

示例2: AddUpdateHost

func (s *scheduler) AddUpdateHost(host *host.Host) error {
	if h, err := s.facade.GetHost(datastore.Get(), host.ID); err != nil {
		return err
	} else if h == nil {
		return s.facade.AddHost(datastore.Get(), host)
	}

	return s.facade.UpdateHost(datastore.Get(), host)
}
开发者ID:eval01-tts,项目名称:serviced,代码行数:9,代码来源:remotesync.go

示例3: AddUpdateService

func (s *scheduler) AddUpdateService(svc *service.Service) error {
	if sv, err := s.facade.GetService(datastore.Get(), svc.ID); err != nil {
		return err
	} else if sv == nil {
		return s.facade.AddService(datastore.Get(), *svc)
	}

	return s.facade.UpdateService(datastore.Get(), *svc)
}
开发者ID:eval01-tts,项目名称:serviced,代码行数:9,代码来源:remotesync.go

示例4: UpdateService

func (this *ControlPlaneDao) UpdateService(svc service.Service, unused *int) error {
	if err := this.facade.UpdateService(datastore.Get(), svc); err != nil {
		return err
	}

	// Create the tenant volume
	if tenantID, err := this.facade.GetTenantID(datastore.Get(), svc.ID); err != nil {
		glog.Warningf("Could not get tenant for service %s: %s", svc.ID, err)
	} else if _, err := this.dfs.GetVolume(tenantID); err != nil {
		glog.Warningf("Could not create volume for tenant %s: %s", tenantID, err)
	}
	return nil
}
开发者ID:eval01-tts,项目名称:serviced,代码行数:13,代码来源:service.go

示例5: GetRunningService

func (this *ControlPlaneDao) GetRunningService(request dao.ServiceStateRequest, running *dao.RunningService) error {
	glog.V(3).Infof("ControlPlaneDao.GetRunningService: request=%v", request)
	*running = dao.RunningService{}

	serviceID := request.ServiceID
	poolID, err := this.facade.GetPoolForService(datastore.Get(), serviceID)
	if err != nil {
		glog.Errorf("Unable to get service %v: %v", serviceID, err)
		return err
	}

	poolBasedConn, err := zzk.GetLocalConnection(zzk.GeneratePoolPath(poolID))
	if err != nil {
		glog.Errorf("Error in getting a connection based on pool %v: %v", poolID, err)
		return err
	}

	if thisRunning, err := zkservice.LoadRunningService(poolBasedConn, request.ServiceID, request.ServiceStateID); err != nil {
		glog.Errorf("zkservice.LoadRunningService failed (conn: %+v serviceID: %v): %v", poolBasedConn, request.ServiceID, err)
		return err
	} else {
		if thisRunning != nil {
			*running = *thisRunning
		}
	}

	return nil
}
开发者ID:carriercomm,项目名称:serviced,代码行数:28,代码来源:runningservice.go

示例6: GetServiceAddressAssignments

// GetServiceAddressAssignments fills in all AddressAssignments for the specified serviced id.
func (this *ControlPlaneDao) GetServiceAddressAssignments(serviceID string, assignments *[]addressassignment.AddressAssignment) error {
	err := this.facade.GetServiceAddressAssignments(datastore.Get(), serviceID, assignments)
	if assignments == nil {
		*assignments = make([]addressassignment.AddressAssignment, 0)
	}
	return err
}
开发者ID:eval01-tts,项目名称:serviced,代码行数:8,代码来源:addressassignment.go

示例7: GetRunningServices

func (this *ControlPlaneDao) GetRunningServices(request dao.EntityRequest, allRunningServices *[]dao.RunningService) error {
	// we initialize the data container to something here in case it has not been initialized yet
	*allRunningServices = make([]dao.RunningService, 0)
	allPools, err := this.facade.GetResourcePools(datastore.Get())
	if err != nil {
		glog.Error("runningservice.go failed to get resource pool")
		return err
	} else if allPools == nil || len(allPools) == 0 {
		return fmt.Errorf("no resource pools found")
	}

	for _, aPool := range allPools {
		poolBasedConn, err := zzk.GetLocalConnection(zzk.GeneratePoolPath(aPool.ID))
		if err != nil {
			glog.Error("runningservice.go Failed to get connection based on pool: %v", aPool.ID)
			return err
		}

		singlePoolRunningServices := []dao.RunningService{}
		singlePoolRunningServices, err = zkservice.LoadRunningServices(poolBasedConn)
		if err != nil {
			glog.Errorf("Failed GetAllRunningServices: %v", err)
			return err
		}

		for _, rs := range singlePoolRunningServices {
			*allRunningServices = append(*allRunningServices, rs)
		}
	}

	return nil
}
开发者ID:carriercomm,项目名称:serviced,代码行数:32,代码来源:runningservice.go

示例8: GetRunningServicesForHost

func (this *ControlPlaneDao) GetRunningServicesForHost(hostID string, services *[]dao.RunningService) error {
	// we initialize the data container to something here in case it has not been initialized yet
	*services = make([]dao.RunningService, 0)
	myHost, err := this.facade.GetHost(datastore.Get(), hostID)
	if err != nil {
		glog.Errorf("Unable to get host %v: %v", hostID, err)
		return err
	} else if myHost == nil {
		return nil
	}

	poolBasedConn, err := zzk.GetLocalConnection(zzk.GeneratePoolPath(myHost.PoolID))
	if err != nil {
		glog.Errorf("Error in getting a connection based on pool %v: %v", myHost.PoolID, err)
		return err
	}

	*services, err = zkservice.LoadRunningServicesByHost(poolBasedConn, hostID)
	if err != nil {
		glog.Errorf("zkservice.LoadRunningServicesByHost (conn: %+v host: %v) failed: %v", poolBasedConn, hostID, err)
		return err
	}

	return nil
}
开发者ID:carriercomm,项目名称:serviced,代码行数:25,代码来源:runningservice.go

示例9: GetService

// GetService gets a service.
func (this *ControlPlaneDao) GetService(id string, myService *service.Service) error {
	svc, err := this.facade.GetService(datastore.Get(), id)
	if svc != nil {
		*myService = *svc
	}
	return err
}
开发者ID:eval01-tts,项目名称:serviced,代码行数:8,代码来源:service.go

示例10: GetRunningServicesForService

func (this *ControlPlaneDao) GetRunningServicesForService(serviceID string, services *[]dao.RunningService) error {
	// we initialize the data container to something here in case it has not been initialized yet
	*services = make([]dao.RunningService, 0)

	poolID, err := this.facade.GetPoolForService(datastore.Get(), serviceID)
	if err != nil {
		glog.Errorf("Unable to get service %v: %v", serviceID, err)
		return err
	}

	poolBasedConn, err := zzk.GetLocalConnection(zzk.GeneratePoolPath(poolID))
	if err != nil {
		glog.Errorf("Error in getting a connection based on pool %v: %v", poolID, err)
		return err
	}

	svcs, err := zkservice.LoadRunningServicesByService(poolBasedConn, serviceID)
	if err != nil {
		glog.Errorf("LoadRunningServicesByService failed (conn: %+v serviceID: %v): %v", poolBasedConn, serviceID, err)
		return err
	}

	for _, svc := range svcs {
		*services = append(*services, svc)
	}

	return nil
}
开发者ID:carriercomm,项目名称:serviced,代码行数:28,代码来源:runningservice.go

示例11: initContext

func (d *daemon) initContext() (datastore.Context, error) {
	datastore.Register(d.dsDriver)
	ctx := datastore.Get()
	if ctx == nil {
		return nil, errors.New("context not available")
	}
	return ctx, nil
}
开发者ID:carriercomm,项目名称:serviced,代码行数:8,代码来源:daemon.go

示例12: GetServiceEndpoints

// Get a service endpoint.
func (this *ControlPlaneDao) GetServiceEndpoints(serviceID string, response *map[string][]dao.ApplicationEndpoint) (err error) {
	if result, err := this.facade.GetServiceEndpoints(datastore.Get(), serviceID); err == nil {
		*response = result
		return nil
	} else {
		return err
	}
}
开发者ID:eval01-tts,项目名称:serviced,代码行数:9,代码来源:service.go

示例13: GetTenantId

// The tenant id is the root service uuid. Walk the service tree to root to find the tenant id.
func (this *ControlPlaneDao) GetTenantId(serviceID string, tenantId *string) error {
	if tid, err := this.facade.GetTenantID(datastore.Get(), serviceID); err == nil {
		*tenantId = tid
		return nil
	} else {
		return err
	}
}
开发者ID:eval01-tts,项目名称:serviced,代码行数:9,代码来源:service.go

示例14: GetTaggedServices

// Get tagged services (can also filter by name and/or tenantID)
func (this *ControlPlaneDao) GetTaggedServices(request dao.ServiceRequest, services *[]service.Service) error {
	if svcs, err := this.facade.GetTaggedServices(datastore.Get(), request); err == nil {
		*services = svcs
		return nil
	} else {
		return err
	}
}
开发者ID:eval01-tts,项目名称:serviced,代码行数:9,代码来源:service.go

示例15: getService

//getService is an internal method that returns a Service without filling in all related service data like address assignments
//and modified config files
func (f *Facade) getService(ctx datastore.Context, id string) (service.Service, error) {
	glog.V(3).Infof("Facade.getService: id=%s", id)
	store := f.serviceStore
	svc, err := store.Get(datastore.Get(), id)
	if err != nil || svc == nil {
		return service.Service{}, err
	}
	return *svc, err
}
开发者ID:carriercomm,项目名称:serviced,代码行数:11,代码来源:service.go


注:本文中的github.com/control-center/serviced/datastore.Get函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。