本文整理汇总了Golang中github.com/control-center/serviced/datastore.Get函数的典型用法代码示例。如果您正苦于以下问题:Golang Get函数的具体用法?Golang Get怎么用?Golang Get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Get函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: GetUser
func (this *ControlPlaneDao) GetUser(userName string, user *userdomain.User) error {
glog.V(2).Infof("ControlPlaneDao.GetUser: userName=%s", userName)
store := userdomain.NewStore()
err := store.Get(datastore.Get(), userdomain.Key(userName), user)
glog.V(2).Infof("ControlPlaneDao.GetUser: userName=%s, user=%+v, err=%s", userName, user, err)
if user == nil {
*user = userdomain.User{}
}
return err
}
开发者ID:eval01-tts,项目名称:serviced,代码行数:10,代码来源:user.go
示例17: FindChildService
func (this *ControlPlaneDao) FindChildService(request dao.FindChildRequest, service *service.Service) error {
svc, err := this.facade.FindChildService(datastore.Get(), request.ServiceID, request.ChildName)
if err != nil {
return err
}
if svc != nil {
*service = *svc
} else {
glog.Warningf("unable to find child of service: %+v", service)
}
return nil
}
开发者ID:eval01-tts,项目名称:serviced,代码行数:13,代码来源:service.go
示例18: AddUser
//addUser places a new user record into elastic searchp
func (this *ControlPlaneDao) AddUser(newUser userdomain.User, userName *string) error {
glog.V(2).Infof("ControlPlane.NewUser: %+v", newUser)
name := strings.TrimSpace(*userName)
newUser.Password = hashPassword(newUser.Password)
// save the user
var existing userdomain.User
if err := this.GetUser(name, &existing); err != nil && !datastore.IsErrNoSuchEntity(err) {
return err
}
store := userdomain.NewStore()
return store.Put(datastore.Get(), userdomain.Key(name), &newUser)
}
开发者ID:eval01-tts,项目名称:serviced,代码行数:14,代码来源:user.go
示例19: desynchronize
func (dfs *DistributedFilesystem) desynchronize(image *docker.Image) error {
// inspect the image
dImg, err := image.Inspect()
if err != nil {
glog.Errorf("Could not inspect image %s (%s): %s", image.ID, image.UUID, err)
return err
}
// look up services for that tenant
svcs, err := dfs.facade.GetServices(datastore.Get(), dao.ServiceRequest{TenantID: image.ID.User})
if err != nil {
glog.Errorf("Could not get services for tenant %s from %s (%s): %s", image.ID.User, image.ID, image.UUID, err)
return err
}
for _, svc := range svcs {
// figure out which services are using the provided image
svcImageID, err := commons.ParseImageID(svc.ImageID)
if err != nil {
glog.Warningf("Could not parse image %s for %s (%s): %s", svc.ImageID, svc.Name, svc.ID)
continue
} else if !svcImageID.Equals(image.ID) {
continue
}
// TODO: we need to switch to using dao.ControlPlane
conn, err := zzk.GetLocalConnection(zzk.GeneratePoolPath(svc.PoolID))
if err != nil {
glog.Warningf("Could not acquire connection to the coordinator (%s): %s", svc.PoolID, err)
continue
}
states, err := zkservice.GetServiceStates(conn, svc.ID)
if err != nil {
glog.Warningf("Could not get running services for %s (%s): %s", svc.Name, svc.ID)
continue
}
for _, state := range states {
// check if the instance has been running since before the commit
if state.IsRunning() && state.Started.Before(dImg.Created) {
state.InSync = false
if err := zkservice.UpdateServiceState(conn, &state); err != nil {
glog.Warningf("Could not update service state %s for %s (%s) as out of sync: %s", state.ID, svc.Name, svc.ID, err)
continue
}
}
}
}
return nil
}
开发者ID:eval01-tts,项目名称:serviced,代码行数:51,代码来源:docker.go
示例20: ResetRegistry
// ResetRegistry will update the host:port of the docker registry
func (dfs *DistributedFilesystem) ResetRegistry() error {
// get all the services in the system
svcs, err := dfs.facade.GetServices(datastore.Get(), dao.ServiceRequest{})
if err != nil {
glog.Errorf("Could not get services for updating the registry")
return err
}
imagemap := make(map[string]struct{})
for _, svc := range svcs {
imageID, err := commons.ParseImageID(svc.ImageID)
if err != nil {
glog.Errorf("Could not parse image ID (%s) for service %s (%s): %s", svc.ImageID, svc.Name, svc.ID, err)
return err
}
if imageID.Host == dfs.dockerHost && imageID.Port == dfs.dockerPort {
continue
}
if _, ok := imagemap[imageID.BaseName()]; !ok {
if err := dfs.registerImages(imageID.BaseName()); err != nil {
glog.Errorf("Could not reregister image %s: %s", imageID.BaseName(), err)
return err
}
imagemap[imageID.BaseName()] = struct{}{}
}
imageID.Host, imageID.Port = dfs.dockerHost, dfs.dockerPort
svc.ImageID = imageID.String()
if err := dfs.facade.UpdateService(datastore.Get(), svc); err != nil {
glog.Errorf("Could not update service %s (%s) with image %s", svc.Name, svc.ID, svc.ImageID)
return err
}
}
return nil
}
开发者ID:eval01-tts,项目名称:serviced,代码行数:39,代码来源:docker.go
注:本文中的github.com/control-center/serviced/datastore.Get函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论