// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements.  See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership.  The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License.  You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied.  See the License for the
// specific language governing permissions and limitations
// under the License.

syntax="proto2";

package brpc.policy;

option cc_generic_services = true;
option java_generic_services = true;
option java_package="com.brpc.policy";
option java_outer_classname="MongoProto";

enum MongoOp {
    OPREPLY = 1;
    DBMSG = 1000;
    DB_UPDATE = 2001;
    DB_INSERT = 2002;
    DB_QUERY = 2004;
    DB_GETMORE = 2005;
    DB_DELETE = 2006;
    DB_KILLCURSORS = 2007;
    DB_COMMAND = 2008;
    DB_COMMANDREPLY = 2009;
}

message MongoHeader {
    required int32 message_length = 1;
    required int32 request_id = 2;
    required int32 response_to = 3;
    required MongoOp op_code = 4;
}

message MongoRequest {
    required MongoHeader header = 1;
    required string message = 2;
}

message MongoResponse {
    required MongoHeader header = 1;
    required int32 response_flags = 2;
    required int64 cursor_id = 3;
    required int32 starting_from = 4;
    required int32 number_returned = 5;
    required string message = 6;
}

service MongoService {
    rpc default_method(MongoRequest) returns (MongoResponse);
}
