• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang store.SliceStore类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: FilterNodes

func FilterNodes(reader store.Seeker, nodes ...string) store.Seeker {
	nodesStore := store.SliceStore{}
	nodesStore.BeginWriting()
	for _, node := range nodes {
		nodesStore.WriteRecord(&store.Record{
			Key: lex.EncodeOrDie(node),
		})
	}
	nodesStore.EndWriting()
	return store.NewPrefixIncludingReader(reader, &nodesStore)
}
开发者ID:sburnett,项目名称:bismark-passive-server-go,代码行数:11,代码来源:filtertraces.go


示例2: ReadOnlySomeLogs

func ReadOnlySomeLogs(stor store.Seeker, logTypes ...string) store.Seeker {
	prefixStore := store.SliceStore{}
	prefixStore.BeginWriting()
	for _, logType := range logTypes {
		record := store.Record{
			Key: lex.EncodeOrDie(logType),
		}
		prefixStore.WriteRecord(&record)
	}
	prefixStore.EndWriting()
	return store.NewPrefixIncludingReader(stor, &prefixStore)
}
开发者ID:sburnett,项目名称:bismark-tools,代码行数:12,代码来源:common.go


示例3: ExampleIncludeNodes_multipleNodes

func ExampleIncludeNodes_multipleNodes() {
	inputRecords := store.SliceStore{}
	inputRecords.BeginWriting()
	inputRecords.WriteRecord(makeRecordToInclude("node1", 1))
	inputRecords.WriteRecord(makeRecordToInclude("node1", 2))
	inputRecords.WriteRecord(makeRecordToInclude("node2", 3))
	inputRecords.WriteRecord(makeRecordToInclude("node2", 4))
	inputRecords.WriteRecord(makeRecordToInclude("node2", 5))
	inputRecords.WriteRecord(makeRecordToInclude("node3", 6))
	inputRecords.WriteRecord(makeRecordToInclude("node3", 7))
	inputRecords.WriteRecord(makeRecordToInclude("node4", 8))
	inputRecords.WriteRecord(makeRecordToInclude("node4", 9))
	inputRecords.WriteRecord(makeRecordToInclude("node5", 10))
	inputRecords.WriteRecord(makeRecordToInclude("node6", 11))
	inputRecords.WriteRecord(makeRecordToInclude("node7", 12))
	inputRecords.EndWriting()

	outputRecords := FilterNodes(&inputRecords, "node2", "node4", "node5", "node7")
	runIncludeNodes(outputRecords)

	// Output:
	// node2 3
	// node2 4
	// node2 5
	// node4 8
	// node4 9
	// node5 10
	// node7 12
}
开发者ID:sburnett,项目名称:bismark-passive-server-go,代码行数:29,代码来源:filtertraces_test.go


示例4: ExampleIncludeNodes

func ExampleIncludeNodes() {
	inputRecords := store.SliceStore{}
	inputRecords.BeginWriting()
	inputRecords.WriteRecord(makeRecordToInclude("node1", 1))
	inputRecords.WriteRecord(makeRecordToInclude("node1", 2))
	inputRecords.WriteRecord(makeRecordToInclude("node2", 3))
	inputRecords.WriteRecord(makeRecordToInclude("node2", 4))
	inputRecords.WriteRecord(makeRecordToInclude("node2", 5))
	inputRecords.WriteRecord(makeRecordToInclude("node3", 6))
	inputRecords.EndWriting()

	outputRecords := FilterNodes(&inputRecords, "node2")
	runIncludeNodes(outputRecords)

	// Output:
	// node2 3
	// node2 4
	// node2 5
}
开发者ID:sburnett,项目名称:bismark-passive-server-go,代码行数:19,代码来源:filtertraces_test.go


示例5: runCalculateTraceKeyRanges

func runCalculateTraceKeyRanges(records []*store.Record) {
	traces := store.SliceStore{}
	traces.BeginWriting()
	for _, record := range records {
		traces.WriteRecord(record)
	}
	traces.EndWriting()

	rangesStore := store.SliceStore{}
	consolidatedStore := store.SliceStore{}
	transformer.RunPipeline(TraceKeyRangesPipeline(&traces, &rangesStore, &consolidatedStore))

	rangesStore.BeginReading()
	for {
		record, err := rangesStore.ReadRecord()
		if err != nil {
			panic(err)
		}
		if record == nil {
			break
		}
		fmt.Printf("%s %s\n", formatTraceKey(record.Key), formatTraceKey(record.Value))
	}
	rangesStore.EndReading()
}
开发者ID:sburnett,项目名称:bismark-passive-server-go,代码行数:25,代码来源:transformers_test.go


示例6: runSessions

func runSessions(records []*store.Record) {
	traces := store.SliceStore{}
	traces.BeginWriting()
	for _, record := range records {
		traces.WriteRecord(record)
	}
	traces.EndWriting()

	sessionsStore := store.SliceStore{}
	transformer.RunPipeline([]transformer.PipelineStage{
		SessionPipelineStage(&traces, &sessionsStore),
	})

	sessionsStore.BeginReading()
	for {
		record, err := sessionsStore.ReadRecord()
		if err != nil {
			panic(err)
		}
		if record == nil {
			break
		}
		fmt.Printf("%s\n", formatSessionKey(record.Key))
	}
	sessionsStore.EndReading()
}
开发者ID:sburnett,项目名称:bismark-passive-server-go,代码行数:26,代码来源:transformers_test.go


示例7: ExampleJoin_inner

func ExampleJoin_inner() {
	left := store.SliceStore{}
	left.BeginWriting()
	left.WriteRecord(store.NewRecord("1", "news", 0))
	left.WriteRecord(store.NewRecord("2", "book", 0))
	left.EndWriting()

	right := store.SliceStore{}
	right.BeginWriting()
	right.WriteRecord(store.NewRecord("1", "paper", 0))
	right.WriteRecord(store.NewRecord("3", "brush", 0))
	right.EndWriting()

	output := store.SliceStore{}

	joiner := Join(nil, nil)
	transformer.RunTransformer(transformer.MakeGroupDoFunc(joiner), store.NewDemuxingReader(&left, &right), &output)

	output.BeginReading()
	for {
		record, err := output.ReadRecord()
		if err != nil {
			panic(err)
		}
		if record == nil {
			break
		}
		fmt.Printf("%s: %s\n", record.Key, record.Value)
	}
	output.EndReading()

	// Output:
	//
	// 1: newspaper
}
开发者ID:sburnett,项目名称:transformer,代码行数:35,代码来源:join_test.go


示例8: ExampleJoin_multiple

func ExampleJoin_multiple() {
	left := store.SliceStore{}
	left.BeginWriting()
	left.WriteRecord(store.NewRecord("1", "what", 0))
	left.WriteRecord(store.NewRecord("2", "news", 0))
	left.EndWriting()

	middle := store.SliceStore{}
	middle.BeginWriting()
	middle.WriteRecord(store.NewRecord("1", "so", 0))
	middle.WriteRecord(store.NewRecord("3", "the", 0))
	middle.EndWriting()

	right := store.SliceStore{}
	right.BeginWriting()
	right.WriteRecord(store.NewRecord("1", "ever", 0))
	right.WriteRecord(store.NewRecord("3", "less", 0))
	right.EndWriting()

	output := store.SliceStore{}

	joiner := Join([]byte("never"), []byte("paper"), []byte("man"))
	transformer.RunTransformer(transformer.MakeGroupDoFunc(joiner), store.NewDemuxingReader(&left, &middle, &right), &output)

	output.BeginReading()
	for {
		record, err := output.ReadRecord()
		if err != nil {
			panic(err)
		}
		if record == nil {
			break
		}
		fmt.Printf("%s: %s\n", record.Key, record.Value)
	}
	output.EndReading()

	// Output:
	//
	// 1: whatsoever
	// 2: newspaperman
	// 3: nevertheless
}
开发者ID:sburnett,项目名称:transformer,代码行数:43,代码来源:join_test.go



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang cache.NewFileStore函数代码示例发布时间:2022-05-28
下一篇:
Golang store.Manager类代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap