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


Golang bbs.Client类代码示例

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


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

示例1: subscribeToEvents

func subscribeToEvents(logger lager.Logger, bbsClient bbs.Client, subscriptionChan chan<- events.EventSource) {
	logger.Info("subscribing-to-events")
	eventSource, err := bbsClient.SubscribeToEvents()
	if err != nil {
		logger.Error("failed-subscribing-to-events", err)
		subscriptionChan <- nil
	} else {
		logger.Info("subscribed-to-events")
		subscriptionChan <- eventSource
	}
}
开发者ID:emc-xchallenge,项目名称:tps,代码行数:11,代码来源:watcher.go

示例2: getTasksByState

func getTasksByState(client bbs.Client, state models.Task_State) []*models.Task {
	tasks, err := client.Tasks()
	Expect(err).NotTo(HaveOccurred())

	filteredTasks := make([]*models.Task, 0)
	for _, task := range tasks {
		if task.State == state {
			filteredTasks = append(filteredTasks, task)
		}
	}
	return filteredTasks
}
开发者ID:emc-xchallenge,项目名称:rep,代码行数:12,代码来源:main_test.go

示例3: Fetch

func Fetch(bbsClient bbs.Client, w io.Writer) error {
	desiredLRPs, err := bbsClient.DesiredLRPs(models.DesiredLRPFilter{})
	if err != nil {
		return err
	}

	actualLRPGroups, err := bbsClient.ActualLRPGroups(models.ActualLRPFilter{})
	if err != nil {
		return err
	}

	tasks, err := bbsClient.Tasks()
	if err != nil {
		return err
	}

	domains, err := bbsClient.Domains()
	if err != nil {
		return err
	}

	dump := veritas_models.StoreDump{
		Domains: domains,
		LRPS:    veritas_models.VeritasLRPS{},
		Tasks:   veritas_models.VeritasTasks{},
	}

	for _, desired := range desiredLRPs {
		dump.LRPS.Get(desired.ProcessGuid).DesiredLRP = desired
	}

	for _, actualLRPGroup := range actualLRPGroups {
		actual, _ := actualLRPGroup.Resolve()
		lrp := dump.LRPS.Get(actual.ProcessGuid)
		index := strconv.Itoa(int(actual.Index))
		lrp.ActualLRPGroupsByIndex[index] = actualLRPGroup
	}

	for _, task := range tasks {
		dump.Tasks[task.Domain] = append(dump.Tasks[task.Domain], task)
	}

	encoder := json.NewEncoder(w)
	return encoder.Encode(dump)
}
开发者ID:mhoran,项目名称:veritas,代码行数:45,代码来源:fetch_store.go

示例4: SetDomain

func SetDomain(bbsClient bbs.Client, domain string, ttl time.Duration) error {
	say.Println(0, say.Green("Setting Domain %s with TTL %ds", domain, int(ttl.Seconds())))

	return bbsClient.UpsertDomain(domain, ttl)
}
开发者ID:mhoran,项目名称:veritas,代码行数:5,代码来源:set_domain.go

示例5:

import (
	"os"
	"path"

	"github.com/cloudfoundry-incubator/bbs"
	"github.com/cloudfoundry-incubator/bbs/cmd/bbs/testrunner"
	"github.com/tedsuo/ifrit/ginkgomon"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("Secure", func() {
	var (
		client bbs.Client
		err    error

		basePath string
	)

	BeforeEach(func() {
		basePath = path.Join(os.Getenv("GOPATH"), "src", "github.com", "cloudfoundry-incubator", "bbs", "cmd", "bbs", "fixtures")
		bbsURL.Scheme = "https"
	})

	JustBeforeEach(func() {
		client = bbs.NewClient(bbsURL.String())
		bbsRunner = testrunner.New(bbsBinPath, bbsArgs)
		bbsProcess = ginkgomon.Invoke(bbsRunner)
	})

	AfterEach(func() {
开发者ID:emc-xchallenge,项目名称:bbs,代码行数:32,代码来源:secure_test.go

示例6:

		exitDuration                = 4 * time.Second
		convergeRepeatInterval      = 500 * time.Millisecond
		taskKickInterval            = convergeRepeatInterval
		expireCompletedTaskDuration = 3 * convergeRepeatInterval
		expirePendingTaskDuration   = 30 * time.Minute
	)

	var (
		binPaths         BinPaths
		etcdRunner       *etcdstorerunner.ETCDClusterRunner
		bbsArgs          bbsrunner.Args
		bbsProcess       ifrit.Process
		bbsClient        bbs.Client
		convergerConfig  *convergerrunner.Config
		convergerProcess ifrit.Process
		runner           *ginkgomon.Runner

		consulRunner  *consulrunner.ClusterRunner
		consulSession *consuladapter.Session

		etcdClient storeadapter.StoreAdapter

		logger lager.Logger
	)

	SynchronizedBeforeSuite(func() []byte {
		convergerBinPath, err := Build("github.com/cloudfoundry-incubator/converger/cmd/converger", "-race")
		Expect(err).NotTo(HaveOccurred())
		bbsBinPath, err := Build("github.com/cloudfoundry-incubator/bbs/cmd/bbs", "-race")
		Expect(err).NotTo(HaveOccurred())
		bytes, err := json.Marshal(BinPaths{
开发者ID:emc-xchallenge,项目名称:converger,代码行数:31,代码来源:main_test.go


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