コード例 #1
0
ファイル: main.go プロジェクト: jmptrader/talaria
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
ファイル: kvstore_test.go プロジェクト: jmptrader/talaria
	. "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())
		}
	})