UNPKG

hamok

Version:

Lightweight Distributed Object Storage on RAFT consensus algorithm

533 lines (532 loc) 21.9 kB
"use strict"; // @generated by protoc-gen-es v1.10.0 with parameter "target=ts" // @generated from file hamokMessage.proto (package io.github.hamok.dev.schema, syntax proto2) /* eslint-disable */ // @ts-nocheck Object.defineProperty(exports, "__esModule", { value: true }); exports.HamokMessage_MessageProtocol = exports.HamokMessage_MessageType = exports.HamokMessage = void 0; const protobuf_1 = require("@bufbuild/protobuf"); /** * @generated from message io.github.hamok.dev.schema.HamokMessage */ class HamokMessage extends protobuf_1.Message { /** * @generated from field: optional io.github.hamok.dev.schema.HamokMessage.MessageProtocol protocol = 1; */ protocol; /** * @generated from field: optional io.github.hamok.dev.schema.HamokMessage.MessageType type = 2; */ type; /** * @generated from field: optional string sourceId = 3; */ sourceId; /** * @generated from field: optional string destinationId = 4; */ destinationId; /** * @generated from field: optional string storageId = 5; */ storageId; /** * @generated from field: optional string requestId = 6; */ requestId; /** * @generated from field: optional uint64 timestamp = 7; */ timestamp; /** * @generated from field: optional int32 storageSize = 8; */ storageSize; /** * @generated from field: repeated bytes keys = 10; */ keys = []; /** * @generated from field: repeated bytes values = 11; */ values = []; /** * @generated from field: repeated string activeEndpointIds = 12; */ activeEndpointIds = []; /** * @generated from field: repeated io.github.hamok.dev.schema.HamokMessage embeddedMessages = 13; */ embeddedMessages = []; /** * @generated from field: optional bool success = 14; */ success; /** * @generated from field: optional bool executeSync = 15; */ executeSync; /** * @generated from field: optional string raftLeaderId = 16; */ raftLeaderId; /** * @generated from field: optional int32 raftNumberOfLogs = 17; */ raftNumberOfLogs; /** * @generated from field: optional int32 raftLastAppliedIndex = 18; */ raftLastAppliedIndex; /** * @generated from field: optional int32 raftCommitIndex = 19; */ raftCommitIndex; /** * @generated from field: optional int32 raftLeaderNextIndex = 20; */ raftLeaderNextIndex; /** * @generated from field: optional int32 raftPrevLogTerm = 21; */ raftPrevLogTerm; /** * @generated from field: optional int32 raftPrevLogIndex = 22; */ raftPrevLogIndex; /** * @generated from field: optional int32 raftTerm = 23; */ raftTerm; /** * @generated from field: optional int32 raftPeerNextIndex = 24; */ raftPeerNextIndex; /** * @generated from field: optional string raftCandidateId = 25; */ raftCandidateId; /** * @generated from field: optional int32 sequence = 26; */ sequence; /** * @generated from field: optional bool lastMessage = 27; */ lastMessage; /** * @generated from field: optional bytes prevValue = 28; */ prevValue; /** * @generated from field: optional bytes snapshot = 29; */ snapshot; constructor(data) { super(); protobuf_1.proto2.util.initPartial(data, this); } static runtime = protobuf_1.proto2; static typeName = "io.github.hamok.dev.schema.HamokMessage"; static fields = protobuf_1.proto2.util.newFieldList(() => [ { no: 1, name: "protocol", kind: "enum", T: protobuf_1.proto2.getEnumType(HamokMessage_MessageProtocol), opt: true }, { no: 2, name: "type", kind: "enum", T: protobuf_1.proto2.getEnumType(HamokMessage_MessageType), opt: true }, { no: 3, name: "sourceId", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true }, { no: 4, name: "destinationId", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true }, { no: 5, name: "storageId", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true }, { no: 6, name: "requestId", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true }, { no: 7, name: "timestamp", kind: "scalar", T: 4 /* ScalarType.UINT64 */, opt: true }, { no: 8, name: "storageSize", kind: "scalar", T: 5 /* ScalarType.INT32 */, opt: true }, { no: 10, name: "keys", kind: "scalar", T: 12 /* ScalarType.BYTES */, repeated: true }, { no: 11, name: "values", kind: "scalar", T: 12 /* ScalarType.BYTES */, repeated: true }, { no: 12, name: "activeEndpointIds", kind: "scalar", T: 9 /* ScalarType.STRING */, repeated: true }, { no: 13, name: "embeddedMessages", kind: "message", T: HamokMessage, repeated: true }, { no: 14, name: "success", kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, { no: 15, name: "executeSync", kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, { no: 16, name: "raftLeaderId", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true }, { no: 17, name: "raftNumberOfLogs", kind: "scalar", T: 5 /* ScalarType.INT32 */, opt: true }, { no: 18, name: "raftLastAppliedIndex", kind: "scalar", T: 5 /* ScalarType.INT32 */, opt: true }, { no: 19, name: "raftCommitIndex", kind: "scalar", T: 5 /* ScalarType.INT32 */, opt: true }, { no: 20, name: "raftLeaderNextIndex", kind: "scalar", T: 5 /* ScalarType.INT32 */, opt: true }, { no: 21, name: "raftPrevLogTerm", kind: "scalar", T: 5 /* ScalarType.INT32 */, opt: true }, { no: 22, name: "raftPrevLogIndex", kind: "scalar", T: 5 /* ScalarType.INT32 */, opt: true }, { no: 23, name: "raftTerm", kind: "scalar", T: 5 /* ScalarType.INT32 */, opt: true }, { no: 24, name: "raftPeerNextIndex", kind: "scalar", T: 5 /* ScalarType.INT32 */, opt: true }, { no: 25, name: "raftCandidateId", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true }, { no: 26, name: "sequence", kind: "scalar", T: 5 /* ScalarType.INT32 */, opt: true }, { no: 27, name: "lastMessage", kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, { no: 28, name: "prevValue", kind: "scalar", T: 12 /* ScalarType.BYTES */, opt: true }, { no: 29, name: "snapshot", kind: "scalar", T: 12 /* ScalarType.BYTES */, opt: true }, ]); static fromBinary(bytes, options) { return new HamokMessage().fromBinary(bytes, options); } static fromJson(jsonValue, options) { return new HamokMessage().fromJson(jsonValue, options); } static fromJsonString(jsonString, options) { return new HamokMessage().fromJsonString(jsonString, options); } static equals(a, b) { return protobuf_1.proto2.util.equals(HamokMessage, a, b); } } exports.HamokMessage = HamokMessage; /** * @generated from enum io.github.hamok.dev.schema.HamokMessage.MessageType */ var HamokMessage_MessageType; (function (HamokMessage_MessageType) { /** * * * Hello notifications are sent by every endpoint in order to inform every other endpoint * about the existance. * * @generated from enum value: HELLO_NOTIFICATION = 1; */ HamokMessage_MessageType[HamokMessage_MessageType["HELLO_NOTIFICATION"] = 1] = "HELLO_NOTIFICATION"; /** * * * Endpoint states are sent by the leader of the grid. * Endpoint state contains information about active and inactive endpoints, so every endpoint can keep up to date * about the remote endpoints * * @generated from enum value: ENDPOINT_STATES_NOTIFICATION = 2; */ HamokMessage_MessageType[HamokMessage_MessageType["ENDPOINT_STATES_NOTIFICATION"] = 2] = "ENDPOINT_STATES_NOTIFICATION"; /** * * * Inform endpoint about the requests currently ongoing and prevent the requester to timeout those. * (fetching took more time than time requestTimeout) * * @generated from enum value: ONGOING_REQUESTS_NOTIFICATION = 3; */ HamokMessage_MessageType[HamokMessage_MessageType["ONGOING_REQUESTS_NOTIFICATION"] = 3] = "ONGOING_REQUESTS_NOTIFICATION"; /** * * * Join notification is sent by a new endpoint to every other endpoint * in order to join the grid * * @generated from enum value: JOIN_NOTIFICATION = 4; */ HamokMessage_MessageType[HamokMessage_MessageType["JOIN_NOTIFICATION"] = 4] = "JOIN_NOTIFICATION"; /** * * * Raft Vote request is sent by a raccoon made itself a candidate * in order to be a leader of the cluster * * @generated from enum value: RAFT_VOTE_REQUEST = 12; */ HamokMessage_MessageType[HamokMessage_MessageType["RAFT_VOTE_REQUEST"] = 12] = "RAFT_VOTE_REQUEST"; /** * * * Raft Vote Response is a response to a vote request * contain if the voting is succeeded or not * * @generated from enum value: RAFT_VOTE_RESPONSE = 13; */ HamokMessage_MessageType[HamokMessage_MessageType["RAFT_VOTE_RESPONSE"] = 13] = "RAFT_VOTE_RESPONSE"; /** * * * Raft Append entries chunk is sent by the leader to followers in a cluster * for heartbeat and log distribution purposes * * @generated from enum value: RAFT_APPEND_ENTRIES_REQUEST_CHUNK = 16; */ HamokMessage_MessageType[HamokMessage_MessageType["RAFT_APPEND_ENTRIES_REQUEST_CHUNK"] = 16] = "RAFT_APPEND_ENTRIES_REQUEST_CHUNK"; /** * * * Raft Append entries response is sent by a follower to the leader * in order to inform the leader about the acceptance of the append request * * @generated from enum value: RAFT_APPEND_ENTRIES_RESPONSE = 17; */ HamokMessage_MessageType[HamokMessage_MessageType["RAFT_APPEND_ENTRIES_RESPONSE"] = 17] = "RAFT_APPEND_ENTRIES_RESPONSE"; /** * * * Submit request is sent by any endpoint to the leader of the cluster * in order to push a log entry to the Raft processed by Raccoons. * * @generated from enum value: SUBMIT_MESSAGE_REQUEST = 20; */ HamokMessage_MessageType[HamokMessage_MessageType["SUBMIT_MESSAGE_REQUEST"] = 20] = "SUBMIT_MESSAGE_REQUEST"; /** * * * Submit response is a response from a leader endpoint to the follower * inform about the success or failure correspondent to the request * * @generated from enum value: SUBMIT_MESSAGE_RESPONSE = 21; */ HamokMessage_MessageType[HamokMessage_MessageType["SUBMIT_MESSAGE_RESPONSE"] = 21] = "SUBMIT_MESSAGE_RESPONSE"; /** * * * Request to clear the storage * * @generated from enum value: CLEAR_ENTRIES_REQUEST = 24; */ HamokMessage_MessageType[HamokMessage_MessageType["CLEAR_ENTRIES_REQUEST"] = 24] = "CLEAR_ENTRIES_REQUEST"; /** * * * Response about the cleared storage * * @generated from enum value: CLEAR_ENTRIES_RESPONSE = 25; */ HamokMessage_MessageType[HamokMessage_MessageType["CLEAR_ENTRIES_RESPONSE"] = 25] = "CLEAR_ENTRIES_RESPONSE"; /** * * * Clear entries notification * * @generated from enum value: CLEAR_ENTRIES_NOTIFICATION = 26; */ HamokMessage_MessageType[HamokMessage_MessageType["CLEAR_ENTRIES_NOTIFICATION"] = 26] = "CLEAR_ENTRIES_NOTIFICATION"; /** * * * Request entries from remote endpoint(s). * * @generated from enum value: GET_ENTRIES_REQUEST = 28; */ HamokMessage_MessageType[HamokMessage_MessageType["GET_ENTRIES_REQUEST"] = 28] = "GET_ENTRIES_REQUEST"; /** * * * Response to a gen entries request contain the found entries * * @generated from enum value: GET_ENTRIES_RESPONSE = 29; */ HamokMessage_MessageType[HamokMessage_MessageType["GET_ENTRIES_RESPONSE"] = 29] = "GET_ENTRIES_RESPONSE"; /** * * * Request the size of a storage * * @generated from enum value: GET_SIZE_REQUEST = 32; */ HamokMessage_MessageType[HamokMessage_MessageType["GET_SIZE_REQUEST"] = 32] = "GET_SIZE_REQUEST"; /** * * * Response to size request * * @generated from enum value: GET_SIZE_RESPONSE = 33; */ HamokMessage_MessageType[HamokMessage_MessageType["GET_SIZE_RESPONSE"] = 33] = "GET_SIZE_RESPONSE"; /** * * * Request all the keys a storage on a remote endpoint(s) has. * * @generated from enum value: GET_KEYS_REQUEST = 36; */ HamokMessage_MessageType[HamokMessage_MessageType["GET_KEYS_REQUEST"] = 36] = "GET_KEYS_REQUEST"; /** * * * Response to a keys request contain all the keys an endpoint has * * @generated from enum value: GET_KEYS_RESPONSE = 37; */ HamokMessage_MessageType[HamokMessage_MessageType["GET_KEYS_RESPONSE"] = 37] = "GET_KEYS_RESPONSE"; /** * * * Request to delete entries on a remote endpoint * * @generated from enum value: DELETE_ENTRIES_REQUEST = 40; */ HamokMessage_MessageType[HamokMessage_MessageType["DELETE_ENTRIES_REQUEST"] = 40] = "DELETE_ENTRIES_REQUEST"; /** * * * Response to a delete request * * @generated from enum value: DELETE_ENTRIES_RESPONSE = 41; */ HamokMessage_MessageType[HamokMessage_MessageType["DELETE_ENTRIES_RESPONSE"] = 41] = "DELETE_ENTRIES_RESPONSE"; /** * * * Notification about deleting * * @generated from enum value: DELETE_ENTRIES_NOTIFICATION = 42; */ HamokMessage_MessageType[HamokMessage_MessageType["DELETE_ENTRIES_NOTIFICATION"] = 42] = "DELETE_ENTRIES_NOTIFICATION"; /** * * * Request to delete entries on a remote endpoint * * @generated from enum value: REMOVE_ENTRIES_REQUEST = 44; */ HamokMessage_MessageType[HamokMessage_MessageType["REMOVE_ENTRIES_REQUEST"] = 44] = "REMOVE_ENTRIES_REQUEST"; /** * * * Response to a delete request * * @generated from enum value: REMOVE_ENTRIES_RESPONSE = 45; */ HamokMessage_MessageType[HamokMessage_MessageType["REMOVE_ENTRIES_RESPONSE"] = 45] = "REMOVE_ENTRIES_RESPONSE"; /** * * * Notification to remove specific entries from the storage. * the difference between delete and remove that remove send the values * specifically need to be removed and delete only send the keys. It is useful for distributed collections * * * @generated from enum value: REMOVE_ENTRIES_NOTIFICATION = 46; */ HamokMessage_MessageType[HamokMessage_MessageType["REMOVE_ENTRIES_NOTIFICATION"] = 46] = "REMOVE_ENTRIES_NOTIFICATION"; /** * * * Notification about the removed entries * * @generated from enum value: ENTRIES_REMOVED_NOTIFICATION = 47; */ HamokMessage_MessageType[HamokMessage_MessageType["ENTRIES_REMOVED_NOTIFICATION"] = 47] = "ENTRIES_REMOVED_NOTIFICATION"; /** * * * Insert item(s) only if they don't exist. if they * exist then it returns with the value associated * * NOTE: Only the storage entries replicated by a * distributed and coordinated way like by a Raft algorithm * can guarantee that insert is atomic * * * @generated from enum value: INSERT_ENTRIES_REQUEST = 52; */ HamokMessage_MessageType[HamokMessage_MessageType["INSERT_ENTRIES_REQUEST"] = 52] = "INSERT_ENTRIES_REQUEST"; /** * * * Response to insert requests * * @generated from enum value: INSERT_ENTRIES_RESPONSE = 53; */ HamokMessage_MessageType[HamokMessage_MessageType["INSERT_ENTRIES_RESPONSE"] = 53] = "INSERT_ENTRIES_RESPONSE"; /** * * * Notification about an insert operation. * * @generated from enum value: INSERT_ENTRIES_NOTIFICATION = 54; */ HamokMessage_MessageType[HamokMessage_MessageType["INSERT_ENTRIES_NOTIFICATION"] = 54] = "INSERT_ENTRIES_NOTIFICATION"; /** * * * Notification about the inserted entries * * @generated from enum value: ENTRIES_INSERTED_NOTIFICATION = 55; */ HamokMessage_MessageType[HamokMessage_MessageType["ENTRIES_INSERTED_NOTIFICATION"] = 55] = "ENTRIES_INSERTED_NOTIFICATION"; /** * * * Request an update from a remote storage * * @generated from enum value: UPDATE_ENTRIES_REQUEST = 56; */ HamokMessage_MessageType[HamokMessage_MessageType["UPDATE_ENTRIES_REQUEST"] = 56] = "UPDATE_ENTRIES_REQUEST"; /** * * * Response to an update request * * @generated from enum value: UPDATE_ENTRIES_RESPONSE = 57; */ HamokMessage_MessageType[HamokMessage_MessageType["UPDATE_ENTRIES_RESPONSE"] = 57] = "UPDATE_ENTRIES_RESPONSE"; /** * * * Notification about the update * * @generated from enum value: UPDATE_ENTRIES_NOTIFICATION = 58; */ HamokMessage_MessageType[HamokMessage_MessageType["UPDATE_ENTRIES_NOTIFICATION"] = 58] = "UPDATE_ENTRIES_NOTIFICATION"; /** * * * Notification about the updated entries * * @generated from enum value: ENTRY_UPDATED_NOTIFICATION = 59; */ HamokMessage_MessageType[HamokMessage_MessageType["ENTRY_UPDATED_NOTIFICATION"] = 59] = "ENTRY_UPDATED_NOTIFICATION"; /** * * * Notification about the applied commit * * @generated from enum value: STORAGE_APPLIED_COMMIT_NOTIFICATION = 60; */ HamokMessage_MessageType[HamokMessage_MessageType["STORAGE_APPLIED_COMMIT_NOTIFICATION"] = 60] = "STORAGE_APPLIED_COMMIT_NOTIFICATION"; /** * * * Notification from an endpoint created a storage and wants to join to the grid * * @generated from enum value: STORAGE_HELLO_NOTIFICATION = 61; */ HamokMessage_MessageType[HamokMessage_MessageType["STORAGE_HELLO_NOTIFICATION"] = 61] = "STORAGE_HELLO_NOTIFICATION"; /** * * * Notification about the state of the storage as a response for the hello notification * * @generated from enum value: STORAGE_STATE_NOTIFICATION = 62; */ HamokMessage_MessageType[HamokMessage_MessageType["STORAGE_STATE_NOTIFICATION"] = 62] = "STORAGE_STATE_NOTIFICATION"; })(HamokMessage_MessageType || (exports.HamokMessage_MessageType = HamokMessage_MessageType = {})); // Retrieve enum metadata with: proto2.getEnumType(HamokMessage_MessageType) protobuf_1.proto2.util.setEnumType(HamokMessage_MessageType, "io.github.hamok.dev.schema.HamokMessage.MessageType", [ { no: 1, name: "HELLO_NOTIFICATION" }, { no: 2, name: "ENDPOINT_STATES_NOTIFICATION" }, { no: 3, name: "ONGOING_REQUESTS_NOTIFICATION" }, { no: 4, name: "JOIN_NOTIFICATION" }, { no: 12, name: "RAFT_VOTE_REQUEST" }, { no: 13, name: "RAFT_VOTE_RESPONSE" }, { no: 16, name: "RAFT_APPEND_ENTRIES_REQUEST_CHUNK" }, { no: 17, name: "RAFT_APPEND_ENTRIES_RESPONSE" }, { no: 20, name: "SUBMIT_MESSAGE_REQUEST" }, { no: 21, name: "SUBMIT_MESSAGE_RESPONSE" }, { no: 24, name: "CLEAR_ENTRIES_REQUEST" }, { no: 25, name: "CLEAR_ENTRIES_RESPONSE" }, { no: 26, name: "CLEAR_ENTRIES_NOTIFICATION" }, { no: 28, name: "GET_ENTRIES_REQUEST" }, { no: 29, name: "GET_ENTRIES_RESPONSE" }, { no: 32, name: "GET_SIZE_REQUEST" }, { no: 33, name: "GET_SIZE_RESPONSE" }, { no: 36, name: "GET_KEYS_REQUEST" }, { no: 37, name: "GET_KEYS_RESPONSE" }, { no: 40, name: "DELETE_ENTRIES_REQUEST" }, { no: 41, name: "DELETE_ENTRIES_RESPONSE" }, { no: 42, name: "DELETE_ENTRIES_NOTIFICATION" }, { no: 44, name: "REMOVE_ENTRIES_REQUEST" }, { no: 45, name: "REMOVE_ENTRIES_RESPONSE" }, { no: 46, name: "REMOVE_ENTRIES_NOTIFICATION" }, { no: 47, name: "ENTRIES_REMOVED_NOTIFICATION" }, { no: 52, name: "INSERT_ENTRIES_REQUEST" }, { no: 53, name: "INSERT_ENTRIES_RESPONSE" }, { no: 54, name: "INSERT_ENTRIES_NOTIFICATION" }, { no: 55, name: "ENTRIES_INSERTED_NOTIFICATION" }, { no: 56, name: "UPDATE_ENTRIES_REQUEST" }, { no: 57, name: "UPDATE_ENTRIES_RESPONSE" }, { no: 58, name: "UPDATE_ENTRIES_NOTIFICATION" }, { no: 59, name: "ENTRY_UPDATED_NOTIFICATION" }, { no: 60, name: "STORAGE_APPLIED_COMMIT_NOTIFICATION" }, { no: 61, name: "STORAGE_HELLO_NOTIFICATION" }, { no: 62, name: "STORAGE_STATE_NOTIFICATION" }, ]); /** * @generated from enum io.github.hamok.dev.schema.HamokMessage.MessageProtocol */ var HamokMessage_MessageProtocol; (function (HamokMessage_MessageProtocol) { /** * * * Messages should be interpreted by a grid client * * @generated from enum value: GRID_COMMUNICATION_PROTOCOL = 1; */ HamokMessage_MessageProtocol[HamokMessage_MessageProtocol["GRID_COMMUNICATION_PROTOCOL"] = 1] = "GRID_COMMUNICATION_PROTOCOL"; /** * * * Messages should be interpreted by a Raft implementation * * @generated from enum value: RAFT_COMMUNICATION_PROTOCOL = 2; */ HamokMessage_MessageProtocol[HamokMessage_MessageProtocol["RAFT_COMMUNICATION_PROTOCOL"] = 2] = "RAFT_COMMUNICATION_PROTOCOL"; /** * * * Messages should be interpreted by a specific storage * * @generated from enum value: STORAGE_COMMUNICATION_PROTOCOL = 3; */ HamokMessage_MessageProtocol[HamokMessage_MessageProtocol["STORAGE_COMMUNICATION_PROTOCOL"] = 3] = "STORAGE_COMMUNICATION_PROTOCOL"; })(HamokMessage_MessageProtocol || (exports.HamokMessage_MessageProtocol = HamokMessage_MessageProtocol = {})); // Retrieve enum metadata with: proto2.getEnumType(HamokMessage_MessageProtocol) protobuf_1.proto2.util.setEnumType(HamokMessage_MessageProtocol, "io.github.hamok.dev.schema.HamokMessage.MessageProtocol", [ { no: 1, name: "GRID_COMMUNICATION_PROTOCOL" }, { no: 2, name: "RAFT_COMMUNICATION_PROTOCOL" }, { no: 3, name: "STORAGE_COMMUNICATION_PROTOCOL" }, ]);