本文整理汇总了Golang中kythe/io/kythe/go/storage/table.KVProto.Put方法的典型用法代码示例。如果您正苦于以下问题:Golang KVProto.Put方法的具体用法?Golang KVProto.Put怎么用?Golang KVProto.Put使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kythe/io/kythe/go/storage/table.KVProto
的用法示例。
在下文中一共展示了KVProto.Put方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: writeWithReverses
func writeWithReverses(ctx context.Context, tbl *table.KVProto, src, kind string, targets []string) error {
if err := tbl.Put(ctx, []byte(src+tempTableKeySep+kind+tempTableKeySep), &srvpb.EdgeSet_Group{
Kind: kind,
TargetTicket: targets,
}); err != nil {
return fmt.Errorf("error writing edges group: %v", err)
}
revGroup := &srvpb.EdgeSet_Group{
Kind: schema.MirrorEdge(kind),
TargetTicket: []string{src},
}
for _, tgt := range targets {
if err := tbl.Put(ctx, []byte(tgt+tempTableKeySep+revGroup.Kind+tempTableKeySep+src), revGroup); err != nil {
return fmt.Errorf("error writing rev edges group: %v", err)
}
}
return nil
}
示例2: createDecorationFragments
func createDecorationFragments(ctx context.Context, edges <-chan *srvpb.Edge, fragments *table.KVProto) error {
fdb := &assemble.DecorationFragmentBuilder{
Output: func(ctx context.Context, file string, fragment *srvpb.FileDecorations) error {
key := file + tempTableKeySep
if len(fragment.Decoration) != 0 {
key += fragment.Decoration[0].Anchor.Ticket
}
return fragments.Put(ctx, []byte(key), fragment)
},
}
for e := range edges {
if err := fdb.AddEdge(ctx, e); err != nil {
for range edges { // drain input channel
}
return err
}
}
return fdb.Flush(ctx)
}
示例3: writeEdge
func writeEdge(ctx context.Context, edges *table.KVProto, e *srvpb.Edge) error {
return edges.Put(ctx, []byte(e.Source.Ticket+tempTableKeySep+e.Kind+tempTableKeySep+e.Target.Ticket), e)
}