// Copyright 2013 <chaishushan{AT}gmail.com>. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

syntax = "proto3";

//
//	protorpc wire format wrapper
//
//	0. Frame Format
//	len : uvarint64
//	data: byte[len]
//
//	1. Client Send Request
//	Send RequestHeader: sendFrame(zsock, hdr, len(hdr))
//	Send Request: sendFrame(zsock, body, hdr.snappy_compressed_request_len)
//
//	2. Server Recv Request
//	Recv RequestHeader: recvFrame(zsock, hdr, max_hdr_len, 0)
//	Recv Request: recvFrame(zsock, body, hdr.snappy_compressed_request_len, 0)
//
//	3. Server Send Response
//	Send ResponseHeader: sendFrame(zsock, hdr, len(hdr))
//	Send Response: sendFrame(zsock, body, hdr.snappy_compressed_response_len)
//
//	4. Client Recv Response
//	Recv ResponseHeader: recvFrame(zsock, hdr, max_hdr_len, 0)
//	Recv Response: recvFrame(zsock, body, hdr.snappy_compressed_response_len, 0)
//
package protorpc_wire;

enum Const {
	ZERO = 0;
	MAX_REQUEST_HEADER_LEN = 1024;
}

message RequestHeader {
	uint64 id = 1;
	string method = 2;

	uint32 raw_request_len = 3;
	uint32 snappy_compressed_request_len = 4;
	uint32 checksum = 5;
}

message ResponseHeader {
	uint64 id = 1;
	string error = 2;

	uint32 raw_response_len = 3;
	uint32 snappy_compressed_response_len = 4;
	uint32 checksum = 5;
}
