本文整理汇总了Golang中appengine_internal.ProtoMessage类的典型用法代码示例。如果您正苦于以下问题:Golang ProtoMessage类的具体用法?Golang ProtoMessage怎么用?Golang ProtoMessage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ProtoMessage类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Call
func (c Context) Call(service, method string, in, out appengine_internal.ProtoMessage, opts *appengine_internal.CallOptions) error {
c.Stats.wg.Add(1)
defer c.Stats.wg.Done()
if service == "__go__" {
return c.Context.Call(service, method, in, out, opts)
}
stat := RPCStat{
Service: service,
Method: method,
Start: time.Now(),
Offset: time.Since(c.Stats.Start),
StackData: string(debug.Stack()),
}
err := c.Context.Call(service, method, in, out, opts)
stat.Duration = time.Since(stat.Start)
stat.In = in.String()
stat.Out = out.String()
stat.Cost = GetCost(out)
if len(stat.In) > ProtoMaxBytes {
stat.In = stat.In[:ProtoMaxBytes] + "..."
}
if len(stat.Out) > ProtoMaxBytes {
stat.Out = stat.Out[:ProtoMaxBytes] + "..."
}
c.Stats.lock.Lock()
c.Stats.RPCStats = append(c.Stats.RPCStats, stat)
c.Stats.Cost += stat.Cost
c.Stats.lock.Unlock()
return err
}
示例2: Call
func (c Context) Call(service, method string, in, out appengine_internal.ProtoMessage, opts *appengine_internal.CallOptions) (err error) {
if c.Timer != nil && service != "__go__" {
c.StepCustomTiming(service, method, fmt.Sprintf("%v\n\n%v", method, in.String()), func() {
err = c.Context.Call(service, method, in, out, opts)
})
} else {
err = c.Context.Call(service, method, in, out, opts)
}
return
}
示例3: namespaceMod
func namespaceMod(m appengine_internal.ProtoMessage, namespace string) {
// pb.Query is the only type that has a name_space field.
// All other namespace support in datastore is in the keys.
switch m := m.(type) {
case *pb.Query:
if m.NameSpace == nil {
m.NameSpace = &namespace
}
}
}
示例4: namespaceMod
func namespaceMod(m appengine_internal.ProtoMessage, namespace string) {
switch m := m.(type) {
case *pb.MemcacheDeleteRequest:
if m.NameSpace == nil {
m.NameSpace = &namespace
}
case *pb.MemcacheGetRequest:
if m.NameSpace == nil {
m.NameSpace = &namespace
}
case *pb.MemcacheIncrementRequest:
if m.NameSpace == nil {
m.NameSpace = &namespace
}
case *pb.MemcacheSetRequest:
if m.NameSpace == nil {
m.NameSpace = &namespace
}
// MemcacheFlushRequest, MemcacheStatsRequest do not apply namespace.
}
}