56 lines
1.0 KiB
Protocol Buffer
56 lines
1.0 KiB
Protocol Buffer
syntax = "proto3";
|
|
package anyConsensus;
|
|
|
|
option go_package = "consensus/consensusproto";
|
|
|
|
enum ErrCodes {
|
|
Unexpected = 0;
|
|
LogExists = 1;
|
|
LogNotFound = 2;
|
|
RecordConflict = 3;
|
|
ErrorOffset = 300;
|
|
}
|
|
|
|
|
|
message Log {
|
|
bytes id = 1;
|
|
repeated Record records = 2;
|
|
}
|
|
|
|
message Record {
|
|
bytes id = 1;
|
|
bytes prevId = 2;
|
|
bytes payload = 3;
|
|
uint64 createdUnix = 4;
|
|
}
|
|
|
|
service Consensus {
|
|
// AddLog adds new log to consensus
|
|
rpc AddLog(AddLogRequest) returns (Ok);
|
|
// AddRecord adds new record to log
|
|
rpc AddRecord(AddRecordRequest) returns (Ok);
|
|
// WatchLog fetches log and subscribes for a changes
|
|
rpc WatchLog(stream WatchLogRequest) returns (stream WatchLogEvent);
|
|
}
|
|
|
|
message Ok {}
|
|
|
|
message AddLogRequest {
|
|
Log log = 1;
|
|
}
|
|
|
|
message AddRecordRequest {
|
|
bytes logId = 1;
|
|
Record record = 2;
|
|
}
|
|
|
|
message WatchLogRequest {
|
|
repeated bytes watchIds = 1;
|
|
repeated bytes unwatchIds = 2;
|
|
}
|
|
|
|
message WatchLogEvent {
|
|
bytes logId = 1;
|
|
repeated Record records = 2;
|
|
}
|