From dde607ad2252c657fd4651929e42880d0f551c9c Mon Sep 17 00:00:00 2001 From: slinkydeveloper Date: Thu, 15 Feb 2024 10:47:02 +0100 Subject: [PATCH] Bump protocol version --- src/io/decoder.ts | 2 +- test/protocol_stream.test.ts | 5 ++++- test/protoutils.ts | 3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/io/decoder.ts b/src/io/decoder.ts index e1cab043..891c34a7 100644 --- a/src/io/decoder.ts +++ b/src/io/decoder.ts @@ -32,7 +32,7 @@ type DecoderState = { state: number; header: Header | undefined; buf: Buffer }; const WAITING_FOR_HEADER = 0; const WAITING_FOR_BODY = 1; -export const SUPPORTED_PROTOCOL_VERSION = 0; +export const SUPPORTED_PROTOCOL_VERSION = 1; function initalDecoderState(buf: Buffer): DecoderState { return { diff --git a/test/protocol_stream.test.ts b/test/protocol_stream.test.ts index b0632596..2beae10a 100644 --- a/test/protocol_stream.test.ts +++ b/test/protocol_stream.test.ts @@ -23,6 +23,7 @@ import { Header, Message } from "../src/types/types"; import stream from "stream"; import { setTimeout } from "timers/promises"; import { CompletablePromise } from "../src/utils/promises"; +import { SUPPORTED_PROTOCOL_VERSION } from "../src/io/decoder"; // The following test suite is taken from headers.rs describe("Header", () => { @@ -89,7 +90,9 @@ describe("Restate Streaming Connection", () => { id: Buffer.from("abcd"), debugId: "abcd", knownEntries: 1337, - }) + }), + undefined, + SUPPORTED_PROTOCOL_VERSION ) ); diff --git a/test/protoutils.ts b/test/protoutils.ts index e251f19d..4021dce8 100644 --- a/test/protoutils.ts +++ b/test/protoutils.ts @@ -67,6 +67,7 @@ import { expect } from "@jest/globals"; import { jsonSerialize, formatMessageAsJson } from "../src/utils/utils"; import { rlog } from "../src/logger"; import { ErrorCodes, RestateErrorCodes } from "../src/types/errors"; +import { SUPPORTED_PROTOCOL_VERSION } from "../src/io/decoder"; export function startMessage( knownEntries?: number, @@ -86,7 +87,7 @@ export function startMessage( partialState: partialState !== false, }), undefined, - 0, + SUPPORTED_PROTOCOL_VERSION, undefined ); }