本文整理汇总了Golang中github.com/uber/tchannel/golang/typed.WriteBuffer类的典型用法代码示例。如果您正苦于以下问题:Golang WriteBuffer类的具体用法?Golang WriteBuffer怎么用?Golang WriteBuffer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WriteBuffer类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: write
func (s *Span) write(w *typed.WriteBuffer) error {
w.WriteUint64(s.traceID)
w.WriteUint64(s.parentID)
w.WriteUint64(s.spanID)
w.WriteSingleByte(s.flags)
return w.Err()
}
示例2: newWritableChunk
// newWritableChunk creates a new writable chunk around a checksum and a buffer to hold data
func newWritableChunk(checksum Checksum, contents *typed.WriteBuffer) *writableChunk {
return &writableChunk{
size: 0,
sizeRef: contents.DeferUint16(),
checksum: checksum,
contents: contents,
}
}
示例3: write
func (f *Frame) write(msg message) error {
var wbuf typed.WriteBuffer
wbuf.Wrap(f.Payload[:])
if err := msg.write(&wbuf); err != nil {
return err
}
f.Header.ID = msg.ID()
f.Header.messageType = msg.messageType()
f.Header.SetPayloadSize(uint16(wbuf.BytesWritten()))
return nil
}
示例4: WriteOut
// WriteOut writes the frame to the given io.Writer
func (f *Frame) WriteOut(w io.Writer) error {
var wbuf typed.WriteBuffer
wbuf.Wrap(f.headerBuffer)
if err := f.Header.write(&wbuf); err != nil {
return err
}
fullFrame := f.buffer[:f.Header.FrameSize()]
if _, err := w.Write(fullFrame); err != nil {
return err
}
return nil
}
示例5: write
func (m *initMessage) write(w *typed.WriteBuffer) error {
w.WriteUint16(m.Version)
w.WriteUint16(uint16(len(m.initParams)))
for k, v := range m.initParams {
w.WriteLen16String(k)
w.WriteLen16String(v)
}
return w.Err()
}
示例6: write
func (m *errorMessage) write(w *typed.WriteBuffer) error {
w.WriteSingleByte(byte(m.errCode))
m.tracing.write(w)
w.WriteLen16String(m.message)
return w.Err()
}