本文整理汇总了Golang中github.com/uber/tchannel-go/typed.WriteBuffer类的典型用法代码示例。如果您正苦于以下问题:Golang WriteBuffer类的具体用法?Golang WriteBuffer怎么用?Golang WriteBuffer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WriteBuffer类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: write
func (s *Span) write(w *typed.WriteBuffer) error {
w.WriteUint64(s.spanID)
w.WriteUint64(s.parentID)
w.WriteUint64(s.traceID)
w.WriteSingleByte(s.flags)
return w.Err()
}
开发者ID:uber,项目名称:tchannel-go,代码行数:7,代码来源:tracing.go
示例2: writeHeaders
func writeHeaders(w *typed.WriteBuffer, headers map[string]string) {
w.WriteSingleByte(byte(len(headers))) // number of headers
for k, v := range headers {
w.WriteLen8String(k)
w.WriteLen8String(v)
}
}
开发者ID:uber,项目名称:tchannel-go,代码行数:7,代码来源:relay_messages_test.go
示例3: 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,
}
}
开发者ID:dansimau,项目名称:ringpop-go,代码行数:9,代码来源:fragmenting_writer.go
示例4: writeHeaders
func writeHeaders(wb *typed.WriteBuffer, form http.Header) {
numHeadersDeferred := wb.DeferUint16()
numHeaders := uint16(0)
for k, values := range form {
for _, v := range values {
wb.WriteLen16String(k)
wb.WriteLen16String(v)
numHeaders++
}
}
numHeadersDeferred.Update(numHeaders)
}
开发者ID:gosuper,项目名称:tchannel-go,代码行数:12,代码来源:buf.go
示例5: 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
}
开发者ID:dansimau,项目名称:ringpop-go,代码行数:12,代码来源:frame.go
示例6: 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
}
开发者ID:gosuper,项目名称:tchannel-go,代码行数:16,代码来源:frame.go
示例7: 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()
}
开发者ID:gosuper,项目名称:tchannel-go,代码行数:11,代码来源:messages.go
示例8: write
func (fh *FrameHeader) write(w *typed.WriteBuffer) error {
w.WriteUint16(fh.size)
w.WriteSingleByte(byte(fh.messageType))
w.WriteSingleByte(fh.reserved1)
w.WriteUint32(fh.ID)
w.WriteBytes(fh.reserved[:])
return w.Err()
}
开发者ID:gosuper,项目名称:tchannel-go,代码行数:8,代码来源:frame.go
示例9: writeVarintString
func writeVarintString(wb *typed.WriteBuffer, s string) {
wb.WriteUvarint(uint64(len(s)))
wb.WriteString(s)
}
开发者ID:gosuper,项目名称:tchannel-go,代码行数:4,代码来源:buf.go
注:本文中的github.com/uber/tchannel-go/typed.WriteBuffer类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论