syntax = "proto3";

package models;

import "github.com/gogo/protobuf/gogoproto/gogo.proto";
import "torus.proto";

option (gogoproto.equal_all) = true;
option (gogoproto.verbose_equal_all) = true;


option (gogoproto.unmarshaler_all) = true;
option (gogoproto.marshaler_all) = true;
option (gogoproto.sizer_all) = true;
option (gogoproto.testgen_all) = true;
option (gogoproto.benchgen_all) = true;
option (gogoproto.populate_all) = true;

service TorusStorage {
	rpc Block (BlockRequest) returns (BlockResponse);
	rpc PutBlock (PutBlockRequest) returns (PutResponse);
	rpc RebalanceCheck (RebalanceCheckRequest) returns (RebalanceCheckResponse);
}

message BlockRequest {
	BlockRef block_ref = 1;
}

message BlockResponse {
	bool ok = 1;
	bytes data = 2;
}

message PutBlockRequest {
	repeated BlockRef refs = 1;
	repeated bytes blocks = 2;
}

message PutResponse {
	bool ok = 1;
	string err = 2;
}

message RebalanceCheckRequest {
  repeated BlockRef block_refs = 1;
}

message RebalanceCheckResponse {
  repeated bool valid = 1;
  int32 status = 2;
}
