|
| 1 | +import * as $protobuf from "protobufjs"; |
| 2 | +/** Properties of a Record. */ |
| 3 | +export interface IRecord { |
| 4 | + |
| 5 | + /** Record key */ |
| 6 | + key?: (Uint8Array|null); |
| 7 | + |
| 8 | + /** Record value */ |
| 9 | + value?: (Uint8Array|null); |
| 10 | + |
| 11 | + /** Record author */ |
| 12 | + author?: (Uint8Array|null); |
| 13 | + |
| 14 | + /** Record signature */ |
| 15 | + signature?: (Uint8Array|null); |
| 16 | + |
| 17 | + /** Record timeReceived */ |
| 18 | + timeReceived?: (string|null); |
| 19 | +} |
| 20 | + |
| 21 | +/** Represents a Record. */ |
| 22 | +export class Record implements IRecord { |
| 23 | + |
| 24 | + /** |
| 25 | + * Constructs a new Record. |
| 26 | + * @param [p] Properties to set |
| 27 | + */ |
| 28 | + constructor(p?: IRecord); |
| 29 | + |
| 30 | + /** Record key. */ |
| 31 | + public key: Uint8Array; |
| 32 | + |
| 33 | + /** Record value. */ |
| 34 | + public value: Uint8Array; |
| 35 | + |
| 36 | + /** Record author. */ |
| 37 | + public author: Uint8Array; |
| 38 | + |
| 39 | + /** Record signature. */ |
| 40 | + public signature: Uint8Array; |
| 41 | + |
| 42 | + /** Record timeReceived. */ |
| 43 | + public timeReceived: string; |
| 44 | + |
| 45 | + /** |
| 46 | + * Encodes the specified Record message. Does not implicitly {@link Record.verify|verify} messages. |
| 47 | + * @param m Record message or plain object to encode |
| 48 | + * @param [w] Writer to encode to |
| 49 | + * @returns Writer |
| 50 | + */ |
| 51 | + public static encode(m: IRecord, w?: $protobuf.Writer): $protobuf.Writer; |
| 52 | + |
| 53 | + /** |
| 54 | + * Decodes a Record message from the specified reader or buffer. |
| 55 | + * @param r Reader or buffer to decode from |
| 56 | + * @param [l] Message length if known beforehand |
| 57 | + * @returns Record |
| 58 | + * @throws {Error} If the payload is not a reader or valid buffer |
| 59 | + * @throws {$protobuf.util.ProtocolError} If required fields are missing |
| 60 | + */ |
| 61 | + public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): Record; |
| 62 | + |
| 63 | + /** |
| 64 | + * Creates a Record message from a plain object. Also converts values to their respective internal types. |
| 65 | + * @param d Plain object |
| 66 | + * @returns Record |
| 67 | + */ |
| 68 | + public static fromObject(d: { [k: string]: any }): Record; |
| 69 | + |
| 70 | + /** |
| 71 | + * Creates a plain object from a Record message. Also converts values to other types if specified. |
| 72 | + * @param m Record |
| 73 | + * @param [o] Conversion options |
| 74 | + * @returns Plain object |
| 75 | + */ |
| 76 | + public static toObject(m: Record, o?: $protobuf.IConversionOptions): { [k: string]: any }; |
| 77 | + |
| 78 | + /** |
| 79 | + * Converts this Record to JSON. |
| 80 | + * @returns JSON object |
| 81 | + */ |
| 82 | + public toJSON(): { [k: string]: any }; |
| 83 | +} |
| 84 | + |
| 85 | +/** Properties of a Message. */ |
| 86 | +export interface IMessage { |
| 87 | + |
| 88 | + /** Message type */ |
| 89 | + type?: (Message.MessageType|null); |
| 90 | + |
| 91 | + /** Message clusterLevelRaw */ |
| 92 | + clusterLevelRaw?: (number|null); |
| 93 | + |
| 94 | + /** Message key */ |
| 95 | + key?: (Uint8Array|null); |
| 96 | + |
| 97 | + /** Message record */ |
| 98 | + record?: (Uint8Array|null); |
| 99 | + |
| 100 | + /** Message closerPeers */ |
| 101 | + closerPeers?: (Message.IPeer[]|null); |
| 102 | + |
| 103 | + /** Message providerPeers */ |
| 104 | + providerPeers?: (Message.IPeer[]|null); |
| 105 | +} |
| 106 | + |
| 107 | +/** Represents a Message. */ |
| 108 | +export class Message implements IMessage { |
| 109 | + |
| 110 | + /** |
| 111 | + * Constructs a new Message. |
| 112 | + * @param [p] Properties to set |
| 113 | + */ |
| 114 | + constructor(p?: IMessage); |
| 115 | + |
| 116 | + /** Message type. */ |
| 117 | + public type: Message.MessageType; |
| 118 | + |
| 119 | + /** Message clusterLevelRaw. */ |
| 120 | + public clusterLevelRaw: number; |
| 121 | + |
| 122 | + /** Message key. */ |
| 123 | + public key: Uint8Array; |
| 124 | + |
| 125 | + /** Message record. */ |
| 126 | + public record: Uint8Array; |
| 127 | + |
| 128 | + /** Message closerPeers. */ |
| 129 | + public closerPeers: Message.IPeer[]; |
| 130 | + |
| 131 | + /** Message providerPeers. */ |
| 132 | + public providerPeers: Message.IPeer[]; |
| 133 | + |
| 134 | + /** |
| 135 | + * Encodes the specified Message message. Does not implicitly {@link Message.verify|verify} messages. |
| 136 | + * @param m Message message or plain object to encode |
| 137 | + * @param [w] Writer to encode to |
| 138 | + * @returns Writer |
| 139 | + */ |
| 140 | + public static encode(m: IMessage, w?: $protobuf.Writer): $protobuf.Writer; |
| 141 | + |
| 142 | + /** |
| 143 | + * Decodes a Message message from the specified reader or buffer. |
| 144 | + * @param r Reader or buffer to decode from |
| 145 | + * @param [l] Message length if known beforehand |
| 146 | + * @returns Message |
| 147 | + * @throws {Error} If the payload is not a reader or valid buffer |
| 148 | + * @throws {$protobuf.util.ProtocolError} If required fields are missing |
| 149 | + */ |
| 150 | + public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): Message; |
| 151 | + |
| 152 | + /** |
| 153 | + * Creates a Message message from a plain object. Also converts values to their respective internal types. |
| 154 | + * @param d Plain object |
| 155 | + * @returns Message |
| 156 | + */ |
| 157 | + public static fromObject(d: { [k: string]: any }): Message; |
| 158 | + |
| 159 | + /** |
| 160 | + * Creates a plain object from a Message message. Also converts values to other types if specified. |
| 161 | + * @param m Message |
| 162 | + * @param [o] Conversion options |
| 163 | + * @returns Plain object |
| 164 | + */ |
| 165 | + public static toObject(m: Message, o?: $protobuf.IConversionOptions): { [k: string]: any }; |
| 166 | + |
| 167 | + /** |
| 168 | + * Converts this Message to JSON. |
| 169 | + * @returns JSON object |
| 170 | + */ |
| 171 | + public toJSON(): { [k: string]: any }; |
| 172 | +} |
| 173 | + |
| 174 | +export namespace Message { |
| 175 | + |
| 176 | + /** MessageType enum. */ |
| 177 | + enum MessageType { |
| 178 | + PUT_VALUE = 0, |
| 179 | + GET_VALUE = 1, |
| 180 | + ADD_PROVIDER = 2, |
| 181 | + GET_PROVIDERS = 3, |
| 182 | + FIND_NODE = 4, |
| 183 | + PING = 5 |
| 184 | + } |
| 185 | + |
| 186 | + /** ConnectionType enum. */ |
| 187 | + enum ConnectionType { |
| 188 | + NOT_CONNECTED = 0, |
| 189 | + CONNECTED = 1, |
| 190 | + CAN_CONNECT = 2, |
| 191 | + CANNOT_CONNECT = 3 |
| 192 | + } |
| 193 | + |
| 194 | + /** Properties of a Peer. */ |
| 195 | + interface IPeer { |
| 196 | + |
| 197 | + /** Peer id */ |
| 198 | + id?: (Uint8Array|null); |
| 199 | + |
| 200 | + /** Peer addrs */ |
| 201 | + addrs?: (Uint8Array[]|null); |
| 202 | + |
| 203 | + /** Peer connection */ |
| 204 | + connection?: (Message.ConnectionType|null); |
| 205 | + } |
| 206 | + |
| 207 | + /** Represents a Peer. */ |
| 208 | + class Peer implements IPeer { |
| 209 | + |
| 210 | + /** |
| 211 | + * Constructs a new Peer. |
| 212 | + * @param [p] Properties to set |
| 213 | + */ |
| 214 | + constructor(p?: Message.IPeer); |
| 215 | + |
| 216 | + /** Peer id. */ |
| 217 | + public id: Uint8Array; |
| 218 | + |
| 219 | + /** Peer addrs. */ |
| 220 | + public addrs: Uint8Array[]; |
| 221 | + |
| 222 | + /** Peer connection. */ |
| 223 | + public connection: Message.ConnectionType; |
| 224 | + |
| 225 | + /** |
| 226 | + * Encodes the specified Peer message. Does not implicitly {@link Message.Peer.verify|verify} messages. |
| 227 | + * @param m Peer message or plain object to encode |
| 228 | + * @param [w] Writer to encode to |
| 229 | + * @returns Writer |
| 230 | + */ |
| 231 | + public static encode(m: Message.IPeer, w?: $protobuf.Writer): $protobuf.Writer; |
| 232 | + |
| 233 | + /** |
| 234 | + * Decodes a Peer message from the specified reader or buffer. |
| 235 | + * @param r Reader or buffer to decode from |
| 236 | + * @param [l] Message length if known beforehand |
| 237 | + * @returns Peer |
| 238 | + * @throws {Error} If the payload is not a reader or valid buffer |
| 239 | + * @throws {$protobuf.util.ProtocolError} If required fields are missing |
| 240 | + */ |
| 241 | + public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): Message.Peer; |
| 242 | + |
| 243 | + /** |
| 244 | + * Creates a Peer message from a plain object. Also converts values to their respective internal types. |
| 245 | + * @param d Plain object |
| 246 | + * @returns Peer |
| 247 | + */ |
| 248 | + public static fromObject(d: { [k: string]: any }): Message.Peer; |
| 249 | + |
| 250 | + /** |
| 251 | + * Creates a plain object from a Peer message. Also converts values to other types if specified. |
| 252 | + * @param m Peer |
| 253 | + * @param [o] Conversion options |
| 254 | + * @returns Plain object |
| 255 | + */ |
| 256 | + public static toObject(m: Message.Peer, o?: $protobuf.IConversionOptions): { [k: string]: any }; |
| 257 | + |
| 258 | + /** |
| 259 | + * Converts this Peer to JSON. |
| 260 | + * @returns JSON object |
| 261 | + */ |
| 262 | + public toJSON(): { [k: string]: any }; |
| 263 | + } |
| 264 | +} |
0 commit comments