2015-06-17 07:12:20 +00:00
|
|
|
/* -------------------------------------------------------------------
|
|
|
|
**
|
2015-06-19 03:28:31 +00:00
|
|
|
** machi.proto: Protocol Buffers definition for Machi
|
2015-06-17 07:12:20 +00:00
|
|
|
**
|
2015-06-19 03:28:31 +00:00
|
|
|
** Copyright (c) 2014-2015 Basho Technologies, Inc. All Rights Reserved.
|
2015-06-17 07:12:20 +00:00
|
|
|
**
|
|
|
|
** This file is provided 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.
|
|
|
|
**
|
|
|
|
** -------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
** Revision: 0.1
|
|
|
|
*/
|
|
|
|
|
|
|
|
// Java package specifiers
|
|
|
|
option java_package = "com.basho.machi.protobuf";
|
|
|
|
option java_outer_classname = "MachiPB";
|
|
|
|
|
2015-06-19 03:28:31 +00:00
|
|
|
//////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// enums
|
|
|
|
//
|
|
|
|
//////////////////////////////////////////
|
2015-06-17 07:12:20 +00:00
|
|
|
|
2015-06-19 04:00:28 +00:00
|
|
|
enum Mpb_GeneralStatusCode {
|
2015-06-19 03:28:31 +00:00
|
|
|
OK = 0;
|
|
|
|
BAD_ARG = 1;
|
|
|
|
WEDGED = 2;
|
|
|
|
BAD_CHECKSUM = 3;
|
2015-06-17 07:12:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Must match with machi.hrl's values!
|
2015-06-19 04:00:28 +00:00
|
|
|
enum Mpb_CSumType {
|
2015-06-17 07:12:20 +00:00
|
|
|
CSUM_TAG_NONE = 0;
|
|
|
|
CSUM_TAG_CLIENT_GEN = 1;
|
|
|
|
CSUM_TAG_SERVER_GEN = 2;
|
|
|
|
CSUM_TAG_SERVER_REGEN = 3;
|
|
|
|
}
|
|
|
|
|
2015-06-19 03:28:31 +00:00
|
|
|
//////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// basic data types
|
|
|
|
//
|
|
|
|
//////////////////////////////////////////
|
|
|
|
|
2015-06-17 07:12:20 +00:00
|
|
|
// chunk_pos() type
|
2015-06-19 04:00:28 +00:00
|
|
|
message Mpb_ChunkPos {
|
2015-06-18 08:31:48 +00:00
|
|
|
required uint64 offset = 1;
|
|
|
|
required uint64 chunk_size = 2;
|
|
|
|
required string file_name = 3;
|
2015-06-17 07:12:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// chunk_csum() type
|
2015-06-19 04:00:28 +00:00
|
|
|
message Mpb_ChunkCSum {
|
|
|
|
required Mpb_CSumType type = 1;
|
2015-06-17 07:12:20 +00:00
|
|
|
required bytes csum = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
// epoch_id() type
|
2015-06-19 04:00:28 +00:00
|
|
|
message Mpb_EpochId {
|
2015-06-17 07:12:20 +00:00
|
|
|
required uint32 epoch_num = 1;
|
2015-06-19 04:00:28 +00:00
|
|
|
required Mpb_ChunkCSum epoch_csum = 2;
|
2015-06-18 07:16:23 +00:00
|
|
|
}
|
|
|
|
|
2015-06-19 03:28:31 +00:00
|
|
|
//////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// requests & responses
|
|
|
|
//
|
|
|
|
//////////////////////////////////////////
|
|
|
|
|
2015-06-19 04:00:28 +00:00
|
|
|
// Error response - may be generated for any Req
|
|
|
|
message Mpb_ErrorResp {
|
|
|
|
// Free-form (depends on server, which is probably a bad idea TODO)
|
|
|
|
required int32 code = 1;
|
|
|
|
required string msg = 2;
|
|
|
|
optional bytes extra = 3;
|
|
|
|
}
|
|
|
|
|
2015-06-19 03:28:31 +00:00
|
|
|
// ping() request & response
|
2015-06-18 08:31:48 +00:00
|
|
|
|
2015-06-19 04:00:28 +00:00
|
|
|
message Mpb_EchoReq {
|
2015-06-18 08:31:48 +00:00
|
|
|
optional string message = 1;
|
|
|
|
}
|
|
|
|
|
2015-06-19 04:00:28 +00:00
|
|
|
message Mpb_EchoResp {
|
2015-06-18 08:31:48 +00:00
|
|
|
optional string message = 1;
|
|
|
|
}
|
|
|
|
|
2015-06-19 03:28:31 +00:00
|
|
|
// Authentication request & response
|
|
|
|
|
2015-06-19 04:00:28 +00:00
|
|
|
message Mpb_AuthReq {
|
2015-06-19 03:28:31 +00:00
|
|
|
required bytes user = 1;
|
|
|
|
required bytes password = 2;
|
|
|
|
}
|
|
|
|
|
2015-06-19 04:00:28 +00:00
|
|
|
message Mpb_AuthResp {
|
2015-06-19 03:28:31 +00:00
|
|
|
required uint32 code = 1;
|
|
|
|
// TODO: not implemented yet
|
|
|
|
}
|
|
|
|
|
|
|
|
// append_chunk() request & response
|
|
|
|
|
2015-06-19 04:00:28 +00:00
|
|
|
message Mpb_AppendChunkReq {
|
2015-06-18 07:16:23 +00:00
|
|
|
required string prefix = 1;
|
2015-06-17 07:12:20 +00:00
|
|
|
optional bytes placement_key = 2;
|
|
|
|
required bytes chunk = 3;
|
|
|
|
optional uint32 chunk_extra = 4;
|
|
|
|
}
|
|
|
|
|
2015-06-19 04:00:28 +00:00
|
|
|
message Mpb_AppendChunkResp {
|
|
|
|
required Mpb_GeneralStatusCode status = 1;
|
|
|
|
optional Mpb_ChunkPos chunk_pos = 2;
|
2015-06-17 07:12:20 +00:00
|
|
|
optional MbpGeneralError = 3;
|
|
|
|
}
|
|
|
|
|
2015-06-19 03:28:31 +00:00
|
|
|
//////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// request & response wrapper
|
|
|
|
//
|
|
|
|
//////////////////////////////////////////
|
|
|
|
|
2015-06-19 04:00:28 +00:00
|
|
|
message Mpb_Request {
|
2015-06-19 03:28:31 +00:00
|
|
|
// TODO: If we wish to support pipelined requests sometime in the
|
|
|
|
// future, this is the placeholder to do it.
|
|
|
|
required bytes req_id = 1;
|
|
|
|
|
|
|
|
// The client should only define one request message. If the client
|
|
|
|
// includes multiple requests here, the server may pick/choose an
|
|
|
|
// arbitrary one.
|
|
|
|
// NOTE: The erlang protobuffs compiler doesn't support 'oneof'.
|
|
|
|
// But 'oneof' appears to be a very tiny memory optimization
|
|
|
|
// that not all languages might care about? (Erlang doesn't)
|
2015-06-19 04:00:28 +00:00
|
|
|
optional Mpb_EchoReq echo = 10;
|
|
|
|
optional Mpb_AuthReq auth = 11;
|
|
|
|
optional Mpb_AppendChunkReq append_chunk = 12;
|
2015-06-17 07:12:20 +00:00
|
|
|
}
|
2015-06-18 07:16:23 +00:00
|
|
|
|
2015-06-19 04:00:28 +00:00
|
|
|
message Mpb_Response {
|
2015-06-19 03:28:31 +00:00
|
|
|
// TODO: If we wish to support pipelined requests sometime in the
|
|
|
|
// future, this is the placeholder to do it.
|
|
|
|
required bytes req_id = 1;
|
|
|
|
|
|
|
|
// The server will define only one of the optional responses below.
|
2015-06-18 07:16:23 +00:00
|
|
|
|
2015-06-19 03:28:31 +00:00
|
|
|
// Generic error response, typically used when something quite
|
|
|
|
// bad/unexpected happened within the server.
|
|
|
|
// Clients should always check this response and, if defined,
|
|
|
|
// ignroe any request-specific response at codes 10+.
|
2015-06-19 04:00:28 +00:00
|
|
|
optional Mpb_ErrorResp generic = 2;
|
2015-06-19 03:28:31 +00:00
|
|
|
|
|
|
|
// Specific responses.
|
2015-06-19 04:00:28 +00:00
|
|
|
optional Mpb_EchoResp echo = 10;
|
|
|
|
optional Mpb_AuthResp auth = 11;
|
|
|
|
optional Mpb_AppendChunkResp append_chunk = 12;
|
2015-06-19 03:28:31 +00:00
|
|
|
}
|