Esempio n. 1
0
func (f *framer) Frame(r io.Reader) (proto.Frame, error) {
	frame := &frame{
		versionDir: f.direction | proto.VersionDir(Version),
	}

	if err := readFrame(r, frame); err != nil {
		return nil, err
	}

	return frame, nil
}
Esempio n. 2
0
func ReadyResponse(request proto.Frame) proto.Frame {
	hdr := header{
		Opcode:   proto.OpReady,
		StreamID: request.StreamID(),
		Length:   0,
	}

	return &frame{
		versionDir: proto.VersionDir(Version) | response,
		header:     hdr,
		body:       make([]byte, 0),
	}
}
Esempio n. 3
0
func ResultVoidResponse(request proto.Frame) proto.Frame {
	buf := new(bytes.Buffer)
	proto.WriteBinary(buf, ResultVoid)

	hdr := header{
		Opcode:   proto.OpResult,
		StreamID: request.StreamID(),
		Length:   uint32(buf.Len()),
	}

	return &frame{
		versionDir: proto.VersionDir(Version) | response,
		header:     hdr,
		body:       buf.Bytes(),
	}
}