Пример #1
0
func run(c *cli.Context) {
	validateFlags(c)
	setLogLevel(c)

	clientAddr := fmt.Sprintf("http://localhost:%d", c.Int(port))
	kvStore := kvstore.New(clientAddr, c.Int(healthPort))
	ioProvider := broker.NewFileProvider(c.String(dataDir), uint64(c.Int(segmentLength)), uint64(c.Int(numSegments)), time.Second)
	orch := orchestrator.New(clientAddr, uint(c.Int(numReplicas)), ioProvider, kvStore)

	broker.StartBrokerServer(c.Int(port), orch, ioProvider)
}
Пример #2
0
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("Kvstore", func() {
	var (
		clientAddr    string
		kv            *kvstore.KVStore
		key           string
		keyWithPrefix string
	)

	BeforeEach(func() {
		clientAddr = "some-addr"
		kv = kvstore.New(clientAddr, 9999)
		key = "some-key"
		keyWithPrefix = fmt.Sprintf("%s-%s", kvstore.Prefix, key)
	})

	AfterEach(func() {
		_, err := consulClient.KV().DeleteTree(kvstore.Prefix, nil)
		Expect(err).ToNot(HaveOccurred())

		sessions, _, err := consulClient.Session().List(nil)
		for _, session := range sessions {
			_, err = consulClient.Session().Destroy(session.ID, nil)
			Expect(err).ToNot(HaveOccurred())
		}
	})