From 6313c4276e7ae5049922ad966468b3d23693be91 Mon Sep 17 00:00:00 2001 From: TennyZhuang Date: Wed, 22 Mar 2023 11:26:49 +0800 Subject: [PATCH] refactor(dashboard): ignore `dashboard/proto/gen` and gen them during `npm i` (#8695) Signed-off-by: TennyZhuang --- .gitattributes | 2 - dashboard/.gitignore | 3 + dashboard/README.md | 38 +- dashboard/package-lock.json | 1 + dashboard/package.json | 3 +- dashboard/proto/gen/backup_service.ts | 390 -- dashboard/proto/gen/batch_plan.ts | 2472 ----------- dashboard/proto/gen/catalog.ts | 1556 ------- dashboard/proto/gen/common.ts | 700 ---- dashboard/proto/gen/compactor.ts | 100 - dashboard/proto/gen/compute.ts | 74 - dashboard/proto/gen/connector_service.ts | 1217 ------ dashboard/proto/gen/data.ts | 964 ----- dashboard/proto/gen/ddl_service.ts | 1738 -------- dashboard/proto/gen/expr.ts | 1267 ------ dashboard/proto/gen/health.ts | 117 - dashboard/proto/gen/hummock.ts | 4824 ---------------------- dashboard/proto/gen/java_binding.ts | 237 -- dashboard/proto/gen/meta.ts | 2719 ------------ dashboard/proto/gen/monitor_service.ts | 274 -- dashboard/proto/gen/plan_common.ts | 418 -- dashboard/proto/gen/source.ts | 162 - dashboard/proto/gen/stream_plan.ts | 4602 --------------------- dashboard/proto/gen/stream_service.ts | 725 ---- dashboard/proto/gen/task_service.ts | 544 --- dashboard/proto/gen/user.ts | 889 ---- dashboard/scripts/generate_proto.sh | 6 +- 27 files changed, 41 insertions(+), 26001 deletions(-) delete mode 100644 dashboard/proto/gen/backup_service.ts delete mode 100644 dashboard/proto/gen/batch_plan.ts delete mode 100644 dashboard/proto/gen/catalog.ts delete mode 100644 dashboard/proto/gen/common.ts delete mode 100644 dashboard/proto/gen/compactor.ts delete mode 100644 dashboard/proto/gen/compute.ts delete mode 100644 dashboard/proto/gen/connector_service.ts delete mode 100644 dashboard/proto/gen/data.ts delete mode 100644 dashboard/proto/gen/ddl_service.ts delete mode 100644 dashboard/proto/gen/expr.ts delete mode 100644 dashboard/proto/gen/health.ts delete mode 100644 dashboard/proto/gen/hummock.ts delete mode 100644 dashboard/proto/gen/java_binding.ts delete mode 100644 dashboard/proto/gen/meta.ts delete mode 100644 dashboard/proto/gen/monitor_service.ts delete mode 100644 dashboard/proto/gen/plan_common.ts delete mode 100644 dashboard/proto/gen/source.ts delete mode 100644 dashboard/proto/gen/stream_plan.ts delete mode 100644 dashboard/proto/gen/stream_service.ts delete mode 100644 dashboard/proto/gen/task_service.ts delete mode 100644 dashboard/proto/gen/user.ts diff --git a/.gitattributes b/.gitattributes index 6c73bee6f834..becfd0ec71ed 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2,7 +2,5 @@ src/tests/regress/data/** linguist-vendored # source test data scripts/source/test_data/** linguist-vendored -# generated proto for dashboard -dashboard/proto/gen/** linguist-generated # generated grafana dashboard grafana/risingwave-dashboard.json linguist-generated diff --git a/dashboard/.gitignore b/dashboard/.gitignore index 77ef4bf6b0fa..7d340654380e 100644 --- a/dashboard/.gitignore +++ b/dashboard/.gitignore @@ -23,3 +23,6 @@ npm-debug.log* yarn-debug.log* yarn-error.log* + +# generated proto +proto/gen diff --git a/dashboard/README.md b/dashboard/README.md index 5a0b9facf75a..28a9c29f4c6e 100644 --- a/dashboard/README.md +++ b/dashboard/README.md @@ -1,11 +1,15 @@ +# Dashboard + The framework: [Next.js](https://nextjs.org). Next.js supports SPA, SSG and SSR. With this feature, the dashboard ui can be deployed in + 1. Standalone machine serving only dashboard UI with a backend. (e.g. Dashboard for cloud product) 2. Meta service node. (e.g. Static HTML files integrated in meta service without any other dependencies like node.js) ## Files -``` + +```plain dashboard/ --.next/ (generated by nextjs) --node_modules/ (development dependencies) @@ -19,47 +23,67 @@ dashboard/ ``` ## Testing + TODO: Find a suitable testing framework ## Development + Start the RisingWave database, remove drop tables from `tpch_snapshot.slt` + ```bash ./risedev d sqllogictest -p 4566 -d dev './e2e_test/streaming/tpch_snapshot.slt' ``` + Install Dependencies. + ```bash npm i ``` + The website will be served at port 3000. + ```bash npm run dev ``` + You should also run: -``` + +```bash node mock-server.js ``` + To start a mock API server when developing. You can use `fetch.sh` to update the mock APIs. ## Test with RisingWave meta node -To replace the built static files in RisingWave with your newest code, + +To replace the built static files in RisingWave with your newest code, run the following scripts in the root directory. -``` + +```bash ./risedev export-dashboard-v2 ``` - ## Deployment -#### Static HTML files + +### Generate the protos + +Running `npm i` will generate the proto files under `proto/gen` automatically. In case there are modifications to the protos, you can regenerate them using the command npm run gen-proto. + +### Static HTML files + Build static files for standalone deployment without node.js. The built files are generated at `./out`. Check more details at [Static HTML Export](https://nextjs.org/docs/advanced-features/static-html-export). + ```bash npm run build-static ``` #### Next.js app + The built files are generated at `./.next`. + ```bash npm run build npm run start -``` \ No newline at end of file +``` diff --git a/dashboard/package-lock.json b/dashboard/package-lock.json index 2d741cd099d1..5c5842cdca15 100644 --- a/dashboard/package-lock.json +++ b/dashboard/package-lock.json @@ -4,6 +4,7 @@ "requires": true, "packages": { "": { + "hasInstallScript": true, "dependencies": { "@chakra-ui/react": "^2.3.1", "@emotion/react": "^11.10.4", diff --git a/dashboard/package.json b/dashboard/package.json index dd50d36471ce..f809ce311709 100644 --- a/dashboard/package.json +++ b/dashboard/package.json @@ -8,7 +8,8 @@ "gen-proto": "./scripts/generate_proto.sh", "lint": "prettier --check . && next lint", "format": "prettier --write . && next lint --fix", - "mock-server": "node ./mock-server.js" + "mock-server": "node ./mock-server.js", + "postinstall": "npm run gen-proto" }, "dependencies": { "@chakra-ui/react": "^2.3.1", diff --git a/dashboard/proto/gen/backup_service.ts b/dashboard/proto/gen/backup_service.ts deleted file mode 100644 index a30c09c2ae23..000000000000 --- a/dashboard/proto/gen/backup_service.ts +++ /dev/null @@ -1,390 +0,0 @@ -/* eslint-disable */ - -export const protobufPackage = "backup_service"; - -export const BackupJobStatus = { - UNSPECIFIED: "UNSPECIFIED", - RUNNING: "RUNNING", - SUCCEEDED: "SUCCEEDED", - /** - * NOT_FOUND - NOT_FOUND indicates one of these cases: - * - Invalid job id. - * - Job has failed. - * - Job has succeeded, but its resulted backup has been deleted later. - */ - NOT_FOUND: "NOT_FOUND", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type BackupJobStatus = typeof BackupJobStatus[keyof typeof BackupJobStatus]; - -export function backupJobStatusFromJSON(object: any): BackupJobStatus { - switch (object) { - case 0: - case "UNSPECIFIED": - return BackupJobStatus.UNSPECIFIED; - case 1: - case "RUNNING": - return BackupJobStatus.RUNNING; - case 2: - case "SUCCEEDED": - return BackupJobStatus.SUCCEEDED; - case 3: - case "NOT_FOUND": - return BackupJobStatus.NOT_FOUND; - case -1: - case "UNRECOGNIZED": - default: - return BackupJobStatus.UNRECOGNIZED; - } -} - -export function backupJobStatusToJSON(object: BackupJobStatus): string { - switch (object) { - case BackupJobStatus.UNSPECIFIED: - return "UNSPECIFIED"; - case BackupJobStatus.RUNNING: - return "RUNNING"; - case BackupJobStatus.SUCCEEDED: - return "SUCCEEDED"; - case BackupJobStatus.NOT_FOUND: - return "NOT_FOUND"; - case BackupJobStatus.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export interface MetaBackupManifestId { - id: number; -} - -export interface BackupMetaRequest { -} - -export interface BackupMetaResponse { - jobId: number; -} - -export interface GetBackupJobStatusRequest { - jobId: number; -} - -export interface GetBackupJobStatusResponse { - jobId: number; - jobStatus: BackupJobStatus; -} - -export interface DeleteMetaSnapshotRequest { - snapshotIds: number[]; -} - -export interface DeleteMetaSnapshotResponse { -} - -export interface GetMetaSnapshotManifestRequest { -} - -export interface GetMetaSnapshotManifestResponse { - manifest: MetaSnapshotManifest | undefined; -} - -export interface MetaSnapshotManifest { - manifestId: number; - snapshotMetadata: MetaSnapshotMetadata[]; -} - -export interface MetaSnapshotMetadata { - id: number; - hummockVersionId: number; - maxCommittedEpoch: number; - safeEpoch: number; -} - -function createBaseMetaBackupManifestId(): MetaBackupManifestId { - return { id: 0 }; -} - -export const MetaBackupManifestId = { - fromJSON(object: any): MetaBackupManifestId { - return { id: isSet(object.id) ? Number(object.id) : 0 }; - }, - - toJSON(message: MetaBackupManifestId): unknown { - const obj: any = {}; - message.id !== undefined && (obj.id = Math.round(message.id)); - return obj; - }, - - fromPartial, I>>(object: I): MetaBackupManifestId { - const message = createBaseMetaBackupManifestId(); - message.id = object.id ?? 0; - return message; - }, -}; - -function createBaseBackupMetaRequest(): BackupMetaRequest { - return {}; -} - -export const BackupMetaRequest = { - fromJSON(_: any): BackupMetaRequest { - return {}; - }, - - toJSON(_: BackupMetaRequest): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): BackupMetaRequest { - const message = createBaseBackupMetaRequest(); - return message; - }, -}; - -function createBaseBackupMetaResponse(): BackupMetaResponse { - return { jobId: 0 }; -} - -export const BackupMetaResponse = { - fromJSON(object: any): BackupMetaResponse { - return { jobId: isSet(object.jobId) ? Number(object.jobId) : 0 }; - }, - - toJSON(message: BackupMetaResponse): unknown { - const obj: any = {}; - message.jobId !== undefined && (obj.jobId = Math.round(message.jobId)); - return obj; - }, - - fromPartial, I>>(object: I): BackupMetaResponse { - const message = createBaseBackupMetaResponse(); - message.jobId = object.jobId ?? 0; - return message; - }, -}; - -function createBaseGetBackupJobStatusRequest(): GetBackupJobStatusRequest { - return { jobId: 0 }; -} - -export const GetBackupJobStatusRequest = { - fromJSON(object: any): GetBackupJobStatusRequest { - return { jobId: isSet(object.jobId) ? Number(object.jobId) : 0 }; - }, - - toJSON(message: GetBackupJobStatusRequest): unknown { - const obj: any = {}; - message.jobId !== undefined && (obj.jobId = Math.round(message.jobId)); - return obj; - }, - - fromPartial, I>>(object: I): GetBackupJobStatusRequest { - const message = createBaseGetBackupJobStatusRequest(); - message.jobId = object.jobId ?? 0; - return message; - }, -}; - -function createBaseGetBackupJobStatusResponse(): GetBackupJobStatusResponse { - return { jobId: 0, jobStatus: BackupJobStatus.UNSPECIFIED }; -} - -export const GetBackupJobStatusResponse = { - fromJSON(object: any): GetBackupJobStatusResponse { - return { - jobId: isSet(object.jobId) ? Number(object.jobId) : 0, - jobStatus: isSet(object.jobStatus) ? backupJobStatusFromJSON(object.jobStatus) : BackupJobStatus.UNSPECIFIED, - }; - }, - - toJSON(message: GetBackupJobStatusResponse): unknown { - const obj: any = {}; - message.jobId !== undefined && (obj.jobId = Math.round(message.jobId)); - message.jobStatus !== undefined && (obj.jobStatus = backupJobStatusToJSON(message.jobStatus)); - return obj; - }, - - fromPartial, I>>(object: I): GetBackupJobStatusResponse { - const message = createBaseGetBackupJobStatusResponse(); - message.jobId = object.jobId ?? 0; - message.jobStatus = object.jobStatus ?? BackupJobStatus.UNSPECIFIED; - return message; - }, -}; - -function createBaseDeleteMetaSnapshotRequest(): DeleteMetaSnapshotRequest { - return { snapshotIds: [] }; -} - -export const DeleteMetaSnapshotRequest = { - fromJSON(object: any): DeleteMetaSnapshotRequest { - return { snapshotIds: Array.isArray(object?.snapshotIds) ? object.snapshotIds.map((e: any) => Number(e)) : [] }; - }, - - toJSON(message: DeleteMetaSnapshotRequest): unknown { - const obj: any = {}; - if (message.snapshotIds) { - obj.snapshotIds = message.snapshotIds.map((e) => Math.round(e)); - } else { - obj.snapshotIds = []; - } - return obj; - }, - - fromPartial, I>>(object: I): DeleteMetaSnapshotRequest { - const message = createBaseDeleteMetaSnapshotRequest(); - message.snapshotIds = object.snapshotIds?.map((e) => e) || []; - return message; - }, -}; - -function createBaseDeleteMetaSnapshotResponse(): DeleteMetaSnapshotResponse { - return {}; -} - -export const DeleteMetaSnapshotResponse = { - fromJSON(_: any): DeleteMetaSnapshotResponse { - return {}; - }, - - toJSON(_: DeleteMetaSnapshotResponse): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): DeleteMetaSnapshotResponse { - const message = createBaseDeleteMetaSnapshotResponse(); - return message; - }, -}; - -function createBaseGetMetaSnapshotManifestRequest(): GetMetaSnapshotManifestRequest { - return {}; -} - -export const GetMetaSnapshotManifestRequest = { - fromJSON(_: any): GetMetaSnapshotManifestRequest { - return {}; - }, - - toJSON(_: GetMetaSnapshotManifestRequest): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): GetMetaSnapshotManifestRequest { - const message = createBaseGetMetaSnapshotManifestRequest(); - return message; - }, -}; - -function createBaseGetMetaSnapshotManifestResponse(): GetMetaSnapshotManifestResponse { - return { manifest: undefined }; -} - -export const GetMetaSnapshotManifestResponse = { - fromJSON(object: any): GetMetaSnapshotManifestResponse { - return { manifest: isSet(object.manifest) ? MetaSnapshotManifest.fromJSON(object.manifest) : undefined }; - }, - - toJSON(message: GetMetaSnapshotManifestResponse): unknown { - const obj: any = {}; - message.manifest !== undefined && - (obj.manifest = message.manifest ? MetaSnapshotManifest.toJSON(message.manifest) : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): GetMetaSnapshotManifestResponse { - const message = createBaseGetMetaSnapshotManifestResponse(); - message.manifest = (object.manifest !== undefined && object.manifest !== null) - ? MetaSnapshotManifest.fromPartial(object.manifest) - : undefined; - return message; - }, -}; - -function createBaseMetaSnapshotManifest(): MetaSnapshotManifest { - return { manifestId: 0, snapshotMetadata: [] }; -} - -export const MetaSnapshotManifest = { - fromJSON(object: any): MetaSnapshotManifest { - return { - manifestId: isSet(object.manifestId) ? Number(object.manifestId) : 0, - snapshotMetadata: Array.isArray(object?.snapshotMetadata) - ? object.snapshotMetadata.map((e: any) => MetaSnapshotMetadata.fromJSON(e)) - : [], - }; - }, - - toJSON(message: MetaSnapshotManifest): unknown { - const obj: any = {}; - message.manifestId !== undefined && (obj.manifestId = Math.round(message.manifestId)); - if (message.snapshotMetadata) { - obj.snapshotMetadata = message.snapshotMetadata.map((e) => e ? MetaSnapshotMetadata.toJSON(e) : undefined); - } else { - obj.snapshotMetadata = []; - } - return obj; - }, - - fromPartial, I>>(object: I): MetaSnapshotManifest { - const message = createBaseMetaSnapshotManifest(); - message.manifestId = object.manifestId ?? 0; - message.snapshotMetadata = object.snapshotMetadata?.map((e) => MetaSnapshotMetadata.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseMetaSnapshotMetadata(): MetaSnapshotMetadata { - return { id: 0, hummockVersionId: 0, maxCommittedEpoch: 0, safeEpoch: 0 }; -} - -export const MetaSnapshotMetadata = { - fromJSON(object: any): MetaSnapshotMetadata { - return { - id: isSet(object.id) ? Number(object.id) : 0, - hummockVersionId: isSet(object.hummockVersionId) ? Number(object.hummockVersionId) : 0, - maxCommittedEpoch: isSet(object.maxCommittedEpoch) ? Number(object.maxCommittedEpoch) : 0, - safeEpoch: isSet(object.safeEpoch) ? Number(object.safeEpoch) : 0, - }; - }, - - toJSON(message: MetaSnapshotMetadata): unknown { - const obj: any = {}; - message.id !== undefined && (obj.id = Math.round(message.id)); - message.hummockVersionId !== undefined && (obj.hummockVersionId = Math.round(message.hummockVersionId)); - message.maxCommittedEpoch !== undefined && (obj.maxCommittedEpoch = Math.round(message.maxCommittedEpoch)); - message.safeEpoch !== undefined && (obj.safeEpoch = Math.round(message.safeEpoch)); - return obj; - }, - - fromPartial, I>>(object: I): MetaSnapshotMetadata { - const message = createBaseMetaSnapshotMetadata(); - message.id = object.id ?? 0; - message.hummockVersionId = object.hummockVersionId ?? 0; - message.maxCommittedEpoch = object.maxCommittedEpoch ?? 0; - message.safeEpoch = object.safeEpoch ?? 0; - return message; - }, -}; - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> - : T extends { $case: string } ? { [K in keyof Omit]?: DeepPartial } & { $case: T["$case"] } - : T extends {} ? { [K in keyof T]?: DeepPartial } - : Partial; - -type KeysOfUnion = T extends T ? keyof T : never; -export type Exact = P extends Builtin ? P - : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; - -function isSet(value: any): boolean { - return value !== null && value !== undefined; -} diff --git a/dashboard/proto/gen/batch_plan.ts b/dashboard/proto/gen/batch_plan.ts deleted file mode 100644 index 73420d1086fd..000000000000 --- a/dashboard/proto/gen/batch_plan.ts +++ /dev/null @@ -1,2472 +0,0 @@ -/* eslint-disable */ -import { StreamSourceInfo } from "./catalog"; -import { - BatchQueryEpoch, - Buffer, - ColumnOrder, - Direction, - directionFromJSON, - directionToJSON, - HostAddress, - WorkerNode, -} from "./common"; -import { IntervalUnit } from "./data"; -import { AggCall, ExprNode, ProjectSetSelectItem, TableFunction } from "./expr"; -import { - ColumnCatalog, - ColumnDesc, - Field, - JoinType, - joinTypeFromJSON, - joinTypeToJSON, - StorageTableDesc, -} from "./plan_common"; - -export const protobufPackage = "batch_plan"; - -export interface RowSeqScanNode { - tableDesc: StorageTableDesc | undefined; - columnIds: number[]; - /** - * All the ranges need to be read. i.e., they are OR'ed. - * - * Empty `scan_ranges` means full table scan. - */ - scanRanges: ScanRange[]; - /** - * The partition to read for scan tasks. - * - * Will be filled by the scheduler. - */ - vnodeBitmap: - | Buffer - | undefined; - /** Whether the order on output columns should be preserved. */ - ordered: boolean; - /** If along with `batch_limit`, `chunk_size` will be set. */ - chunkSize: RowSeqScanNode_ChunkSize | undefined; -} - -export interface RowSeqScanNode_ChunkSize { - chunkSize: number; -} - -export interface SysRowSeqScanNode { - tableId: number; - columnDescs: ColumnDesc[]; -} - -/** - * The range to scan, which specifies a consecutive range of the PK - * and can represent: (Suppose there are N columns in the PK) - * - full table scan: Should not occur. Use an empty `Vec` instead. - * - index range scan: `eq_conds` includes i (between 0 and N-1, inclusive) values, - * and `lower_bound` & `upper_bound` is the range for the (i+1)th column - * - index point get: `eq_conds` includes N values, and `lower_bound` & `upper_bound` are `None` - */ -export interface ScanRange { - /** The i-th element represents the value of the i-th PK column. */ - eqConds: Uint8Array[]; - /** The lower bound of the next PK column subsequent to those in `eq_conds`. */ - lowerBound: - | ScanRange_Bound - | undefined; - /** The upper bound of the next PK column subsequent to those in `eq_conds`. */ - upperBound: ScanRange_Bound | undefined; -} - -/** `None` represent unbounded. */ -export interface ScanRange_Bound { - value: Uint8Array; - inclusive: boolean; -} - -export interface SourceNode { - sourceId: number; - columns: ColumnCatalog[]; - properties: { [key: string]: string }; - split: Uint8Array; - info: StreamSourceInfo | undefined; -} - -export interface SourceNode_PropertiesEntry { - key: string; - value: string; -} - -export interface ProjectNode { - selectList: ExprNode[]; -} - -export interface FilterNode { - searchCondition: ExprNode | undefined; -} - -export interface InsertNode { - /** Id of the table to perform inserting. */ - tableId: number; - /** Version of the table. */ - tableVersionId: number; - columnIndices: number[]; - /** - * An optional field and will be `None` for tables without user-defined pk. - * The `BatchInsertExecutor` should add a column with NULL value which will - * be filled in streaming. - */ - rowIdIndex?: number | undefined; - returning: boolean; -} - -export interface DeleteNode { - /** Id of the table to perform deleting. */ - tableId: number; - /** Version of the table. */ - tableVersionId: number; - returning: boolean; -} - -export interface UpdateNode { - /** Id of the table to perform updating. */ - tableId: number; - /** Version of the table. */ - tableVersionId: number; - exprs: ExprNode[]; - returning: boolean; -} - -export interface ValuesNode { - tuples: ValuesNode_ExprTuple[]; - fields: Field[]; -} - -export interface ValuesNode_ExprTuple { - cells: ExprNode[]; -} - -export interface SortNode { - columnOrders: ColumnOrder[]; -} - -export interface TopNNode { - columnOrders: ColumnOrder[]; - limit: number; - offset: number; - withTies: boolean; -} - -export interface GroupTopNNode { - columnOrders: ColumnOrder[]; - limit: number; - offset: number; - groupKey: number[]; - withTies: boolean; -} - -export interface LimitNode { - limit: number; - offset: number; -} - -export interface NestedLoopJoinNode { - joinType: JoinType; - joinCond: ExprNode | undefined; - outputIndices: number[]; -} - -export interface HashAggNode { - groupKey: number[]; - aggCalls: AggCall[]; -} - -export interface ExpandNode { - columnSubsets: ExpandNode_Subset[]; -} - -export interface ExpandNode_Subset { - columnIndices: number[]; -} - -export interface ProjectSetNode { - selectList: ProjectSetSelectItem[]; -} - -export interface SortAggNode { - groupKey: ExprNode[]; - aggCalls: AggCall[]; -} - -export interface HashJoinNode { - joinType: JoinType; - leftKey: number[]; - rightKey: number[]; - condition: ExprNode | undefined; - outputIndices: number[]; - /** - * Null safe means it treats `null = null` as true. - * Each key pair can be null safe independently. (left_key, right_key, null_safe) - */ - nullSafe: boolean[]; -} - -export interface SortMergeJoinNode { - joinType: JoinType; - leftKey: number[]; - rightKey: number[]; - direction: Direction; - outputIndices: number[]; -} - -export interface HopWindowNode { - timeCol: number; - windowSlide: IntervalUnit | undefined; - windowSize: IntervalUnit | undefined; - outputIndices: number[]; - windowStartExprs: ExprNode[]; - windowEndExprs: ExprNode[]; -} - -export interface TableFunctionNode { - tableFunction: TableFunction | undefined; -} - -/** Task is a running instance of Stage. */ -export interface TaskId { - queryId: string; - stageId: number; - taskId: number; -} - -/** - * Every task will create N buffers (channels) for parent operators to fetch results from, - * where N is the parallelism of parent stage. - */ -export interface TaskOutputId { - taskId: - | TaskId - | undefined; - /** The id of output channel to fetch from */ - outputId: number; -} - -export interface LocalExecutePlan { - plan: PlanFragment | undefined; - epoch: BatchQueryEpoch | undefined; -} - -/** ExchangeSource describes where to read results from children operators */ -export interface ExchangeSource { - taskOutputId: TaskOutputId | undefined; - host: HostAddress | undefined; - localExecutePlan?: { $case: "plan"; plan: LocalExecutePlan }; -} - -export interface ExchangeNode { - sources: ExchangeSource[]; - inputSchema: Field[]; -} - -export interface MergeSortExchangeNode { - exchange: ExchangeNode | undefined; - columnOrders: ColumnOrder[]; -} - -export interface LocalLookupJoinNode { - joinType: JoinType; - condition: ExprNode | undefined; - outerSideKey: number[]; - innerSideKey: number[]; - lookupPrefixLen: number; - innerSideTableDesc: StorageTableDesc | undefined; - innerSideVnodeMapping: number[]; - innerSideColumnIds: number[]; - outputIndices: number[]; - workerNodes: WorkerNode[]; - /** - * Null safe means it treats `null = null` as true. - * Each key pair can be null safe independently. (left_key, right_key, null_safe) - */ - nullSafe: boolean[]; -} - -/** - * RFC: A new schedule way for distributed lookup join - * https://github.com/risingwavelabs/rfcs/pull/6 - */ -export interface DistributedLookupJoinNode { - joinType: JoinType; - condition: ExprNode | undefined; - outerSideKey: number[]; - innerSideKey: number[]; - lookupPrefixLen: number; - innerSideTableDesc: StorageTableDesc | undefined; - innerSideColumnIds: number[]; - outputIndices: number[]; - /** - * Null safe means it treats `null = null` as true. - * Each key pair can be null safe independently. (left_key, right_key, null_safe) - */ - nullSafe: boolean[]; -} - -export interface UnionNode { -} - -export interface PlanNode { - children: PlanNode[]; - nodeBody?: - | { $case: "insert"; insert: InsertNode } - | { $case: "delete"; delete: DeleteNode } - | { $case: "update"; update: UpdateNode } - | { $case: "project"; project: ProjectNode } - | { $case: "hashAgg"; hashAgg: HashAggNode } - | { $case: "filter"; filter: FilterNode } - | { $case: "exchange"; exchange: ExchangeNode } - | { $case: "sort"; sort: SortNode } - | { $case: "nestedLoopJoin"; nestedLoopJoin: NestedLoopJoinNode } - | { $case: "topN"; topN: TopNNode } - | { $case: "sortAgg"; sortAgg: SortAggNode } - | { $case: "rowSeqScan"; rowSeqScan: RowSeqScanNode } - | { $case: "limit"; limit: LimitNode } - | { $case: "values"; values: ValuesNode } - | { $case: "hashJoin"; hashJoin: HashJoinNode } - | { $case: "mergeSortExchange"; mergeSortExchange: MergeSortExchangeNode } - | { $case: "hopWindow"; hopWindow: HopWindowNode } - | { $case: "tableFunction"; tableFunction: TableFunctionNode } - | { $case: "sysRowSeqScan"; sysRowSeqScan: SysRowSeqScanNode } - | { $case: "expand"; expand: ExpandNode } - | { $case: "localLookupJoin"; localLookupJoin: LocalLookupJoinNode } - | { $case: "projectSet"; projectSet: ProjectSetNode } - | { $case: "union"; union: UnionNode } - | { $case: "groupTopN"; groupTopN: GroupTopNNode } - | { $case: "distributedLookupJoin"; distributedLookupJoin: DistributedLookupJoinNode } - | { $case: "source"; source: SourceNode }; - identity: string; -} - -/** - * ExchangeInfo determines how to distribute results to tasks of next stage. - * - * Note that the fragment itself does not know the where are the receivers. Instead, it prepares results in - * N buffers and wait for parent operators (`Exchange` nodes) to pull data from a specified buffer - */ -export interface ExchangeInfo { - mode: ExchangeInfo_DistributionMode; - distribution?: { $case: "broadcastInfo"; broadcastInfo: ExchangeInfo_BroadcastInfo } | { - $case: "hashInfo"; - hashInfo: ExchangeInfo_HashInfo; - } | { $case: "consistentHashInfo"; consistentHashInfo: ExchangeInfo_ConsistentHashInfo }; -} - -export const ExchangeInfo_DistributionMode = { - /** UNSPECIFIED - No partitioning at all, used for root segment which aggregates query results */ - UNSPECIFIED: "UNSPECIFIED", - SINGLE: "SINGLE", - BROADCAST: "BROADCAST", - HASH: "HASH", - CONSISTENT_HASH: "CONSISTENT_HASH", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type ExchangeInfo_DistributionMode = - typeof ExchangeInfo_DistributionMode[keyof typeof ExchangeInfo_DistributionMode]; - -export function exchangeInfo_DistributionModeFromJSON(object: any): ExchangeInfo_DistributionMode { - switch (object) { - case 0: - case "UNSPECIFIED": - return ExchangeInfo_DistributionMode.UNSPECIFIED; - case 1: - case "SINGLE": - return ExchangeInfo_DistributionMode.SINGLE; - case 2: - case "BROADCAST": - return ExchangeInfo_DistributionMode.BROADCAST; - case 3: - case "HASH": - return ExchangeInfo_DistributionMode.HASH; - case 4: - case "CONSISTENT_HASH": - return ExchangeInfo_DistributionMode.CONSISTENT_HASH; - case -1: - case "UNRECOGNIZED": - default: - return ExchangeInfo_DistributionMode.UNRECOGNIZED; - } -} - -export function exchangeInfo_DistributionModeToJSON(object: ExchangeInfo_DistributionMode): string { - switch (object) { - case ExchangeInfo_DistributionMode.UNSPECIFIED: - return "UNSPECIFIED"; - case ExchangeInfo_DistributionMode.SINGLE: - return "SINGLE"; - case ExchangeInfo_DistributionMode.BROADCAST: - return "BROADCAST"; - case ExchangeInfo_DistributionMode.HASH: - return "HASH"; - case ExchangeInfo_DistributionMode.CONSISTENT_HASH: - return "CONSISTENT_HASH"; - case ExchangeInfo_DistributionMode.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export interface ExchangeInfo_BroadcastInfo { - count: number; -} - -export interface ExchangeInfo_HashInfo { - outputCount: number; - key: number[]; -} - -export interface ExchangeInfo_ConsistentHashInfo { - /** `vmap` maps virtual node to down stream task id */ - vmap: number[]; - key: number[]; -} - -export interface PlanFragment { - root: PlanNode | undefined; - exchangeInfo: ExchangeInfo | undefined; -} - -function createBaseRowSeqScanNode(): RowSeqScanNode { - return { - tableDesc: undefined, - columnIds: [], - scanRanges: [], - vnodeBitmap: undefined, - ordered: false, - chunkSize: undefined, - }; -} - -export const RowSeqScanNode = { - fromJSON(object: any): RowSeqScanNode { - return { - tableDesc: isSet(object.tableDesc) ? StorageTableDesc.fromJSON(object.tableDesc) : undefined, - columnIds: Array.isArray(object?.columnIds) ? object.columnIds.map((e: any) => Number(e)) : [], - scanRanges: Array.isArray(object?.scanRanges) ? object.scanRanges.map((e: any) => ScanRange.fromJSON(e)) : [], - vnodeBitmap: isSet(object.vnodeBitmap) ? Buffer.fromJSON(object.vnodeBitmap) : undefined, - ordered: isSet(object.ordered) ? Boolean(object.ordered) : false, - chunkSize: isSet(object.chunkSize) ? RowSeqScanNode_ChunkSize.fromJSON(object.chunkSize) : undefined, - }; - }, - - toJSON(message: RowSeqScanNode): unknown { - const obj: any = {}; - message.tableDesc !== undefined && - (obj.tableDesc = message.tableDesc ? StorageTableDesc.toJSON(message.tableDesc) : undefined); - if (message.columnIds) { - obj.columnIds = message.columnIds.map((e) => Math.round(e)); - } else { - obj.columnIds = []; - } - if (message.scanRanges) { - obj.scanRanges = message.scanRanges.map((e) => e ? ScanRange.toJSON(e) : undefined); - } else { - obj.scanRanges = []; - } - message.vnodeBitmap !== undefined && - (obj.vnodeBitmap = message.vnodeBitmap ? Buffer.toJSON(message.vnodeBitmap) : undefined); - message.ordered !== undefined && (obj.ordered = message.ordered); - message.chunkSize !== undefined && - (obj.chunkSize = message.chunkSize ? RowSeqScanNode_ChunkSize.toJSON(message.chunkSize) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): RowSeqScanNode { - const message = createBaseRowSeqScanNode(); - message.tableDesc = (object.tableDesc !== undefined && object.tableDesc !== null) - ? StorageTableDesc.fromPartial(object.tableDesc) - : undefined; - message.columnIds = object.columnIds?.map((e) => e) || []; - message.scanRanges = object.scanRanges?.map((e) => ScanRange.fromPartial(e)) || []; - message.vnodeBitmap = (object.vnodeBitmap !== undefined && object.vnodeBitmap !== null) - ? Buffer.fromPartial(object.vnodeBitmap) - : undefined; - message.ordered = object.ordered ?? false; - message.chunkSize = (object.chunkSize !== undefined && object.chunkSize !== null) - ? RowSeqScanNode_ChunkSize.fromPartial(object.chunkSize) - : undefined; - return message; - }, -}; - -function createBaseRowSeqScanNode_ChunkSize(): RowSeqScanNode_ChunkSize { - return { chunkSize: 0 }; -} - -export const RowSeqScanNode_ChunkSize = { - fromJSON(object: any): RowSeqScanNode_ChunkSize { - return { chunkSize: isSet(object.chunkSize) ? Number(object.chunkSize) : 0 }; - }, - - toJSON(message: RowSeqScanNode_ChunkSize): unknown { - const obj: any = {}; - message.chunkSize !== undefined && (obj.chunkSize = Math.round(message.chunkSize)); - return obj; - }, - - fromPartial, I>>(object: I): RowSeqScanNode_ChunkSize { - const message = createBaseRowSeqScanNode_ChunkSize(); - message.chunkSize = object.chunkSize ?? 0; - return message; - }, -}; - -function createBaseSysRowSeqScanNode(): SysRowSeqScanNode { - return { tableId: 0, columnDescs: [] }; -} - -export const SysRowSeqScanNode = { - fromJSON(object: any): SysRowSeqScanNode { - return { - tableId: isSet(object.tableId) ? Number(object.tableId) : 0, - columnDescs: Array.isArray(object?.columnDescs) ? object.columnDescs.map((e: any) => ColumnDesc.fromJSON(e)) : [], - }; - }, - - toJSON(message: SysRowSeqScanNode): unknown { - const obj: any = {}; - message.tableId !== undefined && (obj.tableId = Math.round(message.tableId)); - if (message.columnDescs) { - obj.columnDescs = message.columnDescs.map((e) => e ? ColumnDesc.toJSON(e) : undefined); - } else { - obj.columnDescs = []; - } - return obj; - }, - - fromPartial, I>>(object: I): SysRowSeqScanNode { - const message = createBaseSysRowSeqScanNode(); - message.tableId = object.tableId ?? 0; - message.columnDescs = object.columnDescs?.map((e) => ColumnDesc.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseScanRange(): ScanRange { - return { eqConds: [], lowerBound: undefined, upperBound: undefined }; -} - -export const ScanRange = { - fromJSON(object: any): ScanRange { - return { - eqConds: Array.isArray(object?.eqConds) ? object.eqConds.map((e: any) => bytesFromBase64(e)) : [], - lowerBound: isSet(object.lowerBound) ? ScanRange_Bound.fromJSON(object.lowerBound) : undefined, - upperBound: isSet(object.upperBound) ? ScanRange_Bound.fromJSON(object.upperBound) : undefined, - }; - }, - - toJSON(message: ScanRange): unknown { - const obj: any = {}; - if (message.eqConds) { - obj.eqConds = message.eqConds.map((e) => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.eqConds = []; - } - message.lowerBound !== undefined && - (obj.lowerBound = message.lowerBound ? ScanRange_Bound.toJSON(message.lowerBound) : undefined); - message.upperBound !== undefined && - (obj.upperBound = message.upperBound ? ScanRange_Bound.toJSON(message.upperBound) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): ScanRange { - const message = createBaseScanRange(); - message.eqConds = object.eqConds?.map((e) => e) || []; - message.lowerBound = (object.lowerBound !== undefined && object.lowerBound !== null) - ? ScanRange_Bound.fromPartial(object.lowerBound) - : undefined; - message.upperBound = (object.upperBound !== undefined && object.upperBound !== null) - ? ScanRange_Bound.fromPartial(object.upperBound) - : undefined; - return message; - }, -}; - -function createBaseScanRange_Bound(): ScanRange_Bound { - return { value: new Uint8Array(), inclusive: false }; -} - -export const ScanRange_Bound = { - fromJSON(object: any): ScanRange_Bound { - return { - value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(), - inclusive: isSet(object.inclusive) ? Boolean(object.inclusive) : false, - }; - }, - - toJSON(message: ScanRange_Bound): unknown { - const obj: any = {}; - message.value !== undefined && - (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); - message.inclusive !== undefined && (obj.inclusive = message.inclusive); - return obj; - }, - - fromPartial, I>>(object: I): ScanRange_Bound { - const message = createBaseScanRange_Bound(); - message.value = object.value ?? new Uint8Array(); - message.inclusive = object.inclusive ?? false; - return message; - }, -}; - -function createBaseSourceNode(): SourceNode { - return { sourceId: 0, columns: [], properties: {}, split: new Uint8Array(), info: undefined }; -} - -export const SourceNode = { - fromJSON(object: any): SourceNode { - return { - sourceId: isSet(object.sourceId) ? Number(object.sourceId) : 0, - columns: Array.isArray(object?.columns) ? object.columns.map((e: any) => ColumnCatalog.fromJSON(e)) : [], - properties: isObject(object.properties) - ? Object.entries(object.properties).reduce<{ [key: string]: string }>((acc, [key, value]) => { - acc[key] = String(value); - return acc; - }, {}) - : {}, - split: isSet(object.split) ? bytesFromBase64(object.split) : new Uint8Array(), - info: isSet(object.info) ? StreamSourceInfo.fromJSON(object.info) : undefined, - }; - }, - - toJSON(message: SourceNode): unknown { - const obj: any = {}; - message.sourceId !== undefined && (obj.sourceId = Math.round(message.sourceId)); - if (message.columns) { - obj.columns = message.columns.map((e) => e ? ColumnCatalog.toJSON(e) : undefined); - } else { - obj.columns = []; - } - obj.properties = {}; - if (message.properties) { - Object.entries(message.properties).forEach(([k, v]) => { - obj.properties[k] = v; - }); - } - message.split !== undefined && - (obj.split = base64FromBytes(message.split !== undefined ? message.split : new Uint8Array())); - message.info !== undefined && (obj.info = message.info ? StreamSourceInfo.toJSON(message.info) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): SourceNode { - const message = createBaseSourceNode(); - message.sourceId = object.sourceId ?? 0; - message.columns = object.columns?.map((e) => ColumnCatalog.fromPartial(e)) || []; - message.properties = Object.entries(object.properties ?? {}).reduce<{ [key: string]: string }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[key] = String(value); - } - return acc; - }, - {}, - ); - message.split = object.split ?? new Uint8Array(); - message.info = (object.info !== undefined && object.info !== null) - ? StreamSourceInfo.fromPartial(object.info) - : undefined; - return message; - }, -}; - -function createBaseSourceNode_PropertiesEntry(): SourceNode_PropertiesEntry { - return { key: "", value: "" }; -} - -export const SourceNode_PropertiesEntry = { - fromJSON(object: any): SourceNode_PropertiesEntry { - return { key: isSet(object.key) ? String(object.key) : "", value: isSet(object.value) ? String(object.value) : "" }; - }, - - toJSON(message: SourceNode_PropertiesEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = message.key); - message.value !== undefined && (obj.value = message.value); - return obj; - }, - - fromPartial, I>>(object: I): SourceNode_PropertiesEntry { - const message = createBaseSourceNode_PropertiesEntry(); - message.key = object.key ?? ""; - message.value = object.value ?? ""; - return message; - }, -}; - -function createBaseProjectNode(): ProjectNode { - return { selectList: [] }; -} - -export const ProjectNode = { - fromJSON(object: any): ProjectNode { - return { - selectList: Array.isArray(object?.selectList) ? object.selectList.map((e: any) => ExprNode.fromJSON(e)) : [], - }; - }, - - toJSON(message: ProjectNode): unknown { - const obj: any = {}; - if (message.selectList) { - obj.selectList = message.selectList.map((e) => e ? ExprNode.toJSON(e) : undefined); - } else { - obj.selectList = []; - } - return obj; - }, - - fromPartial, I>>(object: I): ProjectNode { - const message = createBaseProjectNode(); - message.selectList = object.selectList?.map((e) => ExprNode.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseFilterNode(): FilterNode { - return { searchCondition: undefined }; -} - -export const FilterNode = { - fromJSON(object: any): FilterNode { - return { searchCondition: isSet(object.searchCondition) ? ExprNode.fromJSON(object.searchCondition) : undefined }; - }, - - toJSON(message: FilterNode): unknown { - const obj: any = {}; - message.searchCondition !== undefined && - (obj.searchCondition = message.searchCondition ? ExprNode.toJSON(message.searchCondition) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): FilterNode { - const message = createBaseFilterNode(); - message.searchCondition = (object.searchCondition !== undefined && object.searchCondition !== null) - ? ExprNode.fromPartial(object.searchCondition) - : undefined; - return message; - }, -}; - -function createBaseInsertNode(): InsertNode { - return { tableId: 0, tableVersionId: 0, columnIndices: [], rowIdIndex: undefined, returning: false }; -} - -export const InsertNode = { - fromJSON(object: any): InsertNode { - return { - tableId: isSet(object.tableId) ? Number(object.tableId) : 0, - tableVersionId: isSet(object.tableVersionId) ? Number(object.tableVersionId) : 0, - columnIndices: Array.isArray(object?.columnIndices) ? object.columnIndices.map((e: any) => Number(e)) : [], - rowIdIndex: isSet(object.rowIdIndex) ? Number(object.rowIdIndex) : undefined, - returning: isSet(object.returning) ? Boolean(object.returning) : false, - }; - }, - - toJSON(message: InsertNode): unknown { - const obj: any = {}; - message.tableId !== undefined && (obj.tableId = Math.round(message.tableId)); - message.tableVersionId !== undefined && (obj.tableVersionId = Math.round(message.tableVersionId)); - if (message.columnIndices) { - obj.columnIndices = message.columnIndices.map((e) => Math.round(e)); - } else { - obj.columnIndices = []; - } - message.rowIdIndex !== undefined && (obj.rowIdIndex = Math.round(message.rowIdIndex)); - message.returning !== undefined && (obj.returning = message.returning); - return obj; - }, - - fromPartial, I>>(object: I): InsertNode { - const message = createBaseInsertNode(); - message.tableId = object.tableId ?? 0; - message.tableVersionId = object.tableVersionId ?? 0; - message.columnIndices = object.columnIndices?.map((e) => e) || []; - message.rowIdIndex = object.rowIdIndex ?? undefined; - message.returning = object.returning ?? false; - return message; - }, -}; - -function createBaseDeleteNode(): DeleteNode { - return { tableId: 0, tableVersionId: 0, returning: false }; -} - -export const DeleteNode = { - fromJSON(object: any): DeleteNode { - return { - tableId: isSet(object.tableId) ? Number(object.tableId) : 0, - tableVersionId: isSet(object.tableVersionId) ? Number(object.tableVersionId) : 0, - returning: isSet(object.returning) ? Boolean(object.returning) : false, - }; - }, - - toJSON(message: DeleteNode): unknown { - const obj: any = {}; - message.tableId !== undefined && (obj.tableId = Math.round(message.tableId)); - message.tableVersionId !== undefined && (obj.tableVersionId = Math.round(message.tableVersionId)); - message.returning !== undefined && (obj.returning = message.returning); - return obj; - }, - - fromPartial, I>>(object: I): DeleteNode { - const message = createBaseDeleteNode(); - message.tableId = object.tableId ?? 0; - message.tableVersionId = object.tableVersionId ?? 0; - message.returning = object.returning ?? false; - return message; - }, -}; - -function createBaseUpdateNode(): UpdateNode { - return { tableId: 0, tableVersionId: 0, exprs: [], returning: false }; -} - -export const UpdateNode = { - fromJSON(object: any): UpdateNode { - return { - tableId: isSet(object.tableId) ? Number(object.tableId) : 0, - tableVersionId: isSet(object.tableVersionId) ? Number(object.tableVersionId) : 0, - exprs: Array.isArray(object?.exprs) ? object.exprs.map((e: any) => ExprNode.fromJSON(e)) : [], - returning: isSet(object.returning) ? Boolean(object.returning) : false, - }; - }, - - toJSON(message: UpdateNode): unknown { - const obj: any = {}; - message.tableId !== undefined && (obj.tableId = Math.round(message.tableId)); - message.tableVersionId !== undefined && (obj.tableVersionId = Math.round(message.tableVersionId)); - if (message.exprs) { - obj.exprs = message.exprs.map((e) => e ? ExprNode.toJSON(e) : undefined); - } else { - obj.exprs = []; - } - message.returning !== undefined && (obj.returning = message.returning); - return obj; - }, - - fromPartial, I>>(object: I): UpdateNode { - const message = createBaseUpdateNode(); - message.tableId = object.tableId ?? 0; - message.tableVersionId = object.tableVersionId ?? 0; - message.exprs = object.exprs?.map((e) => ExprNode.fromPartial(e)) || []; - message.returning = object.returning ?? false; - return message; - }, -}; - -function createBaseValuesNode(): ValuesNode { - return { tuples: [], fields: [] }; -} - -export const ValuesNode = { - fromJSON(object: any): ValuesNode { - return { - tuples: Array.isArray(object?.tuples) ? object.tuples.map((e: any) => ValuesNode_ExprTuple.fromJSON(e)) : [], - fields: Array.isArray(object?.fields) ? object.fields.map((e: any) => Field.fromJSON(e)) : [], - }; - }, - - toJSON(message: ValuesNode): unknown { - const obj: any = {}; - if (message.tuples) { - obj.tuples = message.tuples.map((e) => e ? ValuesNode_ExprTuple.toJSON(e) : undefined); - } else { - obj.tuples = []; - } - if (message.fields) { - obj.fields = message.fields.map((e) => e ? Field.toJSON(e) : undefined); - } else { - obj.fields = []; - } - return obj; - }, - - fromPartial, I>>(object: I): ValuesNode { - const message = createBaseValuesNode(); - message.tuples = object.tuples?.map((e) => ValuesNode_ExprTuple.fromPartial(e)) || []; - message.fields = object.fields?.map((e) => Field.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseValuesNode_ExprTuple(): ValuesNode_ExprTuple { - return { cells: [] }; -} - -export const ValuesNode_ExprTuple = { - fromJSON(object: any): ValuesNode_ExprTuple { - return { cells: Array.isArray(object?.cells) ? object.cells.map((e: any) => ExprNode.fromJSON(e)) : [] }; - }, - - toJSON(message: ValuesNode_ExprTuple): unknown { - const obj: any = {}; - if (message.cells) { - obj.cells = message.cells.map((e) => e ? ExprNode.toJSON(e) : undefined); - } else { - obj.cells = []; - } - return obj; - }, - - fromPartial, I>>(object: I): ValuesNode_ExprTuple { - const message = createBaseValuesNode_ExprTuple(); - message.cells = object.cells?.map((e) => ExprNode.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseSortNode(): SortNode { - return { columnOrders: [] }; -} - -export const SortNode = { - fromJSON(object: any): SortNode { - return { - columnOrders: Array.isArray(object?.columnOrders) - ? object.columnOrders.map((e: any) => ColumnOrder.fromJSON(e)) - : [], - }; - }, - - toJSON(message: SortNode): unknown { - const obj: any = {}; - if (message.columnOrders) { - obj.columnOrders = message.columnOrders.map((e) => e ? ColumnOrder.toJSON(e) : undefined); - } else { - obj.columnOrders = []; - } - return obj; - }, - - fromPartial, I>>(object: I): SortNode { - const message = createBaseSortNode(); - message.columnOrders = object.columnOrders?.map((e) => ColumnOrder.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseTopNNode(): TopNNode { - return { columnOrders: [], limit: 0, offset: 0, withTies: false }; -} - -export const TopNNode = { - fromJSON(object: any): TopNNode { - return { - columnOrders: Array.isArray(object?.columnOrders) - ? object.columnOrders.map((e: any) => ColumnOrder.fromJSON(e)) - : [], - limit: isSet(object.limit) ? Number(object.limit) : 0, - offset: isSet(object.offset) ? Number(object.offset) : 0, - withTies: isSet(object.withTies) ? Boolean(object.withTies) : false, - }; - }, - - toJSON(message: TopNNode): unknown { - const obj: any = {}; - if (message.columnOrders) { - obj.columnOrders = message.columnOrders.map((e) => e ? ColumnOrder.toJSON(e) : undefined); - } else { - obj.columnOrders = []; - } - message.limit !== undefined && (obj.limit = Math.round(message.limit)); - message.offset !== undefined && (obj.offset = Math.round(message.offset)); - message.withTies !== undefined && (obj.withTies = message.withTies); - return obj; - }, - - fromPartial, I>>(object: I): TopNNode { - const message = createBaseTopNNode(); - message.columnOrders = object.columnOrders?.map((e) => ColumnOrder.fromPartial(e)) || []; - message.limit = object.limit ?? 0; - message.offset = object.offset ?? 0; - message.withTies = object.withTies ?? false; - return message; - }, -}; - -function createBaseGroupTopNNode(): GroupTopNNode { - return { columnOrders: [], limit: 0, offset: 0, groupKey: [], withTies: false }; -} - -export const GroupTopNNode = { - fromJSON(object: any): GroupTopNNode { - return { - columnOrders: Array.isArray(object?.columnOrders) - ? object.columnOrders.map((e: any) => ColumnOrder.fromJSON(e)) - : [], - limit: isSet(object.limit) ? Number(object.limit) : 0, - offset: isSet(object.offset) ? Number(object.offset) : 0, - groupKey: Array.isArray(object?.groupKey) - ? object.groupKey.map((e: any) => Number(e)) - : [], - withTies: isSet(object.withTies) ? Boolean(object.withTies) : false, - }; - }, - - toJSON(message: GroupTopNNode): unknown { - const obj: any = {}; - if (message.columnOrders) { - obj.columnOrders = message.columnOrders.map((e) => e ? ColumnOrder.toJSON(e) : undefined); - } else { - obj.columnOrders = []; - } - message.limit !== undefined && (obj.limit = Math.round(message.limit)); - message.offset !== undefined && (obj.offset = Math.round(message.offset)); - if (message.groupKey) { - obj.groupKey = message.groupKey.map((e) => Math.round(e)); - } else { - obj.groupKey = []; - } - message.withTies !== undefined && (obj.withTies = message.withTies); - return obj; - }, - - fromPartial, I>>(object: I): GroupTopNNode { - const message = createBaseGroupTopNNode(); - message.columnOrders = object.columnOrders?.map((e) => ColumnOrder.fromPartial(e)) || []; - message.limit = object.limit ?? 0; - message.offset = object.offset ?? 0; - message.groupKey = object.groupKey?.map((e) => e) || []; - message.withTies = object.withTies ?? false; - return message; - }, -}; - -function createBaseLimitNode(): LimitNode { - return { limit: 0, offset: 0 }; -} - -export const LimitNode = { - fromJSON(object: any): LimitNode { - return { - limit: isSet(object.limit) ? Number(object.limit) : 0, - offset: isSet(object.offset) ? Number(object.offset) : 0, - }; - }, - - toJSON(message: LimitNode): unknown { - const obj: any = {}; - message.limit !== undefined && (obj.limit = Math.round(message.limit)); - message.offset !== undefined && (obj.offset = Math.round(message.offset)); - return obj; - }, - - fromPartial, I>>(object: I): LimitNode { - const message = createBaseLimitNode(); - message.limit = object.limit ?? 0; - message.offset = object.offset ?? 0; - return message; - }, -}; - -function createBaseNestedLoopJoinNode(): NestedLoopJoinNode { - return { joinType: JoinType.UNSPECIFIED, joinCond: undefined, outputIndices: [] }; -} - -export const NestedLoopJoinNode = { - fromJSON(object: any): NestedLoopJoinNode { - return { - joinType: isSet(object.joinType) ? joinTypeFromJSON(object.joinType) : JoinType.UNSPECIFIED, - joinCond: isSet(object.joinCond) ? ExprNode.fromJSON(object.joinCond) : undefined, - outputIndices: Array.isArray(object?.outputIndices) ? object.outputIndices.map((e: any) => Number(e)) : [], - }; - }, - - toJSON(message: NestedLoopJoinNode): unknown { - const obj: any = {}; - message.joinType !== undefined && (obj.joinType = joinTypeToJSON(message.joinType)); - message.joinCond !== undefined && (obj.joinCond = message.joinCond ? ExprNode.toJSON(message.joinCond) : undefined); - if (message.outputIndices) { - obj.outputIndices = message.outputIndices.map((e) => Math.round(e)); - } else { - obj.outputIndices = []; - } - return obj; - }, - - fromPartial, I>>(object: I): NestedLoopJoinNode { - const message = createBaseNestedLoopJoinNode(); - message.joinType = object.joinType ?? JoinType.UNSPECIFIED; - message.joinCond = (object.joinCond !== undefined && object.joinCond !== null) - ? ExprNode.fromPartial(object.joinCond) - : undefined; - message.outputIndices = object.outputIndices?.map((e) => e) || []; - return message; - }, -}; - -function createBaseHashAggNode(): HashAggNode { - return { groupKey: [], aggCalls: [] }; -} - -export const HashAggNode = { - fromJSON(object: any): HashAggNode { - return { - groupKey: Array.isArray(object?.groupKey) ? object.groupKey.map((e: any) => Number(e)) : [], - aggCalls: Array.isArray(object?.aggCalls) ? object.aggCalls.map((e: any) => AggCall.fromJSON(e)) : [], - }; - }, - - toJSON(message: HashAggNode): unknown { - const obj: any = {}; - if (message.groupKey) { - obj.groupKey = message.groupKey.map((e) => Math.round(e)); - } else { - obj.groupKey = []; - } - if (message.aggCalls) { - obj.aggCalls = message.aggCalls.map((e) => e ? AggCall.toJSON(e) : undefined); - } else { - obj.aggCalls = []; - } - return obj; - }, - - fromPartial, I>>(object: I): HashAggNode { - const message = createBaseHashAggNode(); - message.groupKey = object.groupKey?.map((e) => e) || []; - message.aggCalls = object.aggCalls?.map((e) => AggCall.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseExpandNode(): ExpandNode { - return { columnSubsets: [] }; -} - -export const ExpandNode = { - fromJSON(object: any): ExpandNode { - return { - columnSubsets: Array.isArray(object?.columnSubsets) - ? object.columnSubsets.map((e: any) => ExpandNode_Subset.fromJSON(e)) - : [], - }; - }, - - toJSON(message: ExpandNode): unknown { - const obj: any = {}; - if (message.columnSubsets) { - obj.columnSubsets = message.columnSubsets.map((e) => e ? ExpandNode_Subset.toJSON(e) : undefined); - } else { - obj.columnSubsets = []; - } - return obj; - }, - - fromPartial, I>>(object: I): ExpandNode { - const message = createBaseExpandNode(); - message.columnSubsets = object.columnSubsets?.map((e) => ExpandNode_Subset.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseExpandNode_Subset(): ExpandNode_Subset { - return { columnIndices: [] }; -} - -export const ExpandNode_Subset = { - fromJSON(object: any): ExpandNode_Subset { - return { - columnIndices: Array.isArray(object?.columnIndices) ? object.columnIndices.map((e: any) => Number(e)) : [], - }; - }, - - toJSON(message: ExpandNode_Subset): unknown { - const obj: any = {}; - if (message.columnIndices) { - obj.columnIndices = message.columnIndices.map((e) => Math.round(e)); - } else { - obj.columnIndices = []; - } - return obj; - }, - - fromPartial, I>>(object: I): ExpandNode_Subset { - const message = createBaseExpandNode_Subset(); - message.columnIndices = object.columnIndices?.map((e) => e) || []; - return message; - }, -}; - -function createBaseProjectSetNode(): ProjectSetNode { - return { selectList: [] }; -} - -export const ProjectSetNode = { - fromJSON(object: any): ProjectSetNode { - return { - selectList: Array.isArray(object?.selectList) - ? object.selectList.map((e: any) => ProjectSetSelectItem.fromJSON(e)) - : [], - }; - }, - - toJSON(message: ProjectSetNode): unknown { - const obj: any = {}; - if (message.selectList) { - obj.selectList = message.selectList.map((e) => e ? ProjectSetSelectItem.toJSON(e) : undefined); - } else { - obj.selectList = []; - } - return obj; - }, - - fromPartial, I>>(object: I): ProjectSetNode { - const message = createBaseProjectSetNode(); - message.selectList = object.selectList?.map((e) => ProjectSetSelectItem.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseSortAggNode(): SortAggNode { - return { groupKey: [], aggCalls: [] }; -} - -export const SortAggNode = { - fromJSON(object: any): SortAggNode { - return { - groupKey: Array.isArray(object?.groupKey) ? object.groupKey.map((e: any) => ExprNode.fromJSON(e)) : [], - aggCalls: Array.isArray(object?.aggCalls) ? object.aggCalls.map((e: any) => AggCall.fromJSON(e)) : [], - }; - }, - - toJSON(message: SortAggNode): unknown { - const obj: any = {}; - if (message.groupKey) { - obj.groupKey = message.groupKey.map((e) => e ? ExprNode.toJSON(e) : undefined); - } else { - obj.groupKey = []; - } - if (message.aggCalls) { - obj.aggCalls = message.aggCalls.map((e) => e ? AggCall.toJSON(e) : undefined); - } else { - obj.aggCalls = []; - } - return obj; - }, - - fromPartial, I>>(object: I): SortAggNode { - const message = createBaseSortAggNode(); - message.groupKey = object.groupKey?.map((e) => ExprNode.fromPartial(e)) || []; - message.aggCalls = object.aggCalls?.map((e) => AggCall.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseHashJoinNode(): HashJoinNode { - return { - joinType: JoinType.UNSPECIFIED, - leftKey: [], - rightKey: [], - condition: undefined, - outputIndices: [], - nullSafe: [], - }; -} - -export const HashJoinNode = { - fromJSON(object: any): HashJoinNode { - return { - joinType: isSet(object.joinType) ? joinTypeFromJSON(object.joinType) : JoinType.UNSPECIFIED, - leftKey: Array.isArray(object?.leftKey) ? object.leftKey.map((e: any) => Number(e)) : [], - rightKey: Array.isArray(object?.rightKey) ? object.rightKey.map((e: any) => Number(e)) : [], - condition: isSet(object.condition) ? ExprNode.fromJSON(object.condition) : undefined, - outputIndices: Array.isArray(object?.outputIndices) ? object.outputIndices.map((e: any) => Number(e)) : [], - nullSafe: Array.isArray(object?.nullSafe) ? object.nullSafe.map((e: any) => Boolean(e)) : [], - }; - }, - - toJSON(message: HashJoinNode): unknown { - const obj: any = {}; - message.joinType !== undefined && (obj.joinType = joinTypeToJSON(message.joinType)); - if (message.leftKey) { - obj.leftKey = message.leftKey.map((e) => Math.round(e)); - } else { - obj.leftKey = []; - } - if (message.rightKey) { - obj.rightKey = message.rightKey.map((e) => Math.round(e)); - } else { - obj.rightKey = []; - } - message.condition !== undefined && - (obj.condition = message.condition ? ExprNode.toJSON(message.condition) : undefined); - if (message.outputIndices) { - obj.outputIndices = message.outputIndices.map((e) => Math.round(e)); - } else { - obj.outputIndices = []; - } - if (message.nullSafe) { - obj.nullSafe = message.nullSafe.map((e) => e); - } else { - obj.nullSafe = []; - } - return obj; - }, - - fromPartial, I>>(object: I): HashJoinNode { - const message = createBaseHashJoinNode(); - message.joinType = object.joinType ?? JoinType.UNSPECIFIED; - message.leftKey = object.leftKey?.map((e) => e) || []; - message.rightKey = object.rightKey?.map((e) => e) || []; - message.condition = (object.condition !== undefined && object.condition !== null) - ? ExprNode.fromPartial(object.condition) - : undefined; - message.outputIndices = object.outputIndices?.map((e) => e) || []; - message.nullSafe = object.nullSafe?.map((e) => e) || []; - return message; - }, -}; - -function createBaseSortMergeJoinNode(): SortMergeJoinNode { - return { - joinType: JoinType.UNSPECIFIED, - leftKey: [], - rightKey: [], - direction: Direction.DIRECTION_UNSPECIFIED, - outputIndices: [], - }; -} - -export const SortMergeJoinNode = { - fromJSON(object: any): SortMergeJoinNode { - return { - joinType: isSet(object.joinType) ? joinTypeFromJSON(object.joinType) : JoinType.UNSPECIFIED, - leftKey: Array.isArray(object?.leftKey) ? object.leftKey.map((e: any) => Number(e)) : [], - rightKey: Array.isArray(object?.rightKey) ? object.rightKey.map((e: any) => Number(e)) : [], - direction: isSet(object.direction) ? directionFromJSON(object.direction) : Direction.DIRECTION_UNSPECIFIED, - outputIndices: Array.isArray(object?.outputIndices) ? object.outputIndices.map((e: any) => Number(e)) : [], - }; - }, - - toJSON(message: SortMergeJoinNode): unknown { - const obj: any = {}; - message.joinType !== undefined && (obj.joinType = joinTypeToJSON(message.joinType)); - if (message.leftKey) { - obj.leftKey = message.leftKey.map((e) => Math.round(e)); - } else { - obj.leftKey = []; - } - if (message.rightKey) { - obj.rightKey = message.rightKey.map((e) => Math.round(e)); - } else { - obj.rightKey = []; - } - message.direction !== undefined && (obj.direction = directionToJSON(message.direction)); - if (message.outputIndices) { - obj.outputIndices = message.outputIndices.map((e) => Math.round(e)); - } else { - obj.outputIndices = []; - } - return obj; - }, - - fromPartial, I>>(object: I): SortMergeJoinNode { - const message = createBaseSortMergeJoinNode(); - message.joinType = object.joinType ?? JoinType.UNSPECIFIED; - message.leftKey = object.leftKey?.map((e) => e) || []; - message.rightKey = object.rightKey?.map((e) => e) || []; - message.direction = object.direction ?? Direction.DIRECTION_UNSPECIFIED; - message.outputIndices = object.outputIndices?.map((e) => e) || []; - return message; - }, -}; - -function createBaseHopWindowNode(): HopWindowNode { - return { - timeCol: 0, - windowSlide: undefined, - windowSize: undefined, - outputIndices: [], - windowStartExprs: [], - windowEndExprs: [], - }; -} - -export const HopWindowNode = { - fromJSON(object: any): HopWindowNode { - return { - timeCol: isSet(object.timeCol) ? Number(object.timeCol) : 0, - windowSlide: isSet(object.windowSlide) ? IntervalUnit.fromJSON(object.windowSlide) : undefined, - windowSize: isSet(object.windowSize) ? IntervalUnit.fromJSON(object.windowSize) : undefined, - outputIndices: Array.isArray(object?.outputIndices) ? object.outputIndices.map((e: any) => Number(e)) : [], - windowStartExprs: Array.isArray(object?.windowStartExprs) - ? object.windowStartExprs.map((e: any) => ExprNode.fromJSON(e)) - : [], - windowEndExprs: Array.isArray(object?.windowEndExprs) - ? object.windowEndExprs.map((e: any) => ExprNode.fromJSON(e)) - : [], - }; - }, - - toJSON(message: HopWindowNode): unknown { - const obj: any = {}; - message.timeCol !== undefined && (obj.timeCol = Math.round(message.timeCol)); - message.windowSlide !== undefined && - (obj.windowSlide = message.windowSlide ? IntervalUnit.toJSON(message.windowSlide) : undefined); - message.windowSize !== undefined && - (obj.windowSize = message.windowSize ? IntervalUnit.toJSON(message.windowSize) : undefined); - if (message.outputIndices) { - obj.outputIndices = message.outputIndices.map((e) => Math.round(e)); - } else { - obj.outputIndices = []; - } - if (message.windowStartExprs) { - obj.windowStartExprs = message.windowStartExprs.map((e) => e ? ExprNode.toJSON(e) : undefined); - } else { - obj.windowStartExprs = []; - } - if (message.windowEndExprs) { - obj.windowEndExprs = message.windowEndExprs.map((e) => e ? ExprNode.toJSON(e) : undefined); - } else { - obj.windowEndExprs = []; - } - return obj; - }, - - fromPartial, I>>(object: I): HopWindowNode { - const message = createBaseHopWindowNode(); - message.timeCol = object.timeCol ?? 0; - message.windowSlide = (object.windowSlide !== undefined && object.windowSlide !== null) - ? IntervalUnit.fromPartial(object.windowSlide) - : undefined; - message.windowSize = (object.windowSize !== undefined && object.windowSize !== null) - ? IntervalUnit.fromPartial(object.windowSize) - : undefined; - message.outputIndices = object.outputIndices?.map((e) => e) || []; - message.windowStartExprs = object.windowStartExprs?.map((e) => ExprNode.fromPartial(e)) || []; - message.windowEndExprs = object.windowEndExprs?.map((e) => ExprNode.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseTableFunctionNode(): TableFunctionNode { - return { tableFunction: undefined }; -} - -export const TableFunctionNode = { - fromJSON(object: any): TableFunctionNode { - return { tableFunction: isSet(object.tableFunction) ? TableFunction.fromJSON(object.tableFunction) : undefined }; - }, - - toJSON(message: TableFunctionNode): unknown { - const obj: any = {}; - message.tableFunction !== undefined && - (obj.tableFunction = message.tableFunction ? TableFunction.toJSON(message.tableFunction) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): TableFunctionNode { - const message = createBaseTableFunctionNode(); - message.tableFunction = (object.tableFunction !== undefined && object.tableFunction !== null) - ? TableFunction.fromPartial(object.tableFunction) - : undefined; - return message; - }, -}; - -function createBaseTaskId(): TaskId { - return { queryId: "", stageId: 0, taskId: 0 }; -} - -export const TaskId = { - fromJSON(object: any): TaskId { - return { - queryId: isSet(object.queryId) ? String(object.queryId) : "", - stageId: isSet(object.stageId) ? Number(object.stageId) : 0, - taskId: isSet(object.taskId) ? Number(object.taskId) : 0, - }; - }, - - toJSON(message: TaskId): unknown { - const obj: any = {}; - message.queryId !== undefined && (obj.queryId = message.queryId); - message.stageId !== undefined && (obj.stageId = Math.round(message.stageId)); - message.taskId !== undefined && (obj.taskId = Math.round(message.taskId)); - return obj; - }, - - fromPartial, I>>(object: I): TaskId { - const message = createBaseTaskId(); - message.queryId = object.queryId ?? ""; - message.stageId = object.stageId ?? 0; - message.taskId = object.taskId ?? 0; - return message; - }, -}; - -function createBaseTaskOutputId(): TaskOutputId { - return { taskId: undefined, outputId: 0 }; -} - -export const TaskOutputId = { - fromJSON(object: any): TaskOutputId { - return { - taskId: isSet(object.taskId) ? TaskId.fromJSON(object.taskId) : undefined, - outputId: isSet(object.outputId) ? Number(object.outputId) : 0, - }; - }, - - toJSON(message: TaskOutputId): unknown { - const obj: any = {}; - message.taskId !== undefined && (obj.taskId = message.taskId ? TaskId.toJSON(message.taskId) : undefined); - message.outputId !== undefined && (obj.outputId = Math.round(message.outputId)); - return obj; - }, - - fromPartial, I>>(object: I): TaskOutputId { - const message = createBaseTaskOutputId(); - message.taskId = (object.taskId !== undefined && object.taskId !== null) - ? TaskId.fromPartial(object.taskId) - : undefined; - message.outputId = object.outputId ?? 0; - return message; - }, -}; - -function createBaseLocalExecutePlan(): LocalExecutePlan { - return { plan: undefined, epoch: undefined }; -} - -export const LocalExecutePlan = { - fromJSON(object: any): LocalExecutePlan { - return { - plan: isSet(object.plan) ? PlanFragment.fromJSON(object.plan) : undefined, - epoch: isSet(object.epoch) ? BatchQueryEpoch.fromJSON(object.epoch) : undefined, - }; - }, - - toJSON(message: LocalExecutePlan): unknown { - const obj: any = {}; - message.plan !== undefined && (obj.plan = message.plan ? PlanFragment.toJSON(message.plan) : undefined); - message.epoch !== undefined && (obj.epoch = message.epoch ? BatchQueryEpoch.toJSON(message.epoch) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): LocalExecutePlan { - const message = createBaseLocalExecutePlan(); - message.plan = (object.plan !== undefined && object.plan !== null) - ? PlanFragment.fromPartial(object.plan) - : undefined; - message.epoch = (object.epoch !== undefined && object.epoch !== null) - ? BatchQueryEpoch.fromPartial(object.epoch) - : undefined; - return message; - }, -}; - -function createBaseExchangeSource(): ExchangeSource { - return { taskOutputId: undefined, host: undefined, localExecutePlan: undefined }; -} - -export const ExchangeSource = { - fromJSON(object: any): ExchangeSource { - return { - taskOutputId: isSet(object.taskOutputId) ? TaskOutputId.fromJSON(object.taskOutputId) : undefined, - host: isSet(object.host) ? HostAddress.fromJSON(object.host) : undefined, - localExecutePlan: isSet(object.plan) - ? { $case: "plan", plan: LocalExecutePlan.fromJSON(object.plan) } - : undefined, - }; - }, - - toJSON(message: ExchangeSource): unknown { - const obj: any = {}; - message.taskOutputId !== undefined && - (obj.taskOutputId = message.taskOutputId ? TaskOutputId.toJSON(message.taskOutputId) : undefined); - message.host !== undefined && (obj.host = message.host ? HostAddress.toJSON(message.host) : undefined); - message.localExecutePlan?.$case === "plan" && - (obj.plan = message.localExecutePlan?.plan ? LocalExecutePlan.toJSON(message.localExecutePlan?.plan) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): ExchangeSource { - const message = createBaseExchangeSource(); - message.taskOutputId = (object.taskOutputId !== undefined && object.taskOutputId !== null) - ? TaskOutputId.fromPartial(object.taskOutputId) - : undefined; - message.host = (object.host !== undefined && object.host !== null) - ? HostAddress.fromPartial(object.host) - : undefined; - if ( - object.localExecutePlan?.$case === "plan" && - object.localExecutePlan?.plan !== undefined && - object.localExecutePlan?.plan !== null - ) { - message.localExecutePlan = { $case: "plan", plan: LocalExecutePlan.fromPartial(object.localExecutePlan.plan) }; - } - return message; - }, -}; - -function createBaseExchangeNode(): ExchangeNode { - return { sources: [], inputSchema: [] }; -} - -export const ExchangeNode = { - fromJSON(object: any): ExchangeNode { - return { - sources: Array.isArray(object?.sources) ? object.sources.map((e: any) => ExchangeSource.fromJSON(e)) : [], - inputSchema: Array.isArray(object?.inputSchema) ? object.inputSchema.map((e: any) => Field.fromJSON(e)) : [], - }; - }, - - toJSON(message: ExchangeNode): unknown { - const obj: any = {}; - if (message.sources) { - obj.sources = message.sources.map((e) => e ? ExchangeSource.toJSON(e) : undefined); - } else { - obj.sources = []; - } - if (message.inputSchema) { - obj.inputSchema = message.inputSchema.map((e) => e ? Field.toJSON(e) : undefined); - } else { - obj.inputSchema = []; - } - return obj; - }, - - fromPartial, I>>(object: I): ExchangeNode { - const message = createBaseExchangeNode(); - message.sources = object.sources?.map((e) => ExchangeSource.fromPartial(e)) || []; - message.inputSchema = object.inputSchema?.map((e) => Field.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseMergeSortExchangeNode(): MergeSortExchangeNode { - return { exchange: undefined, columnOrders: [] }; -} - -export const MergeSortExchangeNode = { - fromJSON(object: any): MergeSortExchangeNode { - return { - exchange: isSet(object.exchange) ? ExchangeNode.fromJSON(object.exchange) : undefined, - columnOrders: Array.isArray(object?.columnOrders) - ? object.columnOrders.map((e: any) => ColumnOrder.fromJSON(e)) - : [], - }; - }, - - toJSON(message: MergeSortExchangeNode): unknown { - const obj: any = {}; - message.exchange !== undefined && - (obj.exchange = message.exchange ? ExchangeNode.toJSON(message.exchange) : undefined); - if (message.columnOrders) { - obj.columnOrders = message.columnOrders.map((e) => e ? ColumnOrder.toJSON(e) : undefined); - } else { - obj.columnOrders = []; - } - return obj; - }, - - fromPartial, I>>(object: I): MergeSortExchangeNode { - const message = createBaseMergeSortExchangeNode(); - message.exchange = (object.exchange !== undefined && object.exchange !== null) - ? ExchangeNode.fromPartial(object.exchange) - : undefined; - message.columnOrders = object.columnOrders?.map((e) => ColumnOrder.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseLocalLookupJoinNode(): LocalLookupJoinNode { - return { - joinType: JoinType.UNSPECIFIED, - condition: undefined, - outerSideKey: [], - innerSideKey: [], - lookupPrefixLen: 0, - innerSideTableDesc: undefined, - innerSideVnodeMapping: [], - innerSideColumnIds: [], - outputIndices: [], - workerNodes: [], - nullSafe: [], - }; -} - -export const LocalLookupJoinNode = { - fromJSON(object: any): LocalLookupJoinNode { - return { - joinType: isSet(object.joinType) ? joinTypeFromJSON(object.joinType) : JoinType.UNSPECIFIED, - condition: isSet(object.condition) ? ExprNode.fromJSON(object.condition) : undefined, - outerSideKey: Array.isArray(object?.outerSideKey) ? object.outerSideKey.map((e: any) => Number(e)) : [], - innerSideKey: Array.isArray(object?.innerSideKey) ? object.innerSideKey.map((e: any) => Number(e)) : [], - lookupPrefixLen: isSet(object.lookupPrefixLen) ? Number(object.lookupPrefixLen) : 0, - innerSideTableDesc: isSet(object.innerSideTableDesc) - ? StorageTableDesc.fromJSON(object.innerSideTableDesc) - : undefined, - innerSideVnodeMapping: Array.isArray(object?.innerSideVnodeMapping) - ? object.innerSideVnodeMapping.map((e: any) => Number(e)) - : [], - innerSideColumnIds: Array.isArray(object?.innerSideColumnIds) - ? object.innerSideColumnIds.map((e: any) => Number(e)) - : [], - outputIndices: Array.isArray(object?.outputIndices) - ? object.outputIndices.map((e: any) => Number(e)) - : [], - workerNodes: Array.isArray(object?.workerNodes) ? object.workerNodes.map((e: any) => WorkerNode.fromJSON(e)) : [], - nullSafe: Array.isArray(object?.nullSafe) ? object.nullSafe.map((e: any) => Boolean(e)) : [], - }; - }, - - toJSON(message: LocalLookupJoinNode): unknown { - const obj: any = {}; - message.joinType !== undefined && (obj.joinType = joinTypeToJSON(message.joinType)); - message.condition !== undefined && - (obj.condition = message.condition ? ExprNode.toJSON(message.condition) : undefined); - if (message.outerSideKey) { - obj.outerSideKey = message.outerSideKey.map((e) => Math.round(e)); - } else { - obj.outerSideKey = []; - } - if (message.innerSideKey) { - obj.innerSideKey = message.innerSideKey.map((e) => Math.round(e)); - } else { - obj.innerSideKey = []; - } - message.lookupPrefixLen !== undefined && (obj.lookupPrefixLen = Math.round(message.lookupPrefixLen)); - message.innerSideTableDesc !== undefined && (obj.innerSideTableDesc = message.innerSideTableDesc - ? StorageTableDesc.toJSON(message.innerSideTableDesc) - : undefined); - if (message.innerSideVnodeMapping) { - obj.innerSideVnodeMapping = message.innerSideVnodeMapping.map((e) => Math.round(e)); - } else { - obj.innerSideVnodeMapping = []; - } - if (message.innerSideColumnIds) { - obj.innerSideColumnIds = message.innerSideColumnIds.map((e) => Math.round(e)); - } else { - obj.innerSideColumnIds = []; - } - if (message.outputIndices) { - obj.outputIndices = message.outputIndices.map((e) => Math.round(e)); - } else { - obj.outputIndices = []; - } - if (message.workerNodes) { - obj.workerNodes = message.workerNodes.map((e) => e ? WorkerNode.toJSON(e) : undefined); - } else { - obj.workerNodes = []; - } - if (message.nullSafe) { - obj.nullSafe = message.nullSafe.map((e) => e); - } else { - obj.nullSafe = []; - } - return obj; - }, - - fromPartial, I>>(object: I): LocalLookupJoinNode { - const message = createBaseLocalLookupJoinNode(); - message.joinType = object.joinType ?? JoinType.UNSPECIFIED; - message.condition = (object.condition !== undefined && object.condition !== null) - ? ExprNode.fromPartial(object.condition) - : undefined; - message.outerSideKey = object.outerSideKey?.map((e) => e) || []; - message.innerSideKey = object.innerSideKey?.map((e) => e) || []; - message.lookupPrefixLen = object.lookupPrefixLen ?? 0; - message.innerSideTableDesc = (object.innerSideTableDesc !== undefined && object.innerSideTableDesc !== null) - ? StorageTableDesc.fromPartial(object.innerSideTableDesc) - : undefined; - message.innerSideVnodeMapping = object.innerSideVnodeMapping?.map((e) => e) || []; - message.innerSideColumnIds = object.innerSideColumnIds?.map((e) => e) || []; - message.outputIndices = object.outputIndices?.map((e) => e) || []; - message.workerNodes = object.workerNodes?.map((e) => WorkerNode.fromPartial(e)) || []; - message.nullSafe = object.nullSafe?.map((e) => e) || []; - return message; - }, -}; - -function createBaseDistributedLookupJoinNode(): DistributedLookupJoinNode { - return { - joinType: JoinType.UNSPECIFIED, - condition: undefined, - outerSideKey: [], - innerSideKey: [], - lookupPrefixLen: 0, - innerSideTableDesc: undefined, - innerSideColumnIds: [], - outputIndices: [], - nullSafe: [], - }; -} - -export const DistributedLookupJoinNode = { - fromJSON(object: any): DistributedLookupJoinNode { - return { - joinType: isSet(object.joinType) ? joinTypeFromJSON(object.joinType) : JoinType.UNSPECIFIED, - condition: isSet(object.condition) ? ExprNode.fromJSON(object.condition) : undefined, - outerSideKey: Array.isArray(object?.outerSideKey) ? object.outerSideKey.map((e: any) => Number(e)) : [], - innerSideKey: Array.isArray(object?.innerSideKey) ? object.innerSideKey.map((e: any) => Number(e)) : [], - lookupPrefixLen: isSet(object.lookupPrefixLen) ? Number(object.lookupPrefixLen) : 0, - innerSideTableDesc: isSet(object.innerSideTableDesc) - ? StorageTableDesc.fromJSON(object.innerSideTableDesc) - : undefined, - innerSideColumnIds: Array.isArray(object?.innerSideColumnIds) - ? object.innerSideColumnIds.map((e: any) => Number(e)) - : [], - outputIndices: Array.isArray(object?.outputIndices) ? object.outputIndices.map((e: any) => Number(e)) : [], - nullSafe: Array.isArray(object?.nullSafe) ? object.nullSafe.map((e: any) => Boolean(e)) : [], - }; - }, - - toJSON(message: DistributedLookupJoinNode): unknown { - const obj: any = {}; - message.joinType !== undefined && (obj.joinType = joinTypeToJSON(message.joinType)); - message.condition !== undefined && - (obj.condition = message.condition ? ExprNode.toJSON(message.condition) : undefined); - if (message.outerSideKey) { - obj.outerSideKey = message.outerSideKey.map((e) => Math.round(e)); - } else { - obj.outerSideKey = []; - } - if (message.innerSideKey) { - obj.innerSideKey = message.innerSideKey.map((e) => Math.round(e)); - } else { - obj.innerSideKey = []; - } - message.lookupPrefixLen !== undefined && (obj.lookupPrefixLen = Math.round(message.lookupPrefixLen)); - message.innerSideTableDesc !== undefined && (obj.innerSideTableDesc = message.innerSideTableDesc - ? StorageTableDesc.toJSON(message.innerSideTableDesc) - : undefined); - if (message.innerSideColumnIds) { - obj.innerSideColumnIds = message.innerSideColumnIds.map((e) => Math.round(e)); - } else { - obj.innerSideColumnIds = []; - } - if (message.outputIndices) { - obj.outputIndices = message.outputIndices.map((e) => Math.round(e)); - } else { - obj.outputIndices = []; - } - if (message.nullSafe) { - obj.nullSafe = message.nullSafe.map((e) => e); - } else { - obj.nullSafe = []; - } - return obj; - }, - - fromPartial, I>>(object: I): DistributedLookupJoinNode { - const message = createBaseDistributedLookupJoinNode(); - message.joinType = object.joinType ?? JoinType.UNSPECIFIED; - message.condition = (object.condition !== undefined && object.condition !== null) - ? ExprNode.fromPartial(object.condition) - : undefined; - message.outerSideKey = object.outerSideKey?.map((e) => e) || []; - message.innerSideKey = object.innerSideKey?.map((e) => e) || []; - message.lookupPrefixLen = object.lookupPrefixLen ?? 0; - message.innerSideTableDesc = (object.innerSideTableDesc !== undefined && object.innerSideTableDesc !== null) - ? StorageTableDesc.fromPartial(object.innerSideTableDesc) - : undefined; - message.innerSideColumnIds = object.innerSideColumnIds?.map((e) => e) || []; - message.outputIndices = object.outputIndices?.map((e) => e) || []; - message.nullSafe = object.nullSafe?.map((e) => e) || []; - return message; - }, -}; - -function createBaseUnionNode(): UnionNode { - return {}; -} - -export const UnionNode = { - fromJSON(_: any): UnionNode { - return {}; - }, - - toJSON(_: UnionNode): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): UnionNode { - const message = createBaseUnionNode(); - return message; - }, -}; - -function createBasePlanNode(): PlanNode { - return { children: [], nodeBody: undefined, identity: "" }; -} - -export const PlanNode = { - fromJSON(object: any): PlanNode { - return { - children: Array.isArray(object?.children) ? object.children.map((e: any) => PlanNode.fromJSON(e)) : [], - nodeBody: isSet(object.insert) - ? { $case: "insert", insert: InsertNode.fromJSON(object.insert) } - : isSet(object.delete) - ? { $case: "delete", delete: DeleteNode.fromJSON(object.delete) } - : isSet(object.update) - ? { $case: "update", update: UpdateNode.fromJSON(object.update) } - : isSet(object.project) - ? { $case: "project", project: ProjectNode.fromJSON(object.project) } - : isSet(object.hashAgg) - ? { $case: "hashAgg", hashAgg: HashAggNode.fromJSON(object.hashAgg) } - : isSet(object.filter) - ? { $case: "filter", filter: FilterNode.fromJSON(object.filter) } - : isSet(object.exchange) - ? { $case: "exchange", exchange: ExchangeNode.fromJSON(object.exchange) } - : isSet(object.sort) - ? { $case: "sort", sort: SortNode.fromJSON(object.sort) } - : isSet(object.nestedLoopJoin) - ? { $case: "nestedLoopJoin", nestedLoopJoin: NestedLoopJoinNode.fromJSON(object.nestedLoopJoin) } - : isSet(object.topN) - ? { $case: "topN", topN: TopNNode.fromJSON(object.topN) } - : isSet(object.sortAgg) - ? { $case: "sortAgg", sortAgg: SortAggNode.fromJSON(object.sortAgg) } - : isSet(object.rowSeqScan) - ? { $case: "rowSeqScan", rowSeqScan: RowSeqScanNode.fromJSON(object.rowSeqScan) } - : isSet(object.limit) - ? { $case: "limit", limit: LimitNode.fromJSON(object.limit) } - : isSet(object.values) - ? { $case: "values", values: ValuesNode.fromJSON(object.values) } - : isSet(object.hashJoin) - ? { $case: "hashJoin", hashJoin: HashJoinNode.fromJSON(object.hashJoin) } - : isSet(object.mergeSortExchange) - ? { $case: "mergeSortExchange", mergeSortExchange: MergeSortExchangeNode.fromJSON(object.mergeSortExchange) } - : isSet(object.hopWindow) - ? { $case: "hopWindow", hopWindow: HopWindowNode.fromJSON(object.hopWindow) } - : isSet(object.tableFunction) - ? { $case: "tableFunction", tableFunction: TableFunctionNode.fromJSON(object.tableFunction) } - : isSet(object.sysRowSeqScan) - ? { $case: "sysRowSeqScan", sysRowSeqScan: SysRowSeqScanNode.fromJSON(object.sysRowSeqScan) } - : isSet(object.expand) - ? { $case: "expand", expand: ExpandNode.fromJSON(object.expand) } - : isSet(object.localLookupJoin) - ? { $case: "localLookupJoin", localLookupJoin: LocalLookupJoinNode.fromJSON(object.localLookupJoin) } - : isSet(object.projectSet) - ? { $case: "projectSet", projectSet: ProjectSetNode.fromJSON(object.projectSet) } - : isSet(object.union) - ? { $case: "union", union: UnionNode.fromJSON(object.union) } - : isSet(object.groupTopN) - ? { $case: "groupTopN", groupTopN: GroupTopNNode.fromJSON(object.groupTopN) } - : isSet(object.distributedLookupJoin) - ? { - $case: "distributedLookupJoin", - distributedLookupJoin: DistributedLookupJoinNode.fromJSON(object.distributedLookupJoin), - } - : isSet(object.source) - ? { $case: "source", source: SourceNode.fromJSON(object.source) } - : undefined, - identity: isSet(object.identity) ? String(object.identity) : "", - }; - }, - - toJSON(message: PlanNode): unknown { - const obj: any = {}; - if (message.children) { - obj.children = message.children.map((e) => e ? PlanNode.toJSON(e) : undefined); - } else { - obj.children = []; - } - message.nodeBody?.$case === "insert" && - (obj.insert = message.nodeBody?.insert ? InsertNode.toJSON(message.nodeBody?.insert) : undefined); - message.nodeBody?.$case === "delete" && - (obj.delete = message.nodeBody?.delete ? DeleteNode.toJSON(message.nodeBody?.delete) : undefined); - message.nodeBody?.$case === "update" && - (obj.update = message.nodeBody?.update ? UpdateNode.toJSON(message.nodeBody?.update) : undefined); - message.nodeBody?.$case === "project" && - (obj.project = message.nodeBody?.project ? ProjectNode.toJSON(message.nodeBody?.project) : undefined); - message.nodeBody?.$case === "hashAgg" && - (obj.hashAgg = message.nodeBody?.hashAgg ? HashAggNode.toJSON(message.nodeBody?.hashAgg) : undefined); - message.nodeBody?.$case === "filter" && - (obj.filter = message.nodeBody?.filter ? FilterNode.toJSON(message.nodeBody?.filter) : undefined); - message.nodeBody?.$case === "exchange" && - (obj.exchange = message.nodeBody?.exchange ? ExchangeNode.toJSON(message.nodeBody?.exchange) : undefined); - message.nodeBody?.$case === "sort" && - (obj.sort = message.nodeBody?.sort ? SortNode.toJSON(message.nodeBody?.sort) : undefined); - message.nodeBody?.$case === "nestedLoopJoin" && (obj.nestedLoopJoin = message.nodeBody?.nestedLoopJoin - ? NestedLoopJoinNode.toJSON(message.nodeBody?.nestedLoopJoin) - : undefined); - message.nodeBody?.$case === "topN" && - (obj.topN = message.nodeBody?.topN ? TopNNode.toJSON(message.nodeBody?.topN) : undefined); - message.nodeBody?.$case === "sortAgg" && - (obj.sortAgg = message.nodeBody?.sortAgg ? SortAggNode.toJSON(message.nodeBody?.sortAgg) : undefined); - message.nodeBody?.$case === "rowSeqScan" && - (obj.rowSeqScan = message.nodeBody?.rowSeqScan ? RowSeqScanNode.toJSON(message.nodeBody?.rowSeqScan) : undefined); - message.nodeBody?.$case === "limit" && - (obj.limit = message.nodeBody?.limit ? LimitNode.toJSON(message.nodeBody?.limit) : undefined); - message.nodeBody?.$case === "values" && - (obj.values = message.nodeBody?.values ? ValuesNode.toJSON(message.nodeBody?.values) : undefined); - message.nodeBody?.$case === "hashJoin" && - (obj.hashJoin = message.nodeBody?.hashJoin ? HashJoinNode.toJSON(message.nodeBody?.hashJoin) : undefined); - message.nodeBody?.$case === "mergeSortExchange" && (obj.mergeSortExchange = message.nodeBody?.mergeSortExchange - ? MergeSortExchangeNode.toJSON(message.nodeBody?.mergeSortExchange) - : undefined); - message.nodeBody?.$case === "hopWindow" && - (obj.hopWindow = message.nodeBody?.hopWindow ? HopWindowNode.toJSON(message.nodeBody?.hopWindow) : undefined); - message.nodeBody?.$case === "tableFunction" && (obj.tableFunction = message.nodeBody?.tableFunction - ? TableFunctionNode.toJSON(message.nodeBody?.tableFunction) - : undefined); - message.nodeBody?.$case === "sysRowSeqScan" && (obj.sysRowSeqScan = message.nodeBody?.sysRowSeqScan - ? SysRowSeqScanNode.toJSON(message.nodeBody?.sysRowSeqScan) - : undefined); - message.nodeBody?.$case === "expand" && - (obj.expand = message.nodeBody?.expand ? ExpandNode.toJSON(message.nodeBody?.expand) : undefined); - message.nodeBody?.$case === "localLookupJoin" && (obj.localLookupJoin = message.nodeBody?.localLookupJoin - ? LocalLookupJoinNode.toJSON(message.nodeBody?.localLookupJoin) - : undefined); - message.nodeBody?.$case === "projectSet" && - (obj.projectSet = message.nodeBody?.projectSet ? ProjectSetNode.toJSON(message.nodeBody?.projectSet) : undefined); - message.nodeBody?.$case === "union" && - (obj.union = message.nodeBody?.union ? UnionNode.toJSON(message.nodeBody?.union) : undefined); - message.nodeBody?.$case === "groupTopN" && - (obj.groupTopN = message.nodeBody?.groupTopN ? GroupTopNNode.toJSON(message.nodeBody?.groupTopN) : undefined); - message.nodeBody?.$case === "distributedLookupJoin" && - (obj.distributedLookupJoin = message.nodeBody?.distributedLookupJoin - ? DistributedLookupJoinNode.toJSON(message.nodeBody?.distributedLookupJoin) - : undefined); - message.nodeBody?.$case === "source" && - (obj.source = message.nodeBody?.source ? SourceNode.toJSON(message.nodeBody?.source) : undefined); - message.identity !== undefined && (obj.identity = message.identity); - return obj; - }, - - fromPartial, I>>(object: I): PlanNode { - const message = createBasePlanNode(); - message.children = object.children?.map((e) => PlanNode.fromPartial(e)) || []; - if ( - object.nodeBody?.$case === "insert" && object.nodeBody?.insert !== undefined && object.nodeBody?.insert !== null - ) { - message.nodeBody = { $case: "insert", insert: InsertNode.fromPartial(object.nodeBody.insert) }; - } - if ( - object.nodeBody?.$case === "delete" && object.nodeBody?.delete !== undefined && object.nodeBody?.delete !== null - ) { - message.nodeBody = { $case: "delete", delete: DeleteNode.fromPartial(object.nodeBody.delete) }; - } - if ( - object.nodeBody?.$case === "update" && object.nodeBody?.update !== undefined && object.nodeBody?.update !== null - ) { - message.nodeBody = { $case: "update", update: UpdateNode.fromPartial(object.nodeBody.update) }; - } - if ( - object.nodeBody?.$case === "project" && - object.nodeBody?.project !== undefined && - object.nodeBody?.project !== null - ) { - message.nodeBody = { $case: "project", project: ProjectNode.fromPartial(object.nodeBody.project) }; - } - if ( - object.nodeBody?.$case === "hashAgg" && - object.nodeBody?.hashAgg !== undefined && - object.nodeBody?.hashAgg !== null - ) { - message.nodeBody = { $case: "hashAgg", hashAgg: HashAggNode.fromPartial(object.nodeBody.hashAgg) }; - } - if ( - object.nodeBody?.$case === "filter" && object.nodeBody?.filter !== undefined && object.nodeBody?.filter !== null - ) { - message.nodeBody = { $case: "filter", filter: FilterNode.fromPartial(object.nodeBody.filter) }; - } - if ( - object.nodeBody?.$case === "exchange" && - object.nodeBody?.exchange !== undefined && - object.nodeBody?.exchange !== null - ) { - message.nodeBody = { $case: "exchange", exchange: ExchangeNode.fromPartial(object.nodeBody.exchange) }; - } - if (object.nodeBody?.$case === "sort" && object.nodeBody?.sort !== undefined && object.nodeBody?.sort !== null) { - message.nodeBody = { $case: "sort", sort: SortNode.fromPartial(object.nodeBody.sort) }; - } - if ( - object.nodeBody?.$case === "nestedLoopJoin" && - object.nodeBody?.nestedLoopJoin !== undefined && - object.nodeBody?.nestedLoopJoin !== null - ) { - message.nodeBody = { - $case: "nestedLoopJoin", - nestedLoopJoin: NestedLoopJoinNode.fromPartial(object.nodeBody.nestedLoopJoin), - }; - } - if (object.nodeBody?.$case === "topN" && object.nodeBody?.topN !== undefined && object.nodeBody?.topN !== null) { - message.nodeBody = { $case: "topN", topN: TopNNode.fromPartial(object.nodeBody.topN) }; - } - if ( - object.nodeBody?.$case === "sortAgg" && - object.nodeBody?.sortAgg !== undefined && - object.nodeBody?.sortAgg !== null - ) { - message.nodeBody = { $case: "sortAgg", sortAgg: SortAggNode.fromPartial(object.nodeBody.sortAgg) }; - } - if ( - object.nodeBody?.$case === "rowSeqScan" && - object.nodeBody?.rowSeqScan !== undefined && - object.nodeBody?.rowSeqScan !== null - ) { - message.nodeBody = { $case: "rowSeqScan", rowSeqScan: RowSeqScanNode.fromPartial(object.nodeBody.rowSeqScan) }; - } - if (object.nodeBody?.$case === "limit" && object.nodeBody?.limit !== undefined && object.nodeBody?.limit !== null) { - message.nodeBody = { $case: "limit", limit: LimitNode.fromPartial(object.nodeBody.limit) }; - } - if ( - object.nodeBody?.$case === "values" && object.nodeBody?.values !== undefined && object.nodeBody?.values !== null - ) { - message.nodeBody = { $case: "values", values: ValuesNode.fromPartial(object.nodeBody.values) }; - } - if ( - object.nodeBody?.$case === "hashJoin" && - object.nodeBody?.hashJoin !== undefined && - object.nodeBody?.hashJoin !== null - ) { - message.nodeBody = { $case: "hashJoin", hashJoin: HashJoinNode.fromPartial(object.nodeBody.hashJoin) }; - } - if ( - object.nodeBody?.$case === "mergeSortExchange" && - object.nodeBody?.mergeSortExchange !== undefined && - object.nodeBody?.mergeSortExchange !== null - ) { - message.nodeBody = { - $case: "mergeSortExchange", - mergeSortExchange: MergeSortExchangeNode.fromPartial(object.nodeBody.mergeSortExchange), - }; - } - if ( - object.nodeBody?.$case === "hopWindow" && - object.nodeBody?.hopWindow !== undefined && - object.nodeBody?.hopWindow !== null - ) { - message.nodeBody = { $case: "hopWindow", hopWindow: HopWindowNode.fromPartial(object.nodeBody.hopWindow) }; - } - if ( - object.nodeBody?.$case === "tableFunction" && - object.nodeBody?.tableFunction !== undefined && - object.nodeBody?.tableFunction !== null - ) { - message.nodeBody = { - $case: "tableFunction", - tableFunction: TableFunctionNode.fromPartial(object.nodeBody.tableFunction), - }; - } - if ( - object.nodeBody?.$case === "sysRowSeqScan" && - object.nodeBody?.sysRowSeqScan !== undefined && - object.nodeBody?.sysRowSeqScan !== null - ) { - message.nodeBody = { - $case: "sysRowSeqScan", - sysRowSeqScan: SysRowSeqScanNode.fromPartial(object.nodeBody.sysRowSeqScan), - }; - } - if ( - object.nodeBody?.$case === "expand" && object.nodeBody?.expand !== undefined && object.nodeBody?.expand !== null - ) { - message.nodeBody = { $case: "expand", expand: ExpandNode.fromPartial(object.nodeBody.expand) }; - } - if ( - object.nodeBody?.$case === "localLookupJoin" && - object.nodeBody?.localLookupJoin !== undefined && - object.nodeBody?.localLookupJoin !== null - ) { - message.nodeBody = { - $case: "localLookupJoin", - localLookupJoin: LocalLookupJoinNode.fromPartial(object.nodeBody.localLookupJoin), - }; - } - if ( - object.nodeBody?.$case === "projectSet" && - object.nodeBody?.projectSet !== undefined && - object.nodeBody?.projectSet !== null - ) { - message.nodeBody = { $case: "projectSet", projectSet: ProjectSetNode.fromPartial(object.nodeBody.projectSet) }; - } - if (object.nodeBody?.$case === "union" && object.nodeBody?.union !== undefined && object.nodeBody?.union !== null) { - message.nodeBody = { $case: "union", union: UnionNode.fromPartial(object.nodeBody.union) }; - } - if ( - object.nodeBody?.$case === "groupTopN" && - object.nodeBody?.groupTopN !== undefined && - object.nodeBody?.groupTopN !== null - ) { - message.nodeBody = { $case: "groupTopN", groupTopN: GroupTopNNode.fromPartial(object.nodeBody.groupTopN) }; - } - if ( - object.nodeBody?.$case === "distributedLookupJoin" && - object.nodeBody?.distributedLookupJoin !== undefined && - object.nodeBody?.distributedLookupJoin !== null - ) { - message.nodeBody = { - $case: "distributedLookupJoin", - distributedLookupJoin: DistributedLookupJoinNode.fromPartial(object.nodeBody.distributedLookupJoin), - }; - } - if ( - object.nodeBody?.$case === "source" && object.nodeBody?.source !== undefined && object.nodeBody?.source !== null - ) { - message.nodeBody = { $case: "source", source: SourceNode.fromPartial(object.nodeBody.source) }; - } - message.identity = object.identity ?? ""; - return message; - }, -}; - -function createBaseExchangeInfo(): ExchangeInfo { - return { mode: ExchangeInfo_DistributionMode.UNSPECIFIED, distribution: undefined }; -} - -export const ExchangeInfo = { - fromJSON(object: any): ExchangeInfo { - return { - mode: isSet(object.mode) - ? exchangeInfo_DistributionModeFromJSON(object.mode) - : ExchangeInfo_DistributionMode.UNSPECIFIED, - distribution: isSet(object.broadcastInfo) - ? { $case: "broadcastInfo", broadcastInfo: ExchangeInfo_BroadcastInfo.fromJSON(object.broadcastInfo) } - : isSet(object.hashInfo) - ? { $case: "hashInfo", hashInfo: ExchangeInfo_HashInfo.fromJSON(object.hashInfo) } - : isSet(object.consistentHashInfo) - ? { - $case: "consistentHashInfo", - consistentHashInfo: ExchangeInfo_ConsistentHashInfo.fromJSON(object.consistentHashInfo), - } - : undefined, - }; - }, - - toJSON(message: ExchangeInfo): unknown { - const obj: any = {}; - message.mode !== undefined && (obj.mode = exchangeInfo_DistributionModeToJSON(message.mode)); - message.distribution?.$case === "broadcastInfo" && (obj.broadcastInfo = message.distribution?.broadcastInfo - ? ExchangeInfo_BroadcastInfo.toJSON(message.distribution?.broadcastInfo) - : undefined); - message.distribution?.$case === "hashInfo" && (obj.hashInfo = message.distribution?.hashInfo - ? ExchangeInfo_HashInfo.toJSON(message.distribution?.hashInfo) - : undefined); - message.distribution?.$case === "consistentHashInfo" && - (obj.consistentHashInfo = message.distribution?.consistentHashInfo - ? ExchangeInfo_ConsistentHashInfo.toJSON(message.distribution?.consistentHashInfo) - : undefined); - return obj; - }, - - fromPartial, I>>(object: I): ExchangeInfo { - const message = createBaseExchangeInfo(); - message.mode = object.mode ?? ExchangeInfo_DistributionMode.UNSPECIFIED; - if ( - object.distribution?.$case === "broadcastInfo" && - object.distribution?.broadcastInfo !== undefined && - object.distribution?.broadcastInfo !== null - ) { - message.distribution = { - $case: "broadcastInfo", - broadcastInfo: ExchangeInfo_BroadcastInfo.fromPartial(object.distribution.broadcastInfo), - }; - } - if ( - object.distribution?.$case === "hashInfo" && - object.distribution?.hashInfo !== undefined && - object.distribution?.hashInfo !== null - ) { - message.distribution = { - $case: "hashInfo", - hashInfo: ExchangeInfo_HashInfo.fromPartial(object.distribution.hashInfo), - }; - } - if ( - object.distribution?.$case === "consistentHashInfo" && - object.distribution?.consistentHashInfo !== undefined && - object.distribution?.consistentHashInfo !== null - ) { - message.distribution = { - $case: "consistentHashInfo", - consistentHashInfo: ExchangeInfo_ConsistentHashInfo.fromPartial(object.distribution.consistentHashInfo), - }; - } - return message; - }, -}; - -function createBaseExchangeInfo_BroadcastInfo(): ExchangeInfo_BroadcastInfo { - return { count: 0 }; -} - -export const ExchangeInfo_BroadcastInfo = { - fromJSON(object: any): ExchangeInfo_BroadcastInfo { - return { count: isSet(object.count) ? Number(object.count) : 0 }; - }, - - toJSON(message: ExchangeInfo_BroadcastInfo): unknown { - const obj: any = {}; - message.count !== undefined && (obj.count = Math.round(message.count)); - return obj; - }, - - fromPartial, I>>(object: I): ExchangeInfo_BroadcastInfo { - const message = createBaseExchangeInfo_BroadcastInfo(); - message.count = object.count ?? 0; - return message; - }, -}; - -function createBaseExchangeInfo_HashInfo(): ExchangeInfo_HashInfo { - return { outputCount: 0, key: [] }; -} - -export const ExchangeInfo_HashInfo = { - fromJSON(object: any): ExchangeInfo_HashInfo { - return { - outputCount: isSet(object.outputCount) ? Number(object.outputCount) : 0, - key: Array.isArray(object?.key) ? object.key.map((e: any) => Number(e)) : [], - }; - }, - - toJSON(message: ExchangeInfo_HashInfo): unknown { - const obj: any = {}; - message.outputCount !== undefined && (obj.outputCount = Math.round(message.outputCount)); - if (message.key) { - obj.key = message.key.map((e) => Math.round(e)); - } else { - obj.key = []; - } - return obj; - }, - - fromPartial, I>>(object: I): ExchangeInfo_HashInfo { - const message = createBaseExchangeInfo_HashInfo(); - message.outputCount = object.outputCount ?? 0; - message.key = object.key?.map((e) => e) || []; - return message; - }, -}; - -function createBaseExchangeInfo_ConsistentHashInfo(): ExchangeInfo_ConsistentHashInfo { - return { vmap: [], key: [] }; -} - -export const ExchangeInfo_ConsistentHashInfo = { - fromJSON(object: any): ExchangeInfo_ConsistentHashInfo { - return { - vmap: Array.isArray(object?.vmap) ? object.vmap.map((e: any) => Number(e)) : [], - key: Array.isArray(object?.key) ? object.key.map((e: any) => Number(e)) : [], - }; - }, - - toJSON(message: ExchangeInfo_ConsistentHashInfo): unknown { - const obj: any = {}; - if (message.vmap) { - obj.vmap = message.vmap.map((e) => Math.round(e)); - } else { - obj.vmap = []; - } - if (message.key) { - obj.key = message.key.map((e) => Math.round(e)); - } else { - obj.key = []; - } - return obj; - }, - - fromPartial, I>>( - object: I, - ): ExchangeInfo_ConsistentHashInfo { - const message = createBaseExchangeInfo_ConsistentHashInfo(); - message.vmap = object.vmap?.map((e) => e) || []; - message.key = object.key?.map((e) => e) || []; - return message; - }, -}; - -function createBasePlanFragment(): PlanFragment { - return { root: undefined, exchangeInfo: undefined }; -} - -export const PlanFragment = { - fromJSON(object: any): PlanFragment { - return { - root: isSet(object.root) ? PlanNode.fromJSON(object.root) : undefined, - exchangeInfo: isSet(object.exchangeInfo) ? ExchangeInfo.fromJSON(object.exchangeInfo) : undefined, - }; - }, - - toJSON(message: PlanFragment): unknown { - const obj: any = {}; - message.root !== undefined && (obj.root = message.root ? PlanNode.toJSON(message.root) : undefined); - message.exchangeInfo !== undefined && - (obj.exchangeInfo = message.exchangeInfo ? ExchangeInfo.toJSON(message.exchangeInfo) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): PlanFragment { - const message = createBasePlanFragment(); - message.root = (object.root !== undefined && object.root !== null) ? PlanNode.fromPartial(object.root) : undefined; - message.exchangeInfo = (object.exchangeInfo !== undefined && object.exchangeInfo !== null) - ? ExchangeInfo.fromPartial(object.exchangeInfo) - : undefined; - return message; - }, -}; - -declare var self: any | undefined; -declare var window: any | undefined; -declare var global: any | undefined; -var globalThis: any = (() => { - if (typeof globalThis !== "undefined") { - return globalThis; - } - if (typeof self !== "undefined") { - return self; - } - if (typeof window !== "undefined") { - return window; - } - if (typeof global !== "undefined") { - return global; - } - throw "Unable to locate global object"; -})(); - -function bytesFromBase64(b64: string): Uint8Array { - if (globalThis.Buffer) { - return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); - } else { - const bin = globalThis.atob(b64); - const arr = new Uint8Array(bin.length); - for (let i = 0; i < bin.length; ++i) { - arr[i] = bin.charCodeAt(i); - } - return arr; - } -} - -function base64FromBytes(arr: Uint8Array): string { - if (globalThis.Buffer) { - return globalThis.Buffer.from(arr).toString("base64"); - } else { - const bin: string[] = []; - arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); - }); - return globalThis.btoa(bin.join("")); - } -} - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> - : T extends { $case: string } ? { [K in keyof Omit]?: DeepPartial } & { $case: T["$case"] } - : T extends {} ? { [K in keyof T]?: DeepPartial } - : Partial; - -type KeysOfUnion = T extends T ? keyof T : never; -export type Exact = P extends Builtin ? P - : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; - -function isObject(value: any): boolean { - return typeof value === "object" && value !== null; -} - -function isSet(value: any): boolean { - return value !== null && value !== undefined; -} diff --git a/dashboard/proto/gen/catalog.ts b/dashboard/proto/gen/catalog.ts deleted file mode 100644 index 0375348099cd..000000000000 --- a/dashboard/proto/gen/catalog.ts +++ /dev/null @@ -1,1556 +0,0 @@ -/* eslint-disable */ -import { ColumnOrder } from "./common"; -import { DataType } from "./data"; -import { ExprNode } from "./expr"; -import { ColumnCatalog, Field, RowFormatType, rowFormatTypeFromJSON, rowFormatTypeToJSON } from "./plan_common"; - -export const protobufPackage = "catalog"; - -export const SinkType = { - UNSPECIFIED: "UNSPECIFIED", - APPEND_ONLY: "APPEND_ONLY", - FORCE_APPEND_ONLY: "FORCE_APPEND_ONLY", - UPSERT: "UPSERT", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type SinkType = typeof SinkType[keyof typeof SinkType]; - -export function sinkTypeFromJSON(object: any): SinkType { - switch (object) { - case 0: - case "UNSPECIFIED": - return SinkType.UNSPECIFIED; - case 1: - case "APPEND_ONLY": - return SinkType.APPEND_ONLY; - case 2: - case "FORCE_APPEND_ONLY": - return SinkType.FORCE_APPEND_ONLY; - case 3: - case "UPSERT": - return SinkType.UPSERT; - case -1: - case "UNRECOGNIZED": - default: - return SinkType.UNRECOGNIZED; - } -} - -export function sinkTypeToJSON(object: SinkType): string { - switch (object) { - case SinkType.UNSPECIFIED: - return "UNSPECIFIED"; - case SinkType.APPEND_ONLY: - return "APPEND_ONLY"; - case SinkType.FORCE_APPEND_ONLY: - return "FORCE_APPEND_ONLY"; - case SinkType.UPSERT: - return "UPSERT"; - case SinkType.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export const HandleConflictBehavior = { - NO_CHECK_UNSPECIFIED: "NO_CHECK_UNSPECIFIED", - OVERWRITE: "OVERWRITE", - IGNORE: "IGNORE", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type HandleConflictBehavior = typeof HandleConflictBehavior[keyof typeof HandleConflictBehavior]; - -export function handleConflictBehaviorFromJSON(object: any): HandleConflictBehavior { - switch (object) { - case 0: - case "NO_CHECK_UNSPECIFIED": - return HandleConflictBehavior.NO_CHECK_UNSPECIFIED; - case 1: - case "OVERWRITE": - return HandleConflictBehavior.OVERWRITE; - case 2: - case "IGNORE": - return HandleConflictBehavior.IGNORE; - case -1: - case "UNRECOGNIZED": - default: - return HandleConflictBehavior.UNRECOGNIZED; - } -} - -export function handleConflictBehaviorToJSON(object: HandleConflictBehavior): string { - switch (object) { - case HandleConflictBehavior.NO_CHECK_UNSPECIFIED: - return "NO_CHECK_UNSPECIFIED"; - case HandleConflictBehavior.OVERWRITE: - return "OVERWRITE"; - case HandleConflictBehavior.IGNORE: - return "IGNORE"; - case HandleConflictBehavior.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -/** A mapping of column indices. */ -export interface ColIndexMapping { - /** The size of the target space. */ - targetSize: number; - /** - * Each subscript is mapped to the corresponding element. - * For those not mapped, the value will be negative. - */ - map: number[]; -} - -export interface WatermarkDesc { - /** The column idx the watermark is on */ - watermarkIdx: number; - /** The expression to calculate the watermark value. */ - expr: ExprNode | undefined; -} - -export interface StreamSourceInfo { - rowFormat: RowFormatType; - rowSchemaLocation: string; - useSchemaRegistry: boolean; - protoMessageName: string; - csvDelimiter: number; - csvHasHeader: boolean; - upsertAvroPrimaryKey: string; -} - -export interface Source { - id: number; - schemaId: number; - databaseId: number; - name: string; - /** - * The column index of row ID. If the primary key is specified by the user, - * this will be `None`. - */ - rowIdIndex?: - | number - | undefined; - /** Columns of the source. */ - columns: ColumnCatalog[]; - /** - * Column id of the primary key specified by the user. If the user does not - * specify a primary key, the vector will be empty. - */ - pkColumnIds: number[]; - /** Properties specified by the user in WITH clause. */ - properties: { [key: string]: string }; - owner: number; - info: - | StreamSourceInfo - | undefined; - /** - * Define watermarks on the source. The `repeated` is just for forward - * compatibility, currently, only one watermark on the source - */ - watermarkDescs: WatermarkDesc[]; -} - -export interface Source_PropertiesEntry { - key: string; - value: string; -} - -export interface Sink { - id: number; - schemaId: number; - databaseId: number; - name: string; - columns: ColumnCatalog[]; - /** Primary key derived from the SQL by the frontend. */ - planPk: ColumnOrder[]; - dependentRelations: number[]; - distributionKey: number[]; - /** User-defined primary key indices for the upsert sink. */ - downstreamPk: number[]; - sinkType: SinkType; - owner: number; - properties: { [key: string]: string }; - definition: string; -} - -export interface Sink_PropertiesEntry { - key: string; - value: string; -} - -export interface Connection { - id: number; - name: string; - info?: { $case: "privateLinkService"; privateLinkService: Connection_PrivateLinkService }; -} - -export interface Connection_PrivateLinkService { - provider: string; - endpointId: string; - dnsEntries: { [key: string]: string }; -} - -export interface Connection_PrivateLinkService_DnsEntriesEntry { - key: string; - value: string; -} - -export interface Index { - id: number; - schemaId: number; - databaseId: number; - name: string; - owner: number; - indexTableId: number; - primaryTableId: number; - /** - * Only `InputRef` type index is supported Now. - * The index of `InputRef` is the column index of the primary table. - */ - indexItem: ExprNode[]; - originalColumns: number[]; -} - -export interface Function { - id: number; - schemaId: number; - databaseId: number; - name: string; - owner: number; - argTypes: DataType[]; - returnType: DataType | undefined; - language: string; - link: string; - identifier: string; - kind?: { $case: "scalar"; scalar: Function_ScalarFunction } | { $case: "table"; table: Function_TableFunction } | { - $case: "aggregate"; - aggregate: Function_AggregateFunction; - }; -} - -export interface Function_ScalarFunction { -} - -export interface Function_TableFunction { -} - -export interface Function_AggregateFunction { -} - -/** See `TableCatalog` struct in frontend crate for more information. */ -export interface Table { - id: number; - schemaId: number; - databaseId: number; - name: string; - columns: ColumnCatalog[]; - pk: ColumnOrder[]; - dependentRelations: number[]; - optionalAssociatedSourceId?: { $case: "associatedSourceId"; associatedSourceId: number }; - tableType: Table_TableType; - distributionKey: number[]; - /** pk_indices of the corresponding materialize operator's output. */ - streamKey: number[]; - appendOnly: boolean; - owner: number; - properties: { [key: string]: string }; - fragmentId: number; - /** - * an optional column index which is the vnode of each row computed by the - * table's consistent hash distribution - */ - vnodeColIndex?: - | number - | undefined; - /** - * An optional column index of row id. If the primary key is specified by users, - * this will be `None`. - */ - rowIdIndex?: - | number - | undefined; - /** - * The column indices which are stored in the state store's value with - * row-encoding. Currently is not supported yet and expected to be - * `[0..columns.len()]`. - */ - valueIndices: number[]; - definition: string; - handlePkConflictBehavior: HandleConflictBehavior; - /** - * Anticipated read prefix pattern (number of fields) for the table, which can be utilized - * for implementing the table's bloom filter or other storage optimization techniques. - */ - readPrefixLenHint: number; - watermarkIndices: number[]; - distKeyInPk: number[]; - /** - * Per-table catalog version, used by schema change. `None` for internal tables and tests. - * Not to be confused with the global catalog version for notification service. - */ - version: Table_TableVersion | undefined; -} - -export const Table_TableType = { - UNSPECIFIED: "UNSPECIFIED", - TABLE: "TABLE", - MATERIALIZED_VIEW: "MATERIALIZED_VIEW", - INDEX: "INDEX", - INTERNAL: "INTERNAL", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type Table_TableType = typeof Table_TableType[keyof typeof Table_TableType]; - -export function table_TableTypeFromJSON(object: any): Table_TableType { - switch (object) { - case 0: - case "UNSPECIFIED": - return Table_TableType.UNSPECIFIED; - case 1: - case "TABLE": - return Table_TableType.TABLE; - case 2: - case "MATERIALIZED_VIEW": - return Table_TableType.MATERIALIZED_VIEW; - case 3: - case "INDEX": - return Table_TableType.INDEX; - case 4: - case "INTERNAL": - return Table_TableType.INTERNAL; - case -1: - case "UNRECOGNIZED": - default: - return Table_TableType.UNRECOGNIZED; - } -} - -export function table_TableTypeToJSON(object: Table_TableType): string { - switch (object) { - case Table_TableType.UNSPECIFIED: - return "UNSPECIFIED"; - case Table_TableType.TABLE: - return "TABLE"; - case Table_TableType.MATERIALIZED_VIEW: - return "MATERIALIZED_VIEW"; - case Table_TableType.INDEX: - return "INDEX"; - case Table_TableType.INTERNAL: - return "INTERNAL"; - case Table_TableType.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export interface Table_TableVersion { - /** - * The version number, which will be 0 by default and be increased by 1 for - * each schema change in the frontend. - */ - version: number; - /** - * The ID of the next column to be added, which is used to make all columns - * in the table have unique IDs, even if some columns have been dropped. - */ - nextColumnId: number; -} - -export interface Table_PropertiesEntry { - key: string; - value: string; -} - -export interface View { - id: number; - schemaId: number; - databaseId: number; - name: string; - owner: number; - properties: { [key: string]: string }; - sql: string; - dependentRelations: number[]; - /** User-specified column names. */ - columns: Field[]; -} - -export interface View_PropertiesEntry { - key: string; - value: string; -} - -export interface Schema { - id: number; - databaseId: number; - name: string; - owner: number; -} - -export interface Database { - id: number; - name: string; - owner: number; -} - -function createBaseColIndexMapping(): ColIndexMapping { - return { targetSize: 0, map: [] }; -} - -export const ColIndexMapping = { - fromJSON(object: any): ColIndexMapping { - return { - targetSize: isSet(object.targetSize) ? Number(object.targetSize) : 0, - map: Array.isArray(object?.map) ? object.map.map((e: any) => Number(e)) : [], - }; - }, - - toJSON(message: ColIndexMapping): unknown { - const obj: any = {}; - message.targetSize !== undefined && (obj.targetSize = Math.round(message.targetSize)); - if (message.map) { - obj.map = message.map.map((e) => Math.round(e)); - } else { - obj.map = []; - } - return obj; - }, - - fromPartial, I>>(object: I): ColIndexMapping { - const message = createBaseColIndexMapping(); - message.targetSize = object.targetSize ?? 0; - message.map = object.map?.map((e) => e) || []; - return message; - }, -}; - -function createBaseWatermarkDesc(): WatermarkDesc { - return { watermarkIdx: 0, expr: undefined }; -} - -export const WatermarkDesc = { - fromJSON(object: any): WatermarkDesc { - return { - watermarkIdx: isSet(object.watermarkIdx) ? Number(object.watermarkIdx) : 0, - expr: isSet(object.expr) ? ExprNode.fromJSON(object.expr) : undefined, - }; - }, - - toJSON(message: WatermarkDesc): unknown { - const obj: any = {}; - message.watermarkIdx !== undefined && (obj.watermarkIdx = Math.round(message.watermarkIdx)); - message.expr !== undefined && (obj.expr = message.expr ? ExprNode.toJSON(message.expr) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): WatermarkDesc { - const message = createBaseWatermarkDesc(); - message.watermarkIdx = object.watermarkIdx ?? 0; - message.expr = (object.expr !== undefined && object.expr !== null) ? ExprNode.fromPartial(object.expr) : undefined; - return message; - }, -}; - -function createBaseStreamSourceInfo(): StreamSourceInfo { - return { - rowFormat: RowFormatType.ROW_UNSPECIFIED, - rowSchemaLocation: "", - useSchemaRegistry: false, - protoMessageName: "", - csvDelimiter: 0, - csvHasHeader: false, - upsertAvroPrimaryKey: "", - }; -} - -export const StreamSourceInfo = { - fromJSON(object: any): StreamSourceInfo { - return { - rowFormat: isSet(object.rowFormat) ? rowFormatTypeFromJSON(object.rowFormat) : RowFormatType.ROW_UNSPECIFIED, - rowSchemaLocation: isSet(object.rowSchemaLocation) ? String(object.rowSchemaLocation) : "", - useSchemaRegistry: isSet(object.useSchemaRegistry) ? Boolean(object.useSchemaRegistry) : false, - protoMessageName: isSet(object.protoMessageName) ? String(object.protoMessageName) : "", - csvDelimiter: isSet(object.csvDelimiter) ? Number(object.csvDelimiter) : 0, - csvHasHeader: isSet(object.csvHasHeader) ? Boolean(object.csvHasHeader) : false, - upsertAvroPrimaryKey: isSet(object.upsertAvroPrimaryKey) ? String(object.upsertAvroPrimaryKey) : "", - }; - }, - - toJSON(message: StreamSourceInfo): unknown { - const obj: any = {}; - message.rowFormat !== undefined && (obj.rowFormat = rowFormatTypeToJSON(message.rowFormat)); - message.rowSchemaLocation !== undefined && (obj.rowSchemaLocation = message.rowSchemaLocation); - message.useSchemaRegistry !== undefined && (obj.useSchemaRegistry = message.useSchemaRegistry); - message.protoMessageName !== undefined && (obj.protoMessageName = message.protoMessageName); - message.csvDelimiter !== undefined && (obj.csvDelimiter = Math.round(message.csvDelimiter)); - message.csvHasHeader !== undefined && (obj.csvHasHeader = message.csvHasHeader); - message.upsertAvroPrimaryKey !== undefined && (obj.upsertAvroPrimaryKey = message.upsertAvroPrimaryKey); - return obj; - }, - - fromPartial, I>>(object: I): StreamSourceInfo { - const message = createBaseStreamSourceInfo(); - message.rowFormat = object.rowFormat ?? RowFormatType.ROW_UNSPECIFIED; - message.rowSchemaLocation = object.rowSchemaLocation ?? ""; - message.useSchemaRegistry = object.useSchemaRegistry ?? false; - message.protoMessageName = object.protoMessageName ?? ""; - message.csvDelimiter = object.csvDelimiter ?? 0; - message.csvHasHeader = object.csvHasHeader ?? false; - message.upsertAvroPrimaryKey = object.upsertAvroPrimaryKey ?? ""; - return message; - }, -}; - -function createBaseSource(): Source { - return { - id: 0, - schemaId: 0, - databaseId: 0, - name: "", - rowIdIndex: undefined, - columns: [], - pkColumnIds: [], - properties: {}, - owner: 0, - info: undefined, - watermarkDescs: [], - }; -} - -export const Source = { - fromJSON(object: any): Source { - return { - id: isSet(object.id) ? Number(object.id) : 0, - schemaId: isSet(object.schemaId) ? Number(object.schemaId) : 0, - databaseId: isSet(object.databaseId) ? Number(object.databaseId) : 0, - name: isSet(object.name) ? String(object.name) : "", - rowIdIndex: isSet(object.rowIdIndex) ? Number(object.rowIdIndex) : undefined, - columns: Array.isArray(object?.columns) ? object.columns.map((e: any) => ColumnCatalog.fromJSON(e)) : [], - pkColumnIds: Array.isArray(object?.pkColumnIds) ? object.pkColumnIds.map((e: any) => Number(e)) : [], - properties: isObject(object.properties) - ? Object.entries(object.properties).reduce<{ [key: string]: string }>((acc, [key, value]) => { - acc[key] = String(value); - return acc; - }, {}) - : {}, - owner: isSet(object.owner) ? Number(object.owner) : 0, - info: isSet(object.info) ? StreamSourceInfo.fromJSON(object.info) : undefined, - watermarkDescs: Array.isArray(object?.watermarkDescs) - ? object.watermarkDescs.map((e: any) => WatermarkDesc.fromJSON(e)) - : [], - }; - }, - - toJSON(message: Source): unknown { - const obj: any = {}; - message.id !== undefined && (obj.id = Math.round(message.id)); - message.schemaId !== undefined && (obj.schemaId = Math.round(message.schemaId)); - message.databaseId !== undefined && (obj.databaseId = Math.round(message.databaseId)); - message.name !== undefined && (obj.name = message.name); - message.rowIdIndex !== undefined && (obj.rowIdIndex = Math.round(message.rowIdIndex)); - if (message.columns) { - obj.columns = message.columns.map((e) => e ? ColumnCatalog.toJSON(e) : undefined); - } else { - obj.columns = []; - } - if (message.pkColumnIds) { - obj.pkColumnIds = message.pkColumnIds.map((e) => Math.round(e)); - } else { - obj.pkColumnIds = []; - } - obj.properties = {}; - if (message.properties) { - Object.entries(message.properties).forEach(([k, v]) => { - obj.properties[k] = v; - }); - } - message.owner !== undefined && (obj.owner = Math.round(message.owner)); - message.info !== undefined && (obj.info = message.info ? StreamSourceInfo.toJSON(message.info) : undefined); - if (message.watermarkDescs) { - obj.watermarkDescs = message.watermarkDescs.map((e) => e ? WatermarkDesc.toJSON(e) : undefined); - } else { - obj.watermarkDescs = []; - } - return obj; - }, - - fromPartial, I>>(object: I): Source { - const message = createBaseSource(); - message.id = object.id ?? 0; - message.schemaId = object.schemaId ?? 0; - message.databaseId = object.databaseId ?? 0; - message.name = object.name ?? ""; - message.rowIdIndex = object.rowIdIndex ?? undefined; - message.columns = object.columns?.map((e) => ColumnCatalog.fromPartial(e)) || []; - message.pkColumnIds = object.pkColumnIds?.map((e) => e) || []; - message.properties = Object.entries(object.properties ?? {}).reduce<{ [key: string]: string }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[key] = String(value); - } - return acc; - }, - {}, - ); - message.owner = object.owner ?? 0; - message.info = (object.info !== undefined && object.info !== null) - ? StreamSourceInfo.fromPartial(object.info) - : undefined; - message.watermarkDescs = object.watermarkDescs?.map((e) => WatermarkDesc.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseSource_PropertiesEntry(): Source_PropertiesEntry { - return { key: "", value: "" }; -} - -export const Source_PropertiesEntry = { - fromJSON(object: any): Source_PropertiesEntry { - return { key: isSet(object.key) ? String(object.key) : "", value: isSet(object.value) ? String(object.value) : "" }; - }, - - toJSON(message: Source_PropertiesEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = message.key); - message.value !== undefined && (obj.value = message.value); - return obj; - }, - - fromPartial, I>>(object: I): Source_PropertiesEntry { - const message = createBaseSource_PropertiesEntry(); - message.key = object.key ?? ""; - message.value = object.value ?? ""; - return message; - }, -}; - -function createBaseSink(): Sink { - return { - id: 0, - schemaId: 0, - databaseId: 0, - name: "", - columns: [], - planPk: [], - dependentRelations: [], - distributionKey: [], - downstreamPk: [], - sinkType: SinkType.UNSPECIFIED, - owner: 0, - properties: {}, - definition: "", - }; -} - -export const Sink = { - fromJSON(object: any): Sink { - return { - id: isSet(object.id) ? Number(object.id) : 0, - schemaId: isSet(object.schemaId) ? Number(object.schemaId) : 0, - databaseId: isSet(object.databaseId) ? Number(object.databaseId) : 0, - name: isSet(object.name) ? String(object.name) : "", - columns: Array.isArray(object?.columns) ? object.columns.map((e: any) => ColumnCatalog.fromJSON(e)) : [], - planPk: Array.isArray(object?.planPk) ? object.planPk.map((e: any) => ColumnOrder.fromJSON(e)) : [], - dependentRelations: Array.isArray(object?.dependentRelations) - ? object.dependentRelations.map((e: any) => Number(e)) - : [], - distributionKey: Array.isArray(object?.distributionKey) - ? object.distributionKey.map((e: any) => Number(e)) - : [], - downstreamPk: Array.isArray(object?.downstreamPk) ? object.downstreamPk.map((e: any) => Number(e)) : [], - sinkType: isSet(object.sinkType) ? sinkTypeFromJSON(object.sinkType) : SinkType.UNSPECIFIED, - owner: isSet(object.owner) ? Number(object.owner) : 0, - properties: isObject(object.properties) - ? Object.entries(object.properties).reduce<{ [key: string]: string }>((acc, [key, value]) => { - acc[key] = String(value); - return acc; - }, {}) - : {}, - definition: isSet(object.definition) ? String(object.definition) : "", - }; - }, - - toJSON(message: Sink): unknown { - const obj: any = {}; - message.id !== undefined && (obj.id = Math.round(message.id)); - message.schemaId !== undefined && (obj.schemaId = Math.round(message.schemaId)); - message.databaseId !== undefined && (obj.databaseId = Math.round(message.databaseId)); - message.name !== undefined && (obj.name = message.name); - if (message.columns) { - obj.columns = message.columns.map((e) => e ? ColumnCatalog.toJSON(e) : undefined); - } else { - obj.columns = []; - } - if (message.planPk) { - obj.planPk = message.planPk.map((e) => e ? ColumnOrder.toJSON(e) : undefined); - } else { - obj.planPk = []; - } - if (message.dependentRelations) { - obj.dependentRelations = message.dependentRelations.map((e) => Math.round(e)); - } else { - obj.dependentRelations = []; - } - if (message.distributionKey) { - obj.distributionKey = message.distributionKey.map((e) => Math.round(e)); - } else { - obj.distributionKey = []; - } - if (message.downstreamPk) { - obj.downstreamPk = message.downstreamPk.map((e) => Math.round(e)); - } else { - obj.downstreamPk = []; - } - message.sinkType !== undefined && (obj.sinkType = sinkTypeToJSON(message.sinkType)); - message.owner !== undefined && (obj.owner = Math.round(message.owner)); - obj.properties = {}; - if (message.properties) { - Object.entries(message.properties).forEach(([k, v]) => { - obj.properties[k] = v; - }); - } - message.definition !== undefined && (obj.definition = message.definition); - return obj; - }, - - fromPartial, I>>(object: I): Sink { - const message = createBaseSink(); - message.id = object.id ?? 0; - message.schemaId = object.schemaId ?? 0; - message.databaseId = object.databaseId ?? 0; - message.name = object.name ?? ""; - message.columns = object.columns?.map((e) => ColumnCatalog.fromPartial(e)) || []; - message.planPk = object.planPk?.map((e) => ColumnOrder.fromPartial(e)) || []; - message.dependentRelations = object.dependentRelations?.map((e) => e) || []; - message.distributionKey = object.distributionKey?.map((e) => e) || []; - message.downstreamPk = object.downstreamPk?.map((e) => e) || []; - message.sinkType = object.sinkType ?? SinkType.UNSPECIFIED; - message.owner = object.owner ?? 0; - message.properties = Object.entries(object.properties ?? {}).reduce<{ [key: string]: string }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[key] = String(value); - } - return acc; - }, - {}, - ); - message.definition = object.definition ?? ""; - return message; - }, -}; - -function createBaseSink_PropertiesEntry(): Sink_PropertiesEntry { - return { key: "", value: "" }; -} - -export const Sink_PropertiesEntry = { - fromJSON(object: any): Sink_PropertiesEntry { - return { key: isSet(object.key) ? String(object.key) : "", value: isSet(object.value) ? String(object.value) : "" }; - }, - - toJSON(message: Sink_PropertiesEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = message.key); - message.value !== undefined && (obj.value = message.value); - return obj; - }, - - fromPartial, I>>(object: I): Sink_PropertiesEntry { - const message = createBaseSink_PropertiesEntry(); - message.key = object.key ?? ""; - message.value = object.value ?? ""; - return message; - }, -}; - -function createBaseConnection(): Connection { - return { id: 0, name: "", info: undefined }; -} - -export const Connection = { - fromJSON(object: any): Connection { - return { - id: isSet(object.id) ? Number(object.id) : 0, - name: isSet(object.name) ? String(object.name) : "", - info: isSet(object.privateLinkService) - ? { - $case: "privateLinkService", - privateLinkService: Connection_PrivateLinkService.fromJSON(object.privateLinkService), - } - : undefined, - }; - }, - - toJSON(message: Connection): unknown { - const obj: any = {}; - message.id !== undefined && (obj.id = Math.round(message.id)); - message.name !== undefined && (obj.name = message.name); - message.info?.$case === "privateLinkService" && (obj.privateLinkService = message.info?.privateLinkService - ? Connection_PrivateLinkService.toJSON(message.info?.privateLinkService) - : undefined); - return obj; - }, - - fromPartial, I>>(object: I): Connection { - const message = createBaseConnection(); - message.id = object.id ?? 0; - message.name = object.name ?? ""; - if ( - object.info?.$case === "privateLinkService" && - object.info?.privateLinkService !== undefined && - object.info?.privateLinkService !== null - ) { - message.info = { - $case: "privateLinkService", - privateLinkService: Connection_PrivateLinkService.fromPartial(object.info.privateLinkService), - }; - } - return message; - }, -}; - -function createBaseConnection_PrivateLinkService(): Connection_PrivateLinkService { - return { provider: "", endpointId: "", dnsEntries: {} }; -} - -export const Connection_PrivateLinkService = { - fromJSON(object: any): Connection_PrivateLinkService { - return { - provider: isSet(object.provider) ? String(object.provider) : "", - endpointId: isSet(object.endpointId) ? String(object.endpointId) : "", - dnsEntries: isObject(object.dnsEntries) - ? Object.entries(object.dnsEntries).reduce<{ [key: string]: string }>((acc, [key, value]) => { - acc[key] = String(value); - return acc; - }, {}) - : {}, - }; - }, - - toJSON(message: Connection_PrivateLinkService): unknown { - const obj: any = {}; - message.provider !== undefined && (obj.provider = message.provider); - message.endpointId !== undefined && (obj.endpointId = message.endpointId); - obj.dnsEntries = {}; - if (message.dnsEntries) { - Object.entries(message.dnsEntries).forEach(([k, v]) => { - obj.dnsEntries[k] = v; - }); - } - return obj; - }, - - fromPartial, I>>( - object: I, - ): Connection_PrivateLinkService { - const message = createBaseConnection_PrivateLinkService(); - message.provider = object.provider ?? ""; - message.endpointId = object.endpointId ?? ""; - message.dnsEntries = Object.entries(object.dnsEntries ?? {}).reduce<{ [key: string]: string }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[key] = String(value); - } - return acc; - }, - {}, - ); - return message; - }, -}; - -function createBaseConnection_PrivateLinkService_DnsEntriesEntry(): Connection_PrivateLinkService_DnsEntriesEntry { - return { key: "", value: "" }; -} - -export const Connection_PrivateLinkService_DnsEntriesEntry = { - fromJSON(object: any): Connection_PrivateLinkService_DnsEntriesEntry { - return { key: isSet(object.key) ? String(object.key) : "", value: isSet(object.value) ? String(object.value) : "" }; - }, - - toJSON(message: Connection_PrivateLinkService_DnsEntriesEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = message.key); - message.value !== undefined && (obj.value = message.value); - return obj; - }, - - fromPartial, I>>( - object: I, - ): Connection_PrivateLinkService_DnsEntriesEntry { - const message = createBaseConnection_PrivateLinkService_DnsEntriesEntry(); - message.key = object.key ?? ""; - message.value = object.value ?? ""; - return message; - }, -}; - -function createBaseIndex(): Index { - return { - id: 0, - schemaId: 0, - databaseId: 0, - name: "", - owner: 0, - indexTableId: 0, - primaryTableId: 0, - indexItem: [], - originalColumns: [], - }; -} - -export const Index = { - fromJSON(object: any): Index { - return { - id: isSet(object.id) ? Number(object.id) : 0, - schemaId: isSet(object.schemaId) ? Number(object.schemaId) : 0, - databaseId: isSet(object.databaseId) ? Number(object.databaseId) : 0, - name: isSet(object.name) ? String(object.name) : "", - owner: isSet(object.owner) ? Number(object.owner) : 0, - indexTableId: isSet(object.indexTableId) ? Number(object.indexTableId) : 0, - primaryTableId: isSet(object.primaryTableId) ? Number(object.primaryTableId) : 0, - indexItem: Array.isArray(object?.indexItem) - ? object.indexItem.map((e: any) => ExprNode.fromJSON(e)) - : [], - originalColumns: Array.isArray(object?.originalColumns) ? object.originalColumns.map((e: any) => Number(e)) : [], - }; - }, - - toJSON(message: Index): unknown { - const obj: any = {}; - message.id !== undefined && (obj.id = Math.round(message.id)); - message.schemaId !== undefined && (obj.schemaId = Math.round(message.schemaId)); - message.databaseId !== undefined && (obj.databaseId = Math.round(message.databaseId)); - message.name !== undefined && (obj.name = message.name); - message.owner !== undefined && (obj.owner = Math.round(message.owner)); - message.indexTableId !== undefined && (obj.indexTableId = Math.round(message.indexTableId)); - message.primaryTableId !== undefined && (obj.primaryTableId = Math.round(message.primaryTableId)); - if (message.indexItem) { - obj.indexItem = message.indexItem.map((e) => e ? ExprNode.toJSON(e) : undefined); - } else { - obj.indexItem = []; - } - if (message.originalColumns) { - obj.originalColumns = message.originalColumns.map((e) => Math.round(e)); - } else { - obj.originalColumns = []; - } - return obj; - }, - - fromPartial, I>>(object: I): Index { - const message = createBaseIndex(); - message.id = object.id ?? 0; - message.schemaId = object.schemaId ?? 0; - message.databaseId = object.databaseId ?? 0; - message.name = object.name ?? ""; - message.owner = object.owner ?? 0; - message.indexTableId = object.indexTableId ?? 0; - message.primaryTableId = object.primaryTableId ?? 0; - message.indexItem = object.indexItem?.map((e) => ExprNode.fromPartial(e)) || []; - message.originalColumns = object.originalColumns?.map((e) => e) || []; - return message; - }, -}; - -function createBaseFunction(): Function { - return { - id: 0, - schemaId: 0, - databaseId: 0, - name: "", - owner: 0, - argTypes: [], - returnType: undefined, - language: "", - link: "", - identifier: "", - kind: undefined, - }; -} - -export const Function = { - fromJSON(object: any): Function { - return { - id: isSet(object.id) ? Number(object.id) : 0, - schemaId: isSet(object.schemaId) ? Number(object.schemaId) : 0, - databaseId: isSet(object.databaseId) ? Number(object.databaseId) : 0, - name: isSet(object.name) ? String(object.name) : "", - owner: isSet(object.owner) ? Number(object.owner) : 0, - argTypes: Array.isArray(object?.argTypes) - ? object.argTypes.map((e: any) => DataType.fromJSON(e)) - : [], - returnType: isSet(object.returnType) ? DataType.fromJSON(object.returnType) : undefined, - language: isSet(object.language) ? String(object.language) : "", - link: isSet(object.link) ? String(object.link) : "", - identifier: isSet(object.identifier) ? String(object.identifier) : "", - kind: isSet(object.scalar) - ? { $case: "scalar", scalar: Function_ScalarFunction.fromJSON(object.scalar) } - : isSet(object.table) - ? { $case: "table", table: Function_TableFunction.fromJSON(object.table) } - : isSet(object.aggregate) - ? { $case: "aggregate", aggregate: Function_AggregateFunction.fromJSON(object.aggregate) } - : undefined, - }; - }, - - toJSON(message: Function): unknown { - const obj: any = {}; - message.id !== undefined && (obj.id = Math.round(message.id)); - message.schemaId !== undefined && (obj.schemaId = Math.round(message.schemaId)); - message.databaseId !== undefined && (obj.databaseId = Math.round(message.databaseId)); - message.name !== undefined && (obj.name = message.name); - message.owner !== undefined && (obj.owner = Math.round(message.owner)); - if (message.argTypes) { - obj.argTypes = message.argTypes.map((e) => e ? DataType.toJSON(e) : undefined); - } else { - obj.argTypes = []; - } - message.returnType !== undefined && - (obj.returnType = message.returnType ? DataType.toJSON(message.returnType) : undefined); - message.language !== undefined && (obj.language = message.language); - message.link !== undefined && (obj.link = message.link); - message.identifier !== undefined && (obj.identifier = message.identifier); - message.kind?.$case === "scalar" && - (obj.scalar = message.kind?.scalar ? Function_ScalarFunction.toJSON(message.kind?.scalar) : undefined); - message.kind?.$case === "table" && - (obj.table = message.kind?.table ? Function_TableFunction.toJSON(message.kind?.table) : undefined); - message.kind?.$case === "aggregate" && - (obj.aggregate = message.kind?.aggregate - ? Function_AggregateFunction.toJSON(message.kind?.aggregate) - : undefined); - return obj; - }, - - fromPartial, I>>(object: I): Function { - const message = createBaseFunction(); - message.id = object.id ?? 0; - message.schemaId = object.schemaId ?? 0; - message.databaseId = object.databaseId ?? 0; - message.name = object.name ?? ""; - message.owner = object.owner ?? 0; - message.argTypes = object.argTypes?.map((e) => DataType.fromPartial(e)) || []; - message.returnType = (object.returnType !== undefined && object.returnType !== null) - ? DataType.fromPartial(object.returnType) - : undefined; - message.language = object.language ?? ""; - message.link = object.link ?? ""; - message.identifier = object.identifier ?? ""; - if (object.kind?.$case === "scalar" && object.kind?.scalar !== undefined && object.kind?.scalar !== null) { - message.kind = { $case: "scalar", scalar: Function_ScalarFunction.fromPartial(object.kind.scalar) }; - } - if (object.kind?.$case === "table" && object.kind?.table !== undefined && object.kind?.table !== null) { - message.kind = { $case: "table", table: Function_TableFunction.fromPartial(object.kind.table) }; - } - if (object.kind?.$case === "aggregate" && object.kind?.aggregate !== undefined && object.kind?.aggregate !== null) { - message.kind = { $case: "aggregate", aggregate: Function_AggregateFunction.fromPartial(object.kind.aggregate) }; - } - return message; - }, -}; - -function createBaseFunction_ScalarFunction(): Function_ScalarFunction { - return {}; -} - -export const Function_ScalarFunction = { - fromJSON(_: any): Function_ScalarFunction { - return {}; - }, - - toJSON(_: Function_ScalarFunction): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): Function_ScalarFunction { - const message = createBaseFunction_ScalarFunction(); - return message; - }, -}; - -function createBaseFunction_TableFunction(): Function_TableFunction { - return {}; -} - -export const Function_TableFunction = { - fromJSON(_: any): Function_TableFunction { - return {}; - }, - - toJSON(_: Function_TableFunction): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): Function_TableFunction { - const message = createBaseFunction_TableFunction(); - return message; - }, -}; - -function createBaseFunction_AggregateFunction(): Function_AggregateFunction { - return {}; -} - -export const Function_AggregateFunction = { - fromJSON(_: any): Function_AggregateFunction { - return {}; - }, - - toJSON(_: Function_AggregateFunction): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): Function_AggregateFunction { - const message = createBaseFunction_AggregateFunction(); - return message; - }, -}; - -function createBaseTable(): Table { - return { - id: 0, - schemaId: 0, - databaseId: 0, - name: "", - columns: [], - pk: [], - dependentRelations: [], - optionalAssociatedSourceId: undefined, - tableType: Table_TableType.UNSPECIFIED, - distributionKey: [], - streamKey: [], - appendOnly: false, - owner: 0, - properties: {}, - fragmentId: 0, - vnodeColIndex: undefined, - rowIdIndex: undefined, - valueIndices: [], - definition: "", - handlePkConflictBehavior: HandleConflictBehavior.NO_CHECK_UNSPECIFIED, - readPrefixLenHint: 0, - watermarkIndices: [], - distKeyInPk: [], - version: undefined, - }; -} - -export const Table = { - fromJSON(object: any): Table { - return { - id: isSet(object.id) ? Number(object.id) : 0, - schemaId: isSet(object.schemaId) ? Number(object.schemaId) : 0, - databaseId: isSet(object.databaseId) ? Number(object.databaseId) : 0, - name: isSet(object.name) ? String(object.name) : "", - columns: Array.isArray(object?.columns) ? object.columns.map((e: any) => ColumnCatalog.fromJSON(e)) : [], - pk: Array.isArray(object?.pk) ? object.pk.map((e: any) => ColumnOrder.fromJSON(e)) : [], - dependentRelations: Array.isArray(object?.dependentRelations) - ? object.dependentRelations.map((e: any) => Number(e)) - : [], - optionalAssociatedSourceId: isSet(object.associatedSourceId) - ? { $case: "associatedSourceId", associatedSourceId: Number(object.associatedSourceId) } - : undefined, - tableType: isSet(object.tableType) ? table_TableTypeFromJSON(object.tableType) : Table_TableType.UNSPECIFIED, - distributionKey: Array.isArray(object?.distributionKey) - ? object.distributionKey.map((e: any) => Number(e)) - : [], - streamKey: Array.isArray(object?.streamKey) ? object.streamKey.map((e: any) => Number(e)) : [], - appendOnly: isSet(object.appendOnly) ? Boolean(object.appendOnly) : false, - owner: isSet(object.owner) ? Number(object.owner) : 0, - properties: isObject(object.properties) - ? Object.entries(object.properties).reduce<{ [key: string]: string }>((acc, [key, value]) => { - acc[key] = String(value); - return acc; - }, {}) - : {}, - fragmentId: isSet(object.fragmentId) ? Number(object.fragmentId) : 0, - vnodeColIndex: isSet(object.vnodeColIndex) ? Number(object.vnodeColIndex) : undefined, - rowIdIndex: isSet(object.rowIdIndex) ? Number(object.rowIdIndex) : undefined, - valueIndices: Array.isArray(object?.valueIndices) - ? object.valueIndices.map((e: any) => Number(e)) - : [], - definition: isSet(object.definition) ? String(object.definition) : "", - handlePkConflictBehavior: isSet(object.handlePkConflictBehavior) - ? handleConflictBehaviorFromJSON(object.handlePkConflictBehavior) - : HandleConflictBehavior.NO_CHECK_UNSPECIFIED, - readPrefixLenHint: isSet(object.readPrefixLenHint) ? Number(object.readPrefixLenHint) : 0, - watermarkIndices: Array.isArray(object?.watermarkIndices) - ? object.watermarkIndices.map((e: any) => Number(e)) - : [], - distKeyInPk: Array.isArray(object?.distKeyInPk) ? object.distKeyInPk.map((e: any) => Number(e)) : [], - version: isSet(object.version) ? Table_TableVersion.fromJSON(object.version) : undefined, - }; - }, - - toJSON(message: Table): unknown { - const obj: any = {}; - message.id !== undefined && (obj.id = Math.round(message.id)); - message.schemaId !== undefined && (obj.schemaId = Math.round(message.schemaId)); - message.databaseId !== undefined && (obj.databaseId = Math.round(message.databaseId)); - message.name !== undefined && (obj.name = message.name); - if (message.columns) { - obj.columns = message.columns.map((e) => e ? ColumnCatalog.toJSON(e) : undefined); - } else { - obj.columns = []; - } - if (message.pk) { - obj.pk = message.pk.map((e) => e ? ColumnOrder.toJSON(e) : undefined); - } else { - obj.pk = []; - } - if (message.dependentRelations) { - obj.dependentRelations = message.dependentRelations.map((e) => Math.round(e)); - } else { - obj.dependentRelations = []; - } - message.optionalAssociatedSourceId?.$case === "associatedSourceId" && - (obj.associatedSourceId = Math.round(message.optionalAssociatedSourceId?.associatedSourceId)); - message.tableType !== undefined && (obj.tableType = table_TableTypeToJSON(message.tableType)); - if (message.distributionKey) { - obj.distributionKey = message.distributionKey.map((e) => Math.round(e)); - } else { - obj.distributionKey = []; - } - if (message.streamKey) { - obj.streamKey = message.streamKey.map((e) => Math.round(e)); - } else { - obj.streamKey = []; - } - message.appendOnly !== undefined && (obj.appendOnly = message.appendOnly); - message.owner !== undefined && (obj.owner = Math.round(message.owner)); - obj.properties = {}; - if (message.properties) { - Object.entries(message.properties).forEach(([k, v]) => { - obj.properties[k] = v; - }); - } - message.fragmentId !== undefined && (obj.fragmentId = Math.round(message.fragmentId)); - message.vnodeColIndex !== undefined && (obj.vnodeColIndex = Math.round(message.vnodeColIndex)); - message.rowIdIndex !== undefined && (obj.rowIdIndex = Math.round(message.rowIdIndex)); - if (message.valueIndices) { - obj.valueIndices = message.valueIndices.map((e) => Math.round(e)); - } else { - obj.valueIndices = []; - } - message.definition !== undefined && (obj.definition = message.definition); - message.handlePkConflictBehavior !== undefined && - (obj.handlePkConflictBehavior = handleConflictBehaviorToJSON(message.handlePkConflictBehavior)); - message.readPrefixLenHint !== undefined && (obj.readPrefixLenHint = Math.round(message.readPrefixLenHint)); - if (message.watermarkIndices) { - obj.watermarkIndices = message.watermarkIndices.map((e) => Math.round(e)); - } else { - obj.watermarkIndices = []; - } - if (message.distKeyInPk) { - obj.distKeyInPk = message.distKeyInPk.map((e) => Math.round(e)); - } else { - obj.distKeyInPk = []; - } - message.version !== undefined && - (obj.version = message.version ? Table_TableVersion.toJSON(message.version) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): Table { - const message = createBaseTable(); - message.id = object.id ?? 0; - message.schemaId = object.schemaId ?? 0; - message.databaseId = object.databaseId ?? 0; - message.name = object.name ?? ""; - message.columns = object.columns?.map((e) => ColumnCatalog.fromPartial(e)) || []; - message.pk = object.pk?.map((e) => ColumnOrder.fromPartial(e)) || []; - message.dependentRelations = object.dependentRelations?.map((e) => e) || []; - if ( - object.optionalAssociatedSourceId?.$case === "associatedSourceId" && - object.optionalAssociatedSourceId?.associatedSourceId !== undefined && - object.optionalAssociatedSourceId?.associatedSourceId !== null - ) { - message.optionalAssociatedSourceId = { - $case: "associatedSourceId", - associatedSourceId: object.optionalAssociatedSourceId.associatedSourceId, - }; - } - message.tableType = object.tableType ?? Table_TableType.UNSPECIFIED; - message.distributionKey = object.distributionKey?.map((e) => e) || []; - message.streamKey = object.streamKey?.map((e) => e) || []; - message.appendOnly = object.appendOnly ?? false; - message.owner = object.owner ?? 0; - message.properties = Object.entries(object.properties ?? {}).reduce<{ [key: string]: string }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[key] = String(value); - } - return acc; - }, - {}, - ); - message.fragmentId = object.fragmentId ?? 0; - message.vnodeColIndex = object.vnodeColIndex ?? undefined; - message.rowIdIndex = object.rowIdIndex ?? undefined; - message.valueIndices = object.valueIndices?.map((e) => e) || []; - message.definition = object.definition ?? ""; - message.handlePkConflictBehavior = object.handlePkConflictBehavior ?? HandleConflictBehavior.NO_CHECK_UNSPECIFIED; - message.readPrefixLenHint = object.readPrefixLenHint ?? 0; - message.watermarkIndices = object.watermarkIndices?.map((e) => e) || []; - message.distKeyInPk = object.distKeyInPk?.map((e) => e) || []; - message.version = (object.version !== undefined && object.version !== null) - ? Table_TableVersion.fromPartial(object.version) - : undefined; - return message; - }, -}; - -function createBaseTable_TableVersion(): Table_TableVersion { - return { version: 0, nextColumnId: 0 }; -} - -export const Table_TableVersion = { - fromJSON(object: any): Table_TableVersion { - return { - version: isSet(object.version) ? Number(object.version) : 0, - nextColumnId: isSet(object.nextColumnId) ? Number(object.nextColumnId) : 0, - }; - }, - - toJSON(message: Table_TableVersion): unknown { - const obj: any = {}; - message.version !== undefined && (obj.version = Math.round(message.version)); - message.nextColumnId !== undefined && (obj.nextColumnId = Math.round(message.nextColumnId)); - return obj; - }, - - fromPartial, I>>(object: I): Table_TableVersion { - const message = createBaseTable_TableVersion(); - message.version = object.version ?? 0; - message.nextColumnId = object.nextColumnId ?? 0; - return message; - }, -}; - -function createBaseTable_PropertiesEntry(): Table_PropertiesEntry { - return { key: "", value: "" }; -} - -export const Table_PropertiesEntry = { - fromJSON(object: any): Table_PropertiesEntry { - return { key: isSet(object.key) ? String(object.key) : "", value: isSet(object.value) ? String(object.value) : "" }; - }, - - toJSON(message: Table_PropertiesEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = message.key); - message.value !== undefined && (obj.value = message.value); - return obj; - }, - - fromPartial, I>>(object: I): Table_PropertiesEntry { - const message = createBaseTable_PropertiesEntry(); - message.key = object.key ?? ""; - message.value = object.value ?? ""; - return message; - }, -}; - -function createBaseView(): View { - return { - id: 0, - schemaId: 0, - databaseId: 0, - name: "", - owner: 0, - properties: {}, - sql: "", - dependentRelations: [], - columns: [], - }; -} - -export const View = { - fromJSON(object: any): View { - return { - id: isSet(object.id) ? Number(object.id) : 0, - schemaId: isSet(object.schemaId) ? Number(object.schemaId) : 0, - databaseId: isSet(object.databaseId) ? Number(object.databaseId) : 0, - name: isSet(object.name) ? String(object.name) : "", - owner: isSet(object.owner) ? Number(object.owner) : 0, - properties: isObject(object.properties) - ? Object.entries(object.properties).reduce<{ [key: string]: string }>((acc, [key, value]) => { - acc[key] = String(value); - return acc; - }, {}) - : {}, - sql: isSet(object.sql) ? String(object.sql) : "", - dependentRelations: Array.isArray(object?.dependentRelations) - ? object.dependentRelations.map((e: any) => Number(e)) - : [], - columns: Array.isArray(object?.columns) - ? object.columns.map((e: any) => Field.fromJSON(e)) - : [], - }; - }, - - toJSON(message: View): unknown { - const obj: any = {}; - message.id !== undefined && (obj.id = Math.round(message.id)); - message.schemaId !== undefined && (obj.schemaId = Math.round(message.schemaId)); - message.databaseId !== undefined && (obj.databaseId = Math.round(message.databaseId)); - message.name !== undefined && (obj.name = message.name); - message.owner !== undefined && (obj.owner = Math.round(message.owner)); - obj.properties = {}; - if (message.properties) { - Object.entries(message.properties).forEach(([k, v]) => { - obj.properties[k] = v; - }); - } - message.sql !== undefined && (obj.sql = message.sql); - if (message.dependentRelations) { - obj.dependentRelations = message.dependentRelations.map((e) => Math.round(e)); - } else { - obj.dependentRelations = []; - } - if (message.columns) { - obj.columns = message.columns.map((e) => e ? Field.toJSON(e) : undefined); - } else { - obj.columns = []; - } - return obj; - }, - - fromPartial, I>>(object: I): View { - const message = createBaseView(); - message.id = object.id ?? 0; - message.schemaId = object.schemaId ?? 0; - message.databaseId = object.databaseId ?? 0; - message.name = object.name ?? ""; - message.owner = object.owner ?? 0; - message.properties = Object.entries(object.properties ?? {}).reduce<{ [key: string]: string }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[key] = String(value); - } - return acc; - }, - {}, - ); - message.sql = object.sql ?? ""; - message.dependentRelations = object.dependentRelations?.map((e) => e) || []; - message.columns = object.columns?.map((e) => Field.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseView_PropertiesEntry(): View_PropertiesEntry { - return { key: "", value: "" }; -} - -export const View_PropertiesEntry = { - fromJSON(object: any): View_PropertiesEntry { - return { key: isSet(object.key) ? String(object.key) : "", value: isSet(object.value) ? String(object.value) : "" }; - }, - - toJSON(message: View_PropertiesEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = message.key); - message.value !== undefined && (obj.value = message.value); - return obj; - }, - - fromPartial, I>>(object: I): View_PropertiesEntry { - const message = createBaseView_PropertiesEntry(); - message.key = object.key ?? ""; - message.value = object.value ?? ""; - return message; - }, -}; - -function createBaseSchema(): Schema { - return { id: 0, databaseId: 0, name: "", owner: 0 }; -} - -export const Schema = { - fromJSON(object: any): Schema { - return { - id: isSet(object.id) ? Number(object.id) : 0, - databaseId: isSet(object.databaseId) ? Number(object.databaseId) : 0, - name: isSet(object.name) ? String(object.name) : "", - owner: isSet(object.owner) ? Number(object.owner) : 0, - }; - }, - - toJSON(message: Schema): unknown { - const obj: any = {}; - message.id !== undefined && (obj.id = Math.round(message.id)); - message.databaseId !== undefined && (obj.databaseId = Math.round(message.databaseId)); - message.name !== undefined && (obj.name = message.name); - message.owner !== undefined && (obj.owner = Math.round(message.owner)); - return obj; - }, - - fromPartial, I>>(object: I): Schema { - const message = createBaseSchema(); - message.id = object.id ?? 0; - message.databaseId = object.databaseId ?? 0; - message.name = object.name ?? ""; - message.owner = object.owner ?? 0; - return message; - }, -}; - -function createBaseDatabase(): Database { - return { id: 0, name: "", owner: 0 }; -} - -export const Database = { - fromJSON(object: any): Database { - return { - id: isSet(object.id) ? Number(object.id) : 0, - name: isSet(object.name) ? String(object.name) : "", - owner: isSet(object.owner) ? Number(object.owner) : 0, - }; - }, - - toJSON(message: Database): unknown { - const obj: any = {}; - message.id !== undefined && (obj.id = Math.round(message.id)); - message.name !== undefined && (obj.name = message.name); - message.owner !== undefined && (obj.owner = Math.round(message.owner)); - return obj; - }, - - fromPartial, I>>(object: I): Database { - const message = createBaseDatabase(); - message.id = object.id ?? 0; - message.name = object.name ?? ""; - message.owner = object.owner ?? 0; - return message; - }, -}; - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> - : T extends { $case: string } ? { [K in keyof Omit]?: DeepPartial } & { $case: T["$case"] } - : T extends {} ? { [K in keyof T]?: DeepPartial } - : Partial; - -type KeysOfUnion = T extends T ? keyof T : never; -export type Exact = P extends Builtin ? P - : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; - -function isObject(value: any): boolean { - return typeof value === "object" && value !== null; -} - -function isSet(value: any): boolean { - return value !== null && value !== undefined; -} diff --git a/dashboard/proto/gen/common.ts b/dashboard/proto/gen/common.ts deleted file mode 100644 index 4ebe859a7f48..000000000000 --- a/dashboard/proto/gen/common.ts +++ /dev/null @@ -1,700 +0,0 @@ -/* eslint-disable */ - -export const protobufPackage = "common"; - -export const WorkerType = { - UNSPECIFIED: "UNSPECIFIED", - FRONTEND: "FRONTEND", - COMPUTE_NODE: "COMPUTE_NODE", - RISE_CTL: "RISE_CTL", - COMPACTOR: "COMPACTOR", - META: "META", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type WorkerType = typeof WorkerType[keyof typeof WorkerType]; - -export function workerTypeFromJSON(object: any): WorkerType { - switch (object) { - case 0: - case "UNSPECIFIED": - return WorkerType.UNSPECIFIED; - case 1: - case "FRONTEND": - return WorkerType.FRONTEND; - case 2: - case "COMPUTE_NODE": - return WorkerType.COMPUTE_NODE; - case 3: - case "RISE_CTL": - return WorkerType.RISE_CTL; - case 4: - case "COMPACTOR": - return WorkerType.COMPACTOR; - case 5: - case "META": - return WorkerType.META; - case -1: - case "UNRECOGNIZED": - default: - return WorkerType.UNRECOGNIZED; - } -} - -export function workerTypeToJSON(object: WorkerType): string { - switch (object) { - case WorkerType.UNSPECIFIED: - return "UNSPECIFIED"; - case WorkerType.FRONTEND: - return "FRONTEND"; - case WorkerType.COMPUTE_NODE: - return "COMPUTE_NODE"; - case WorkerType.RISE_CTL: - return "RISE_CTL"; - case WorkerType.COMPACTOR: - return "COMPACTOR"; - case WorkerType.META: - return "META"; - case WorkerType.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export const Direction = { - DIRECTION_UNSPECIFIED: "DIRECTION_UNSPECIFIED", - DIRECTION_ASCENDING: "DIRECTION_ASCENDING", - DIRECTION_DESCENDING: "DIRECTION_DESCENDING", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type Direction = typeof Direction[keyof typeof Direction]; - -export function directionFromJSON(object: any): Direction { - switch (object) { - case 0: - case "DIRECTION_UNSPECIFIED": - return Direction.DIRECTION_UNSPECIFIED; - case 1: - case "DIRECTION_ASCENDING": - return Direction.DIRECTION_ASCENDING; - case 2: - case "DIRECTION_DESCENDING": - return Direction.DIRECTION_DESCENDING; - case -1: - case "UNRECOGNIZED": - default: - return Direction.UNRECOGNIZED; - } -} - -export function directionToJSON(object: Direction): string { - switch (object) { - case Direction.DIRECTION_UNSPECIFIED: - return "DIRECTION_UNSPECIFIED"; - case Direction.DIRECTION_ASCENDING: - return "DIRECTION_ASCENDING"; - case Direction.DIRECTION_DESCENDING: - return "DIRECTION_DESCENDING"; - case Direction.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export const NullsAre = { - NULLS_ARE_UNSPECIFIED: "NULLS_ARE_UNSPECIFIED", - NULLS_ARE_LARGEST: "NULLS_ARE_LARGEST", - NULLS_ARE_SMALLEST: "NULLS_ARE_SMALLEST", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type NullsAre = typeof NullsAre[keyof typeof NullsAre]; - -export function nullsAreFromJSON(object: any): NullsAre { - switch (object) { - case 0: - case "NULLS_ARE_UNSPECIFIED": - return NullsAre.NULLS_ARE_UNSPECIFIED; - case 1: - case "NULLS_ARE_LARGEST": - return NullsAre.NULLS_ARE_LARGEST; - case 2: - case "NULLS_ARE_SMALLEST": - return NullsAre.NULLS_ARE_SMALLEST; - case -1: - case "UNRECOGNIZED": - default: - return NullsAre.UNRECOGNIZED; - } -} - -export function nullsAreToJSON(object: NullsAre): string { - switch (object) { - case NullsAre.NULLS_ARE_UNSPECIFIED: - return "NULLS_ARE_UNSPECIFIED"; - case NullsAre.NULLS_ARE_LARGEST: - return "NULLS_ARE_LARGEST"; - case NullsAre.NULLS_ARE_SMALLEST: - return "NULLS_ARE_SMALLEST"; - case NullsAre.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export interface Status { - code: Status_Code; - message: string; -} - -export const Status_Code = { - UNSPECIFIED: "UNSPECIFIED", - OK: "OK", - UNKNOWN_WORKER: "UNKNOWN_WORKER", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type Status_Code = typeof Status_Code[keyof typeof Status_Code]; - -export function status_CodeFromJSON(object: any): Status_Code { - switch (object) { - case 0: - case "UNSPECIFIED": - return Status_Code.UNSPECIFIED; - case 1: - case "OK": - return Status_Code.OK; - case 2: - case "UNKNOWN_WORKER": - return Status_Code.UNKNOWN_WORKER; - case -1: - case "UNRECOGNIZED": - default: - return Status_Code.UNRECOGNIZED; - } -} - -export function status_CodeToJSON(object: Status_Code): string { - switch (object) { - case Status_Code.UNSPECIFIED: - return "UNSPECIFIED"; - case Status_Code.OK: - return "OK"; - case Status_Code.UNKNOWN_WORKER: - return "UNKNOWN_WORKER"; - case Status_Code.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export interface HostAddress { - host: string; - port: number; -} - -/** Encode which host machine an actor resides. */ -export interface ActorInfo { - actorId: number; - host: HostAddress | undefined; -} - -export interface ParallelUnit { - id: number; - workerNodeId: number; -} - -export interface WorkerNode { - id: number; - type: WorkerType; - host: HostAddress | undefined; - state: WorkerNode_State; - parallelUnits: ParallelUnit[]; -} - -export const WorkerNode_State = { - UNSPECIFIED: "UNSPECIFIED", - STARTING: "STARTING", - RUNNING: "RUNNING", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type WorkerNode_State = typeof WorkerNode_State[keyof typeof WorkerNode_State]; - -export function workerNode_StateFromJSON(object: any): WorkerNode_State { - switch (object) { - case 0: - case "UNSPECIFIED": - return WorkerNode_State.UNSPECIFIED; - case 1: - case "STARTING": - return WorkerNode_State.STARTING; - case 2: - case "RUNNING": - return WorkerNode_State.RUNNING; - case -1: - case "UNRECOGNIZED": - default: - return WorkerNode_State.UNRECOGNIZED; - } -} - -export function workerNode_StateToJSON(object: WorkerNode_State): string { - switch (object) { - case WorkerNode_State.UNSPECIFIED: - return "UNSPECIFIED"; - case WorkerNode_State.STARTING: - return "STARTING"; - case WorkerNode_State.RUNNING: - return "RUNNING"; - case WorkerNode_State.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export interface Buffer { - compression: Buffer_CompressionType; - body: Uint8Array; -} - -export const Buffer_CompressionType = { - UNSPECIFIED: "UNSPECIFIED", - NONE: "NONE", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type Buffer_CompressionType = typeof Buffer_CompressionType[keyof typeof Buffer_CompressionType]; - -export function buffer_CompressionTypeFromJSON(object: any): Buffer_CompressionType { - switch (object) { - case 0: - case "UNSPECIFIED": - return Buffer_CompressionType.UNSPECIFIED; - case 1: - case "NONE": - return Buffer_CompressionType.NONE; - case -1: - case "UNRECOGNIZED": - default: - return Buffer_CompressionType.UNRECOGNIZED; - } -} - -export function buffer_CompressionTypeToJSON(object: Buffer_CompressionType): string { - switch (object) { - case Buffer_CompressionType.UNSPECIFIED: - return "UNSPECIFIED"; - case Buffer_CompressionType.NONE: - return "NONE"; - case Buffer_CompressionType.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -/** Vnode mapping for stream fragments. Stores mapping from virtual node to parallel unit id. */ -export interface ParallelUnitMapping { - originalIndices: number[]; - data: number[]; -} - -export interface BatchQueryEpoch { - epoch?: { $case: "committed"; committed: number } | { $case: "current"; current: number } | { - $case: "backup"; - backup: number; - }; -} - -export interface OrderType { - direction: Direction; - nullsAre: NullsAre; -} - -/** Column index with an order type (ASC or DESC). Used to represent a sort key (`repeated ColumnOrder`). */ -export interface ColumnOrder { - columnIndex: number; - orderType: OrderType | undefined; -} - -function createBaseStatus(): Status { - return { code: Status_Code.UNSPECIFIED, message: "" }; -} - -export const Status = { - fromJSON(object: any): Status { - return { - code: isSet(object.code) ? status_CodeFromJSON(object.code) : Status_Code.UNSPECIFIED, - message: isSet(object.message) ? String(object.message) : "", - }; - }, - - toJSON(message: Status): unknown { - const obj: any = {}; - message.code !== undefined && (obj.code = status_CodeToJSON(message.code)); - message.message !== undefined && (obj.message = message.message); - return obj; - }, - - fromPartial, I>>(object: I): Status { - const message = createBaseStatus(); - message.code = object.code ?? Status_Code.UNSPECIFIED; - message.message = object.message ?? ""; - return message; - }, -}; - -function createBaseHostAddress(): HostAddress { - return { host: "", port: 0 }; -} - -export const HostAddress = { - fromJSON(object: any): HostAddress { - return { host: isSet(object.host) ? String(object.host) : "", port: isSet(object.port) ? Number(object.port) : 0 }; - }, - - toJSON(message: HostAddress): unknown { - const obj: any = {}; - message.host !== undefined && (obj.host = message.host); - message.port !== undefined && (obj.port = Math.round(message.port)); - return obj; - }, - - fromPartial, I>>(object: I): HostAddress { - const message = createBaseHostAddress(); - message.host = object.host ?? ""; - message.port = object.port ?? 0; - return message; - }, -}; - -function createBaseActorInfo(): ActorInfo { - return { actorId: 0, host: undefined }; -} - -export const ActorInfo = { - fromJSON(object: any): ActorInfo { - return { - actorId: isSet(object.actorId) ? Number(object.actorId) : 0, - host: isSet(object.host) ? HostAddress.fromJSON(object.host) : undefined, - }; - }, - - toJSON(message: ActorInfo): unknown { - const obj: any = {}; - message.actorId !== undefined && (obj.actorId = Math.round(message.actorId)); - message.host !== undefined && (obj.host = message.host ? HostAddress.toJSON(message.host) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): ActorInfo { - const message = createBaseActorInfo(); - message.actorId = object.actorId ?? 0; - message.host = (object.host !== undefined && object.host !== null) - ? HostAddress.fromPartial(object.host) - : undefined; - return message; - }, -}; - -function createBaseParallelUnit(): ParallelUnit { - return { id: 0, workerNodeId: 0 }; -} - -export const ParallelUnit = { - fromJSON(object: any): ParallelUnit { - return { - id: isSet(object.id) ? Number(object.id) : 0, - workerNodeId: isSet(object.workerNodeId) ? Number(object.workerNodeId) : 0, - }; - }, - - toJSON(message: ParallelUnit): unknown { - const obj: any = {}; - message.id !== undefined && (obj.id = Math.round(message.id)); - message.workerNodeId !== undefined && (obj.workerNodeId = Math.round(message.workerNodeId)); - return obj; - }, - - fromPartial, I>>(object: I): ParallelUnit { - const message = createBaseParallelUnit(); - message.id = object.id ?? 0; - message.workerNodeId = object.workerNodeId ?? 0; - return message; - }, -}; - -function createBaseWorkerNode(): WorkerNode { - return { - id: 0, - type: WorkerType.UNSPECIFIED, - host: undefined, - state: WorkerNode_State.UNSPECIFIED, - parallelUnits: [], - }; -} - -export const WorkerNode = { - fromJSON(object: any): WorkerNode { - return { - id: isSet(object.id) ? Number(object.id) : 0, - type: isSet(object.type) ? workerTypeFromJSON(object.type) : WorkerType.UNSPECIFIED, - host: isSet(object.host) ? HostAddress.fromJSON(object.host) : undefined, - state: isSet(object.state) ? workerNode_StateFromJSON(object.state) : WorkerNode_State.UNSPECIFIED, - parallelUnits: Array.isArray(object?.parallelUnits) - ? object.parallelUnits.map((e: any) => ParallelUnit.fromJSON(e)) - : [], - }; - }, - - toJSON(message: WorkerNode): unknown { - const obj: any = {}; - message.id !== undefined && (obj.id = Math.round(message.id)); - message.type !== undefined && (obj.type = workerTypeToJSON(message.type)); - message.host !== undefined && (obj.host = message.host ? HostAddress.toJSON(message.host) : undefined); - message.state !== undefined && (obj.state = workerNode_StateToJSON(message.state)); - if (message.parallelUnits) { - obj.parallelUnits = message.parallelUnits.map((e) => e ? ParallelUnit.toJSON(e) : undefined); - } else { - obj.parallelUnits = []; - } - return obj; - }, - - fromPartial, I>>(object: I): WorkerNode { - const message = createBaseWorkerNode(); - message.id = object.id ?? 0; - message.type = object.type ?? WorkerType.UNSPECIFIED; - message.host = (object.host !== undefined && object.host !== null) - ? HostAddress.fromPartial(object.host) - : undefined; - message.state = object.state ?? WorkerNode_State.UNSPECIFIED; - message.parallelUnits = object.parallelUnits?.map((e) => ParallelUnit.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseBuffer(): Buffer { - return { compression: Buffer_CompressionType.UNSPECIFIED, body: new Uint8Array() }; -} - -export const Buffer = { - fromJSON(object: any): Buffer { - return { - compression: isSet(object.compression) - ? buffer_CompressionTypeFromJSON(object.compression) - : Buffer_CompressionType.UNSPECIFIED, - body: isSet(object.body) ? bytesFromBase64(object.body) : new Uint8Array(), - }; - }, - - toJSON(message: Buffer): unknown { - const obj: any = {}; - message.compression !== undefined && (obj.compression = buffer_CompressionTypeToJSON(message.compression)); - message.body !== undefined && - (obj.body = base64FromBytes(message.body !== undefined ? message.body : new Uint8Array())); - return obj; - }, - - fromPartial, I>>(object: I): Buffer { - const message = createBaseBuffer(); - message.compression = object.compression ?? Buffer_CompressionType.UNSPECIFIED; - message.body = object.body ?? new Uint8Array(); - return message; - }, -}; - -function createBaseParallelUnitMapping(): ParallelUnitMapping { - return { originalIndices: [], data: [] }; -} - -export const ParallelUnitMapping = { - fromJSON(object: any): ParallelUnitMapping { - return { - originalIndices: Array.isArray(object?.originalIndices) ? object.originalIndices.map((e: any) => Number(e)) : [], - data: Array.isArray(object?.data) ? object.data.map((e: any) => Number(e)) : [], - }; - }, - - toJSON(message: ParallelUnitMapping): unknown { - const obj: any = {}; - if (message.originalIndices) { - obj.originalIndices = message.originalIndices.map((e) => Math.round(e)); - } else { - obj.originalIndices = []; - } - if (message.data) { - obj.data = message.data.map((e) => Math.round(e)); - } else { - obj.data = []; - } - return obj; - }, - - fromPartial, I>>(object: I): ParallelUnitMapping { - const message = createBaseParallelUnitMapping(); - message.originalIndices = object.originalIndices?.map((e) => e) || []; - message.data = object.data?.map((e) => e) || []; - return message; - }, -}; - -function createBaseBatchQueryEpoch(): BatchQueryEpoch { - return { epoch: undefined }; -} - -export const BatchQueryEpoch = { - fromJSON(object: any): BatchQueryEpoch { - return { - epoch: isSet(object.committed) - ? { $case: "committed", committed: Number(object.committed) } - : isSet(object.current) - ? { $case: "current", current: Number(object.current) } - : isSet(object.backup) - ? { $case: "backup", backup: Number(object.backup) } - : undefined, - }; - }, - - toJSON(message: BatchQueryEpoch): unknown { - const obj: any = {}; - message.epoch?.$case === "committed" && (obj.committed = Math.round(message.epoch?.committed)); - message.epoch?.$case === "current" && (obj.current = Math.round(message.epoch?.current)); - message.epoch?.$case === "backup" && (obj.backup = Math.round(message.epoch?.backup)); - return obj; - }, - - fromPartial, I>>(object: I): BatchQueryEpoch { - const message = createBaseBatchQueryEpoch(); - if ( - object.epoch?.$case === "committed" && object.epoch?.committed !== undefined && object.epoch?.committed !== null - ) { - message.epoch = { $case: "committed", committed: object.epoch.committed }; - } - if (object.epoch?.$case === "current" && object.epoch?.current !== undefined && object.epoch?.current !== null) { - message.epoch = { $case: "current", current: object.epoch.current }; - } - if (object.epoch?.$case === "backup" && object.epoch?.backup !== undefined && object.epoch?.backup !== null) { - message.epoch = { $case: "backup", backup: object.epoch.backup }; - } - return message; - }, -}; - -function createBaseOrderType(): OrderType { - return { direction: Direction.DIRECTION_UNSPECIFIED, nullsAre: NullsAre.NULLS_ARE_UNSPECIFIED }; -} - -export const OrderType = { - fromJSON(object: any): OrderType { - return { - direction: isSet(object.direction) ? directionFromJSON(object.direction) : Direction.DIRECTION_UNSPECIFIED, - nullsAre: isSet(object.nullsAre) ? nullsAreFromJSON(object.nullsAre) : NullsAre.NULLS_ARE_UNSPECIFIED, - }; - }, - - toJSON(message: OrderType): unknown { - const obj: any = {}; - message.direction !== undefined && (obj.direction = directionToJSON(message.direction)); - message.nullsAre !== undefined && (obj.nullsAre = nullsAreToJSON(message.nullsAre)); - return obj; - }, - - fromPartial, I>>(object: I): OrderType { - const message = createBaseOrderType(); - message.direction = object.direction ?? Direction.DIRECTION_UNSPECIFIED; - message.nullsAre = object.nullsAre ?? NullsAre.NULLS_ARE_UNSPECIFIED; - return message; - }, -}; - -function createBaseColumnOrder(): ColumnOrder { - return { columnIndex: 0, orderType: undefined }; -} - -export const ColumnOrder = { - fromJSON(object: any): ColumnOrder { - return { - columnIndex: isSet(object.columnIndex) ? Number(object.columnIndex) : 0, - orderType: isSet(object.orderType) ? OrderType.fromJSON(object.orderType) : undefined, - }; - }, - - toJSON(message: ColumnOrder): unknown { - const obj: any = {}; - message.columnIndex !== undefined && (obj.columnIndex = Math.round(message.columnIndex)); - message.orderType !== undefined && - (obj.orderType = message.orderType ? OrderType.toJSON(message.orderType) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): ColumnOrder { - const message = createBaseColumnOrder(); - message.columnIndex = object.columnIndex ?? 0; - message.orderType = (object.orderType !== undefined && object.orderType !== null) - ? OrderType.fromPartial(object.orderType) - : undefined; - return message; - }, -}; - -declare var self: any | undefined; -declare var window: any | undefined; -declare var global: any | undefined; -var globalThis: any = (() => { - if (typeof globalThis !== "undefined") { - return globalThis; - } - if (typeof self !== "undefined") { - return self; - } - if (typeof window !== "undefined") { - return window; - } - if (typeof global !== "undefined") { - return global; - } - throw "Unable to locate global object"; -})(); - -function bytesFromBase64(b64: string): Uint8Array { - if (globalThis.Buffer) { - return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); - } else { - const bin = globalThis.atob(b64); - const arr = new Uint8Array(bin.length); - for (let i = 0; i < bin.length; ++i) { - arr[i] = bin.charCodeAt(i); - } - return arr; - } -} - -function base64FromBytes(arr: Uint8Array): string { - if (globalThis.Buffer) { - return globalThis.Buffer.from(arr).toString("base64"); - } else { - const bin: string[] = []; - arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); - }); - return globalThis.btoa(bin.join("")); - } -} - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> - : T extends { $case: string } ? { [K in keyof Omit]?: DeepPartial } & { $case: T["$case"] } - : T extends {} ? { [K in keyof T]?: DeepPartial } - : Partial; - -type KeysOfUnion = T extends T ? keyof T : never; -export type Exact = P extends Builtin ? P - : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; - -function isSet(value: any): boolean { - return value !== null && value !== undefined; -} diff --git a/dashboard/proto/gen/compactor.ts b/dashboard/proto/gen/compactor.ts deleted file mode 100644 index 3fee992c1f71..000000000000 --- a/dashboard/proto/gen/compactor.ts +++ /dev/null @@ -1,100 +0,0 @@ -/* eslint-disable */ - -export const protobufPackage = "compactor"; - -export interface CompactorRuntimeConfig { - maxConcurrentTaskNumber: number; -} - -export interface SetRuntimeConfigRequest { - config: CompactorRuntimeConfig | undefined; -} - -export interface SetRuntimeConfigResponse { -} - -function createBaseCompactorRuntimeConfig(): CompactorRuntimeConfig { - return { maxConcurrentTaskNumber: 0 }; -} - -export const CompactorRuntimeConfig = { - fromJSON(object: any): CompactorRuntimeConfig { - return { - maxConcurrentTaskNumber: isSet(object.maxConcurrentTaskNumber) ? Number(object.maxConcurrentTaskNumber) : 0, - }; - }, - - toJSON(message: CompactorRuntimeConfig): unknown { - const obj: any = {}; - message.maxConcurrentTaskNumber !== undefined && - (obj.maxConcurrentTaskNumber = Math.round(message.maxConcurrentTaskNumber)); - return obj; - }, - - fromPartial, I>>(object: I): CompactorRuntimeConfig { - const message = createBaseCompactorRuntimeConfig(); - message.maxConcurrentTaskNumber = object.maxConcurrentTaskNumber ?? 0; - return message; - }, -}; - -function createBaseSetRuntimeConfigRequest(): SetRuntimeConfigRequest { - return { config: undefined }; -} - -export const SetRuntimeConfigRequest = { - fromJSON(object: any): SetRuntimeConfigRequest { - return { config: isSet(object.config) ? CompactorRuntimeConfig.fromJSON(object.config) : undefined }; - }, - - toJSON(message: SetRuntimeConfigRequest): unknown { - const obj: any = {}; - message.config !== undefined && - (obj.config = message.config ? CompactorRuntimeConfig.toJSON(message.config) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): SetRuntimeConfigRequest { - const message = createBaseSetRuntimeConfigRequest(); - message.config = (object.config !== undefined && object.config !== null) - ? CompactorRuntimeConfig.fromPartial(object.config) - : undefined; - return message; - }, -}; - -function createBaseSetRuntimeConfigResponse(): SetRuntimeConfigResponse { - return {}; -} - -export const SetRuntimeConfigResponse = { - fromJSON(_: any): SetRuntimeConfigResponse { - return {}; - }, - - toJSON(_: SetRuntimeConfigResponse): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): SetRuntimeConfigResponse { - const message = createBaseSetRuntimeConfigResponse(); - return message; - }, -}; - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> - : T extends { $case: string } ? { [K in keyof Omit]?: DeepPartial } & { $case: T["$case"] } - : T extends {} ? { [K in keyof T]?: DeepPartial } - : Partial; - -type KeysOfUnion = T extends T ? keyof T : never; -export type Exact = P extends Builtin ? P - : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; - -function isSet(value: any): boolean { - return value !== null && value !== undefined; -} diff --git a/dashboard/proto/gen/compute.ts b/dashboard/proto/gen/compute.ts deleted file mode 100644 index 95d659523263..000000000000 --- a/dashboard/proto/gen/compute.ts +++ /dev/null @@ -1,74 +0,0 @@ -/* eslint-disable */ - -export const protobufPackage = "compute"; - -export interface ShowConfigRequest { -} - -export interface ShowConfigResponse { - batchConfig: string; - streamConfig: string; -} - -function createBaseShowConfigRequest(): ShowConfigRequest { - return {}; -} - -export const ShowConfigRequest = { - fromJSON(_: any): ShowConfigRequest { - return {}; - }, - - toJSON(_: ShowConfigRequest): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): ShowConfigRequest { - const message = createBaseShowConfigRequest(); - return message; - }, -}; - -function createBaseShowConfigResponse(): ShowConfigResponse { - return { batchConfig: "", streamConfig: "" }; -} - -export const ShowConfigResponse = { - fromJSON(object: any): ShowConfigResponse { - return { - batchConfig: isSet(object.batchConfig) ? String(object.batchConfig) : "", - streamConfig: isSet(object.streamConfig) ? String(object.streamConfig) : "", - }; - }, - - toJSON(message: ShowConfigResponse): unknown { - const obj: any = {}; - message.batchConfig !== undefined && (obj.batchConfig = message.batchConfig); - message.streamConfig !== undefined && (obj.streamConfig = message.streamConfig); - return obj; - }, - - fromPartial, I>>(object: I): ShowConfigResponse { - const message = createBaseShowConfigResponse(); - message.batchConfig = object.batchConfig ?? ""; - message.streamConfig = object.streamConfig ?? ""; - return message; - }, -}; - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> - : T extends { $case: string } ? { [K in keyof Omit]?: DeepPartial } & { $case: T["$case"] } - : T extends {} ? { [K in keyof T]?: DeepPartial } - : Partial; - -type KeysOfUnion = T extends T ? keyof T : never; -export type Exact = P extends Builtin ? P - : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; - -function isSet(value: any): boolean { - return value !== null && value !== undefined; -} diff --git a/dashboard/proto/gen/connector_service.ts b/dashboard/proto/gen/connector_service.ts deleted file mode 100644 index ae78e31e5ee3..000000000000 --- a/dashboard/proto/gen/connector_service.ts +++ /dev/null @@ -1,1217 +0,0 @@ -/* eslint-disable */ -import { SinkType, sinkTypeFromJSON, sinkTypeToJSON } from "./catalog"; -import { - DataType_TypeName, - dataType_TypeNameFromJSON, - dataType_TypeNameToJSON, - Op, - opFromJSON, - opToJSON, -} from "./data"; - -export const protobufPackage = "connector_service"; - -export const SinkPayloadFormat = { - FORMAT_UNSPECIFIED: "FORMAT_UNSPECIFIED", - JSON: "JSON", - STREAM_CHUNK: "STREAM_CHUNK", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type SinkPayloadFormat = typeof SinkPayloadFormat[keyof typeof SinkPayloadFormat]; - -export function sinkPayloadFormatFromJSON(object: any): SinkPayloadFormat { - switch (object) { - case 0: - case "FORMAT_UNSPECIFIED": - return SinkPayloadFormat.FORMAT_UNSPECIFIED; - case 1: - case "JSON": - return SinkPayloadFormat.JSON; - case 2: - case "STREAM_CHUNK": - return SinkPayloadFormat.STREAM_CHUNK; - case -1: - case "UNRECOGNIZED": - default: - return SinkPayloadFormat.UNRECOGNIZED; - } -} - -export function sinkPayloadFormatToJSON(object: SinkPayloadFormat): string { - switch (object) { - case SinkPayloadFormat.FORMAT_UNSPECIFIED: - return "FORMAT_UNSPECIFIED"; - case SinkPayloadFormat.JSON: - return "JSON"; - case SinkPayloadFormat.STREAM_CHUNK: - return "STREAM_CHUNK"; - case SinkPayloadFormat.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export const SourceType = { - UNSPECIFIED: "UNSPECIFIED", - MYSQL: "MYSQL", - POSTGRES: "POSTGRES", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type SourceType = typeof SourceType[keyof typeof SourceType]; - -export function sourceTypeFromJSON(object: any): SourceType { - switch (object) { - case 0: - case "UNSPECIFIED": - return SourceType.UNSPECIFIED; - case 1: - case "MYSQL": - return SourceType.MYSQL; - case 2: - case "POSTGRES": - return SourceType.POSTGRES; - case -1: - case "UNRECOGNIZED": - default: - return SourceType.UNRECOGNIZED; - } -} - -export function sourceTypeToJSON(object: SourceType): string { - switch (object) { - case SourceType.UNSPECIFIED: - return "UNSPECIFIED"; - case SourceType.MYSQL: - return "MYSQL"; - case SourceType.POSTGRES: - return "POSTGRES"; - case SourceType.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export interface TableSchema { - columns: TableSchema_Column[]; - pkIndices: number[]; -} - -export interface TableSchema_Column { - name: string; - dataType: DataType_TypeName; -} - -export interface ValidationError { - errorMessage: string; -} - -export interface SinkConfig { - connectorType: string; - properties: { [key: string]: string }; - tableSchema: TableSchema | undefined; -} - -export interface SinkConfig_PropertiesEntry { - key: string; - value: string; -} - -export interface SinkStreamRequest { - request?: - | { $case: "start"; start: SinkStreamRequest_StartSink } - | { $case: "startEpoch"; startEpoch: SinkStreamRequest_StartEpoch } - | { $case: "write"; write: SinkStreamRequest_WriteBatch } - | { $case: "sync"; sync: SinkStreamRequest_SyncBatch }; -} - -export interface SinkStreamRequest_StartSink { - sinkConfig: SinkConfig | undefined; - format: SinkPayloadFormat; -} - -export interface SinkStreamRequest_WriteBatch { - payload?: { $case: "jsonPayload"; jsonPayload: SinkStreamRequest_WriteBatch_JsonPayload } | { - $case: "streamChunkPayload"; - streamChunkPayload: SinkStreamRequest_WriteBatch_StreamChunkPayload; - }; - batchId: number; - epoch: number; -} - -export interface SinkStreamRequest_WriteBatch_JsonPayload { - rowOps: SinkStreamRequest_WriteBatch_JsonPayload_RowOp[]; -} - -export interface SinkStreamRequest_WriteBatch_JsonPayload_RowOp { - opType: Op; - line: string; -} - -export interface SinkStreamRequest_WriteBatch_StreamChunkPayload { - binaryData: Uint8Array; -} - -export interface SinkStreamRequest_StartEpoch { - epoch: number; -} - -export interface SinkStreamRequest_SyncBatch { - epoch: number; -} - -export interface SinkResponse { - response?: - | { $case: "sync"; sync: SinkResponse_SyncResponse } - | { $case: "startEpoch"; startEpoch: SinkResponse_StartEpochResponse } - | { $case: "write"; write: SinkResponse_WriteResponse } - | { $case: "start"; start: SinkResponse_StartResponse }; -} - -export interface SinkResponse_SyncResponse { - epoch: number; -} - -export interface SinkResponse_StartEpochResponse { - epoch: number; -} - -export interface SinkResponse_WriteResponse { - epoch: number; - batchId: number; -} - -export interface SinkResponse_StartResponse { -} - -export interface ValidateSinkRequest { - sinkConfig: SinkConfig | undefined; - sinkType: SinkType; -} - -export interface ValidateSinkResponse { - /** On validation failure, we return the error. */ - error: ValidationError | undefined; -} - -export interface CdcMessage { - payload: string; - partition: string; - offset: string; -} - -export interface GetEventStreamRequest { - request?: { $case: "validate"; validate: GetEventStreamRequest_ValidateProperties } | { - $case: "start"; - start: GetEventStreamRequest_StartSource; - }; -} - -export interface GetEventStreamRequest_ValidateProperties { - sourceId: number; - sourceType: SourceType; - properties: { [key: string]: string }; - tableSchema: TableSchema | undefined; -} - -export interface GetEventStreamRequest_ValidateProperties_PropertiesEntry { - key: string; - value: string; -} - -export interface GetEventStreamRequest_StartSource { - sourceId: number; - sourceType: SourceType; - startOffset: string; - properties: { [key: string]: string }; -} - -export interface GetEventStreamRequest_StartSource_PropertiesEntry { - key: string; - value: string; -} - -export interface GetEventStreamResponse { - sourceId: number; - events: CdcMessage[]; -} - -function createBaseTableSchema(): TableSchema { - return { columns: [], pkIndices: [] }; -} - -export const TableSchema = { - fromJSON(object: any): TableSchema { - return { - columns: Array.isArray(object?.columns) ? object.columns.map((e: any) => TableSchema_Column.fromJSON(e)) : [], - pkIndices: Array.isArray(object?.pkIndices) ? object.pkIndices.map((e: any) => Number(e)) : [], - }; - }, - - toJSON(message: TableSchema): unknown { - const obj: any = {}; - if (message.columns) { - obj.columns = message.columns.map((e) => e ? TableSchema_Column.toJSON(e) : undefined); - } else { - obj.columns = []; - } - if (message.pkIndices) { - obj.pkIndices = message.pkIndices.map((e) => Math.round(e)); - } else { - obj.pkIndices = []; - } - return obj; - }, - - fromPartial, I>>(object: I): TableSchema { - const message = createBaseTableSchema(); - message.columns = object.columns?.map((e) => TableSchema_Column.fromPartial(e)) || []; - message.pkIndices = object.pkIndices?.map((e) => e) || []; - return message; - }, -}; - -function createBaseTableSchema_Column(): TableSchema_Column { - return { name: "", dataType: DataType_TypeName.TYPE_UNSPECIFIED }; -} - -export const TableSchema_Column = { - fromJSON(object: any): TableSchema_Column { - return { - name: isSet(object.name) ? String(object.name) : "", - dataType: isSet(object.dataType) - ? dataType_TypeNameFromJSON(object.dataType) - : DataType_TypeName.TYPE_UNSPECIFIED, - }; - }, - - toJSON(message: TableSchema_Column): unknown { - const obj: any = {}; - message.name !== undefined && (obj.name = message.name); - message.dataType !== undefined && (obj.dataType = dataType_TypeNameToJSON(message.dataType)); - return obj; - }, - - fromPartial, I>>(object: I): TableSchema_Column { - const message = createBaseTableSchema_Column(); - message.name = object.name ?? ""; - message.dataType = object.dataType ?? DataType_TypeName.TYPE_UNSPECIFIED; - return message; - }, -}; - -function createBaseValidationError(): ValidationError { - return { errorMessage: "" }; -} - -export const ValidationError = { - fromJSON(object: any): ValidationError { - return { errorMessage: isSet(object.errorMessage) ? String(object.errorMessage) : "" }; - }, - - toJSON(message: ValidationError): unknown { - const obj: any = {}; - message.errorMessage !== undefined && (obj.errorMessage = message.errorMessage); - return obj; - }, - - fromPartial, I>>(object: I): ValidationError { - const message = createBaseValidationError(); - message.errorMessage = object.errorMessage ?? ""; - return message; - }, -}; - -function createBaseSinkConfig(): SinkConfig { - return { connectorType: "", properties: {}, tableSchema: undefined }; -} - -export const SinkConfig = { - fromJSON(object: any): SinkConfig { - return { - connectorType: isSet(object.connectorType) ? String(object.connectorType) : "", - properties: isObject(object.properties) - ? Object.entries(object.properties).reduce<{ [key: string]: string }>((acc, [key, value]) => { - acc[key] = String(value); - return acc; - }, {}) - : {}, - tableSchema: isSet(object.tableSchema) ? TableSchema.fromJSON(object.tableSchema) : undefined, - }; - }, - - toJSON(message: SinkConfig): unknown { - const obj: any = {}; - message.connectorType !== undefined && (obj.connectorType = message.connectorType); - obj.properties = {}; - if (message.properties) { - Object.entries(message.properties).forEach(([k, v]) => { - obj.properties[k] = v; - }); - } - message.tableSchema !== undefined && - (obj.tableSchema = message.tableSchema ? TableSchema.toJSON(message.tableSchema) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): SinkConfig { - const message = createBaseSinkConfig(); - message.connectorType = object.connectorType ?? ""; - message.properties = Object.entries(object.properties ?? {}).reduce<{ [key: string]: string }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[key] = String(value); - } - return acc; - }, - {}, - ); - message.tableSchema = (object.tableSchema !== undefined && object.tableSchema !== null) - ? TableSchema.fromPartial(object.tableSchema) - : undefined; - return message; - }, -}; - -function createBaseSinkConfig_PropertiesEntry(): SinkConfig_PropertiesEntry { - return { key: "", value: "" }; -} - -export const SinkConfig_PropertiesEntry = { - fromJSON(object: any): SinkConfig_PropertiesEntry { - return { key: isSet(object.key) ? String(object.key) : "", value: isSet(object.value) ? String(object.value) : "" }; - }, - - toJSON(message: SinkConfig_PropertiesEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = message.key); - message.value !== undefined && (obj.value = message.value); - return obj; - }, - - fromPartial, I>>(object: I): SinkConfig_PropertiesEntry { - const message = createBaseSinkConfig_PropertiesEntry(); - message.key = object.key ?? ""; - message.value = object.value ?? ""; - return message; - }, -}; - -function createBaseSinkStreamRequest(): SinkStreamRequest { - return { request: undefined }; -} - -export const SinkStreamRequest = { - fromJSON(object: any): SinkStreamRequest { - return { - request: isSet(object.start) - ? { $case: "start", start: SinkStreamRequest_StartSink.fromJSON(object.start) } - : isSet(object.startEpoch) - ? { $case: "startEpoch", startEpoch: SinkStreamRequest_StartEpoch.fromJSON(object.startEpoch) } - : isSet(object.write) - ? { $case: "write", write: SinkStreamRequest_WriteBatch.fromJSON(object.write) } - : isSet(object.sync) - ? { $case: "sync", sync: SinkStreamRequest_SyncBatch.fromJSON(object.sync) } - : undefined, - }; - }, - - toJSON(message: SinkStreamRequest): unknown { - const obj: any = {}; - message.request?.$case === "start" && - (obj.start = message.request?.start ? SinkStreamRequest_StartSink.toJSON(message.request?.start) : undefined); - message.request?.$case === "startEpoch" && (obj.startEpoch = message.request?.startEpoch - ? SinkStreamRequest_StartEpoch.toJSON(message.request?.startEpoch) - : undefined); - message.request?.$case === "write" && - (obj.write = message.request?.write ? SinkStreamRequest_WriteBatch.toJSON(message.request?.write) : undefined); - message.request?.$case === "sync" && - (obj.sync = message.request?.sync ? SinkStreamRequest_SyncBatch.toJSON(message.request?.sync) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): SinkStreamRequest { - const message = createBaseSinkStreamRequest(); - if (object.request?.$case === "start" && object.request?.start !== undefined && object.request?.start !== null) { - message.request = { $case: "start", start: SinkStreamRequest_StartSink.fromPartial(object.request.start) }; - } - if ( - object.request?.$case === "startEpoch" && - object.request?.startEpoch !== undefined && - object.request?.startEpoch !== null - ) { - message.request = { - $case: "startEpoch", - startEpoch: SinkStreamRequest_StartEpoch.fromPartial(object.request.startEpoch), - }; - } - if (object.request?.$case === "write" && object.request?.write !== undefined && object.request?.write !== null) { - message.request = { $case: "write", write: SinkStreamRequest_WriteBatch.fromPartial(object.request.write) }; - } - if (object.request?.$case === "sync" && object.request?.sync !== undefined && object.request?.sync !== null) { - message.request = { $case: "sync", sync: SinkStreamRequest_SyncBatch.fromPartial(object.request.sync) }; - } - return message; - }, -}; - -function createBaseSinkStreamRequest_StartSink(): SinkStreamRequest_StartSink { - return { sinkConfig: undefined, format: SinkPayloadFormat.FORMAT_UNSPECIFIED }; -} - -export const SinkStreamRequest_StartSink = { - fromJSON(object: any): SinkStreamRequest_StartSink { - return { - sinkConfig: isSet(object.sinkConfig) ? SinkConfig.fromJSON(object.sinkConfig) : undefined, - format: isSet(object.format) ? sinkPayloadFormatFromJSON(object.format) : SinkPayloadFormat.FORMAT_UNSPECIFIED, - }; - }, - - toJSON(message: SinkStreamRequest_StartSink): unknown { - const obj: any = {}; - message.sinkConfig !== undefined && - (obj.sinkConfig = message.sinkConfig ? SinkConfig.toJSON(message.sinkConfig) : undefined); - message.format !== undefined && (obj.format = sinkPayloadFormatToJSON(message.format)); - return obj; - }, - - fromPartial, I>>(object: I): SinkStreamRequest_StartSink { - const message = createBaseSinkStreamRequest_StartSink(); - message.sinkConfig = (object.sinkConfig !== undefined && object.sinkConfig !== null) - ? SinkConfig.fromPartial(object.sinkConfig) - : undefined; - message.format = object.format ?? SinkPayloadFormat.FORMAT_UNSPECIFIED; - return message; - }, -}; - -function createBaseSinkStreamRequest_WriteBatch(): SinkStreamRequest_WriteBatch { - return { payload: undefined, batchId: 0, epoch: 0 }; -} - -export const SinkStreamRequest_WriteBatch = { - fromJSON(object: any): SinkStreamRequest_WriteBatch { - return { - payload: isSet(object.jsonPayload) - ? { $case: "jsonPayload", jsonPayload: SinkStreamRequest_WriteBatch_JsonPayload.fromJSON(object.jsonPayload) } - : isSet(object.streamChunkPayload) - ? { - $case: "streamChunkPayload", - streamChunkPayload: SinkStreamRequest_WriteBatch_StreamChunkPayload.fromJSON(object.streamChunkPayload), - } - : undefined, - batchId: isSet(object.batchId) ? Number(object.batchId) : 0, - epoch: isSet(object.epoch) ? Number(object.epoch) : 0, - }; - }, - - toJSON(message: SinkStreamRequest_WriteBatch): unknown { - const obj: any = {}; - message.payload?.$case === "jsonPayload" && (obj.jsonPayload = message.payload?.jsonPayload - ? SinkStreamRequest_WriteBatch_JsonPayload.toJSON(message.payload?.jsonPayload) - : undefined); - message.payload?.$case === "streamChunkPayload" && (obj.streamChunkPayload = message.payload?.streamChunkPayload - ? SinkStreamRequest_WriteBatch_StreamChunkPayload.toJSON(message.payload?.streamChunkPayload) - : undefined); - message.batchId !== undefined && (obj.batchId = Math.round(message.batchId)); - message.epoch !== undefined && (obj.epoch = Math.round(message.epoch)); - return obj; - }, - - fromPartial, I>>(object: I): SinkStreamRequest_WriteBatch { - const message = createBaseSinkStreamRequest_WriteBatch(); - if ( - object.payload?.$case === "jsonPayload" && - object.payload?.jsonPayload !== undefined && - object.payload?.jsonPayload !== null - ) { - message.payload = { - $case: "jsonPayload", - jsonPayload: SinkStreamRequest_WriteBatch_JsonPayload.fromPartial(object.payload.jsonPayload), - }; - } - if ( - object.payload?.$case === "streamChunkPayload" && - object.payload?.streamChunkPayload !== undefined && - object.payload?.streamChunkPayload !== null - ) { - message.payload = { - $case: "streamChunkPayload", - streamChunkPayload: SinkStreamRequest_WriteBatch_StreamChunkPayload.fromPartial( - object.payload.streamChunkPayload, - ), - }; - } - message.batchId = object.batchId ?? 0; - message.epoch = object.epoch ?? 0; - return message; - }, -}; - -function createBaseSinkStreamRequest_WriteBatch_JsonPayload(): SinkStreamRequest_WriteBatch_JsonPayload { - return { rowOps: [] }; -} - -export const SinkStreamRequest_WriteBatch_JsonPayload = { - fromJSON(object: any): SinkStreamRequest_WriteBatch_JsonPayload { - return { - rowOps: Array.isArray(object?.rowOps) - ? object.rowOps.map((e: any) => SinkStreamRequest_WriteBatch_JsonPayload_RowOp.fromJSON(e)) - : [], - }; - }, - - toJSON(message: SinkStreamRequest_WriteBatch_JsonPayload): unknown { - const obj: any = {}; - if (message.rowOps) { - obj.rowOps = message.rowOps.map((e) => e ? SinkStreamRequest_WriteBatch_JsonPayload_RowOp.toJSON(e) : undefined); - } else { - obj.rowOps = []; - } - return obj; - }, - - fromPartial, I>>( - object: I, - ): SinkStreamRequest_WriteBatch_JsonPayload { - const message = createBaseSinkStreamRequest_WriteBatch_JsonPayload(); - message.rowOps = object.rowOps?.map((e) => SinkStreamRequest_WriteBatch_JsonPayload_RowOp.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseSinkStreamRequest_WriteBatch_JsonPayload_RowOp(): SinkStreamRequest_WriteBatch_JsonPayload_RowOp { - return { opType: Op.OP_UNSPECIFIED, line: "" }; -} - -export const SinkStreamRequest_WriteBatch_JsonPayload_RowOp = { - fromJSON(object: any): SinkStreamRequest_WriteBatch_JsonPayload_RowOp { - return { - opType: isSet(object.opType) ? opFromJSON(object.opType) : Op.OP_UNSPECIFIED, - line: isSet(object.line) ? String(object.line) : "", - }; - }, - - toJSON(message: SinkStreamRequest_WriteBatch_JsonPayload_RowOp): unknown { - const obj: any = {}; - message.opType !== undefined && (obj.opType = opToJSON(message.opType)); - message.line !== undefined && (obj.line = message.line); - return obj; - }, - - fromPartial, I>>( - object: I, - ): SinkStreamRequest_WriteBatch_JsonPayload_RowOp { - const message = createBaseSinkStreamRequest_WriteBatch_JsonPayload_RowOp(); - message.opType = object.opType ?? Op.OP_UNSPECIFIED; - message.line = object.line ?? ""; - return message; - }, -}; - -function createBaseSinkStreamRequest_WriteBatch_StreamChunkPayload(): SinkStreamRequest_WriteBatch_StreamChunkPayload { - return { binaryData: new Uint8Array() }; -} - -export const SinkStreamRequest_WriteBatch_StreamChunkPayload = { - fromJSON(object: any): SinkStreamRequest_WriteBatch_StreamChunkPayload { - return { binaryData: isSet(object.binaryData) ? bytesFromBase64(object.binaryData) : new Uint8Array() }; - }, - - toJSON(message: SinkStreamRequest_WriteBatch_StreamChunkPayload): unknown { - const obj: any = {}; - message.binaryData !== undefined && - (obj.binaryData = base64FromBytes(message.binaryData !== undefined ? message.binaryData : new Uint8Array())); - return obj; - }, - - fromPartial, I>>( - object: I, - ): SinkStreamRequest_WriteBatch_StreamChunkPayload { - const message = createBaseSinkStreamRequest_WriteBatch_StreamChunkPayload(); - message.binaryData = object.binaryData ?? new Uint8Array(); - return message; - }, -}; - -function createBaseSinkStreamRequest_StartEpoch(): SinkStreamRequest_StartEpoch { - return { epoch: 0 }; -} - -export const SinkStreamRequest_StartEpoch = { - fromJSON(object: any): SinkStreamRequest_StartEpoch { - return { epoch: isSet(object.epoch) ? Number(object.epoch) : 0 }; - }, - - toJSON(message: SinkStreamRequest_StartEpoch): unknown { - const obj: any = {}; - message.epoch !== undefined && (obj.epoch = Math.round(message.epoch)); - return obj; - }, - - fromPartial, I>>(object: I): SinkStreamRequest_StartEpoch { - const message = createBaseSinkStreamRequest_StartEpoch(); - message.epoch = object.epoch ?? 0; - return message; - }, -}; - -function createBaseSinkStreamRequest_SyncBatch(): SinkStreamRequest_SyncBatch { - return { epoch: 0 }; -} - -export const SinkStreamRequest_SyncBatch = { - fromJSON(object: any): SinkStreamRequest_SyncBatch { - return { epoch: isSet(object.epoch) ? Number(object.epoch) : 0 }; - }, - - toJSON(message: SinkStreamRequest_SyncBatch): unknown { - const obj: any = {}; - message.epoch !== undefined && (obj.epoch = Math.round(message.epoch)); - return obj; - }, - - fromPartial, I>>(object: I): SinkStreamRequest_SyncBatch { - const message = createBaseSinkStreamRequest_SyncBatch(); - message.epoch = object.epoch ?? 0; - return message; - }, -}; - -function createBaseSinkResponse(): SinkResponse { - return { response: undefined }; -} - -export const SinkResponse = { - fromJSON(object: any): SinkResponse { - return { - response: isSet(object.sync) - ? { $case: "sync", sync: SinkResponse_SyncResponse.fromJSON(object.sync) } - : isSet(object.startEpoch) - ? { $case: "startEpoch", startEpoch: SinkResponse_StartEpochResponse.fromJSON(object.startEpoch) } - : isSet(object.write) - ? { $case: "write", write: SinkResponse_WriteResponse.fromJSON(object.write) } - : isSet(object.start) - ? { $case: "start", start: SinkResponse_StartResponse.fromJSON(object.start) } - : undefined, - }; - }, - - toJSON(message: SinkResponse): unknown { - const obj: any = {}; - message.response?.$case === "sync" && - (obj.sync = message.response?.sync ? SinkResponse_SyncResponse.toJSON(message.response?.sync) : undefined); - message.response?.$case === "startEpoch" && (obj.startEpoch = message.response?.startEpoch - ? SinkResponse_StartEpochResponse.toJSON(message.response?.startEpoch) - : undefined); - message.response?.$case === "write" && - (obj.write = message.response?.write ? SinkResponse_WriteResponse.toJSON(message.response?.write) : undefined); - message.response?.$case === "start" && - (obj.start = message.response?.start ? SinkResponse_StartResponse.toJSON(message.response?.start) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): SinkResponse { - const message = createBaseSinkResponse(); - if (object.response?.$case === "sync" && object.response?.sync !== undefined && object.response?.sync !== null) { - message.response = { $case: "sync", sync: SinkResponse_SyncResponse.fromPartial(object.response.sync) }; - } - if ( - object.response?.$case === "startEpoch" && - object.response?.startEpoch !== undefined && - object.response?.startEpoch !== null - ) { - message.response = { - $case: "startEpoch", - startEpoch: SinkResponse_StartEpochResponse.fromPartial(object.response.startEpoch), - }; - } - if (object.response?.$case === "write" && object.response?.write !== undefined && object.response?.write !== null) { - message.response = { $case: "write", write: SinkResponse_WriteResponse.fromPartial(object.response.write) }; - } - if (object.response?.$case === "start" && object.response?.start !== undefined && object.response?.start !== null) { - message.response = { $case: "start", start: SinkResponse_StartResponse.fromPartial(object.response.start) }; - } - return message; - }, -}; - -function createBaseSinkResponse_SyncResponse(): SinkResponse_SyncResponse { - return { epoch: 0 }; -} - -export const SinkResponse_SyncResponse = { - fromJSON(object: any): SinkResponse_SyncResponse { - return { epoch: isSet(object.epoch) ? Number(object.epoch) : 0 }; - }, - - toJSON(message: SinkResponse_SyncResponse): unknown { - const obj: any = {}; - message.epoch !== undefined && (obj.epoch = Math.round(message.epoch)); - return obj; - }, - - fromPartial, I>>(object: I): SinkResponse_SyncResponse { - const message = createBaseSinkResponse_SyncResponse(); - message.epoch = object.epoch ?? 0; - return message; - }, -}; - -function createBaseSinkResponse_StartEpochResponse(): SinkResponse_StartEpochResponse { - return { epoch: 0 }; -} - -export const SinkResponse_StartEpochResponse = { - fromJSON(object: any): SinkResponse_StartEpochResponse { - return { epoch: isSet(object.epoch) ? Number(object.epoch) : 0 }; - }, - - toJSON(message: SinkResponse_StartEpochResponse): unknown { - const obj: any = {}; - message.epoch !== undefined && (obj.epoch = Math.round(message.epoch)); - return obj; - }, - - fromPartial, I>>( - object: I, - ): SinkResponse_StartEpochResponse { - const message = createBaseSinkResponse_StartEpochResponse(); - message.epoch = object.epoch ?? 0; - return message; - }, -}; - -function createBaseSinkResponse_WriteResponse(): SinkResponse_WriteResponse { - return { epoch: 0, batchId: 0 }; -} - -export const SinkResponse_WriteResponse = { - fromJSON(object: any): SinkResponse_WriteResponse { - return { - epoch: isSet(object.epoch) ? Number(object.epoch) : 0, - batchId: isSet(object.batchId) ? Number(object.batchId) : 0, - }; - }, - - toJSON(message: SinkResponse_WriteResponse): unknown { - const obj: any = {}; - message.epoch !== undefined && (obj.epoch = Math.round(message.epoch)); - message.batchId !== undefined && (obj.batchId = Math.round(message.batchId)); - return obj; - }, - - fromPartial, I>>(object: I): SinkResponse_WriteResponse { - const message = createBaseSinkResponse_WriteResponse(); - message.epoch = object.epoch ?? 0; - message.batchId = object.batchId ?? 0; - return message; - }, -}; - -function createBaseSinkResponse_StartResponse(): SinkResponse_StartResponse { - return {}; -} - -export const SinkResponse_StartResponse = { - fromJSON(_: any): SinkResponse_StartResponse { - return {}; - }, - - toJSON(_: SinkResponse_StartResponse): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): SinkResponse_StartResponse { - const message = createBaseSinkResponse_StartResponse(); - return message; - }, -}; - -function createBaseValidateSinkRequest(): ValidateSinkRequest { - return { sinkConfig: undefined, sinkType: SinkType.UNSPECIFIED }; -} - -export const ValidateSinkRequest = { - fromJSON(object: any): ValidateSinkRequest { - return { - sinkConfig: isSet(object.sinkConfig) ? SinkConfig.fromJSON(object.sinkConfig) : undefined, - sinkType: isSet(object.sinkType) ? sinkTypeFromJSON(object.sinkType) : SinkType.UNSPECIFIED, - }; - }, - - toJSON(message: ValidateSinkRequest): unknown { - const obj: any = {}; - message.sinkConfig !== undefined && - (obj.sinkConfig = message.sinkConfig ? SinkConfig.toJSON(message.sinkConfig) : undefined); - message.sinkType !== undefined && (obj.sinkType = sinkTypeToJSON(message.sinkType)); - return obj; - }, - - fromPartial, I>>(object: I): ValidateSinkRequest { - const message = createBaseValidateSinkRequest(); - message.sinkConfig = (object.sinkConfig !== undefined && object.sinkConfig !== null) - ? SinkConfig.fromPartial(object.sinkConfig) - : undefined; - message.sinkType = object.sinkType ?? SinkType.UNSPECIFIED; - return message; - }, -}; - -function createBaseValidateSinkResponse(): ValidateSinkResponse { - return { error: undefined }; -} - -export const ValidateSinkResponse = { - fromJSON(object: any): ValidateSinkResponse { - return { error: isSet(object.error) ? ValidationError.fromJSON(object.error) : undefined }; - }, - - toJSON(message: ValidateSinkResponse): unknown { - const obj: any = {}; - message.error !== undefined && (obj.error = message.error ? ValidationError.toJSON(message.error) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): ValidateSinkResponse { - const message = createBaseValidateSinkResponse(); - message.error = (object.error !== undefined && object.error !== null) - ? ValidationError.fromPartial(object.error) - : undefined; - return message; - }, -}; - -function createBaseCdcMessage(): CdcMessage { - return { payload: "", partition: "", offset: "" }; -} - -export const CdcMessage = { - fromJSON(object: any): CdcMessage { - return { - payload: isSet(object.payload) ? String(object.payload) : "", - partition: isSet(object.partition) ? String(object.partition) : "", - offset: isSet(object.offset) ? String(object.offset) : "", - }; - }, - - toJSON(message: CdcMessage): unknown { - const obj: any = {}; - message.payload !== undefined && (obj.payload = message.payload); - message.partition !== undefined && (obj.partition = message.partition); - message.offset !== undefined && (obj.offset = message.offset); - return obj; - }, - - fromPartial, I>>(object: I): CdcMessage { - const message = createBaseCdcMessage(); - message.payload = object.payload ?? ""; - message.partition = object.partition ?? ""; - message.offset = object.offset ?? ""; - return message; - }, -}; - -function createBaseGetEventStreamRequest(): GetEventStreamRequest { - return { request: undefined }; -} - -export const GetEventStreamRequest = { - fromJSON(object: any): GetEventStreamRequest { - return { - request: isSet(object.validate) - ? { $case: "validate", validate: GetEventStreamRequest_ValidateProperties.fromJSON(object.validate) } - : isSet(object.start) - ? { $case: "start", start: GetEventStreamRequest_StartSource.fromJSON(object.start) } - : undefined, - }; - }, - - toJSON(message: GetEventStreamRequest): unknown { - const obj: any = {}; - message.request?.$case === "validate" && (obj.validate = message.request?.validate - ? GetEventStreamRequest_ValidateProperties.toJSON(message.request?.validate) - : undefined); - message.request?.$case === "start" && - (obj.start = message.request?.start - ? GetEventStreamRequest_StartSource.toJSON(message.request?.start) - : undefined); - return obj; - }, - - fromPartial, I>>(object: I): GetEventStreamRequest { - const message = createBaseGetEventStreamRequest(); - if ( - object.request?.$case === "validate" && - object.request?.validate !== undefined && - object.request?.validate !== null - ) { - message.request = { - $case: "validate", - validate: GetEventStreamRequest_ValidateProperties.fromPartial(object.request.validate), - }; - } - if (object.request?.$case === "start" && object.request?.start !== undefined && object.request?.start !== null) { - message.request = { $case: "start", start: GetEventStreamRequest_StartSource.fromPartial(object.request.start) }; - } - return message; - }, -}; - -function createBaseGetEventStreamRequest_ValidateProperties(): GetEventStreamRequest_ValidateProperties { - return { sourceId: 0, sourceType: SourceType.UNSPECIFIED, properties: {}, tableSchema: undefined }; -} - -export const GetEventStreamRequest_ValidateProperties = { - fromJSON(object: any): GetEventStreamRequest_ValidateProperties { - return { - sourceId: isSet(object.sourceId) ? Number(object.sourceId) : 0, - sourceType: isSet(object.sourceType) ? sourceTypeFromJSON(object.sourceType) : SourceType.UNSPECIFIED, - properties: isObject(object.properties) - ? Object.entries(object.properties).reduce<{ [key: string]: string }>((acc, [key, value]) => { - acc[key] = String(value); - return acc; - }, {}) - : {}, - tableSchema: isSet(object.tableSchema) ? TableSchema.fromJSON(object.tableSchema) : undefined, - }; - }, - - toJSON(message: GetEventStreamRequest_ValidateProperties): unknown { - const obj: any = {}; - message.sourceId !== undefined && (obj.sourceId = Math.round(message.sourceId)); - message.sourceType !== undefined && (obj.sourceType = sourceTypeToJSON(message.sourceType)); - obj.properties = {}; - if (message.properties) { - Object.entries(message.properties).forEach(([k, v]) => { - obj.properties[k] = v; - }); - } - message.tableSchema !== undefined && - (obj.tableSchema = message.tableSchema ? TableSchema.toJSON(message.tableSchema) : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): GetEventStreamRequest_ValidateProperties { - const message = createBaseGetEventStreamRequest_ValidateProperties(); - message.sourceId = object.sourceId ?? 0; - message.sourceType = object.sourceType ?? SourceType.UNSPECIFIED; - message.properties = Object.entries(object.properties ?? {}).reduce<{ [key: string]: string }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[key] = String(value); - } - return acc; - }, - {}, - ); - message.tableSchema = (object.tableSchema !== undefined && object.tableSchema !== null) - ? TableSchema.fromPartial(object.tableSchema) - : undefined; - return message; - }, -}; - -function createBaseGetEventStreamRequest_ValidateProperties_PropertiesEntry(): GetEventStreamRequest_ValidateProperties_PropertiesEntry { - return { key: "", value: "" }; -} - -export const GetEventStreamRequest_ValidateProperties_PropertiesEntry = { - fromJSON(object: any): GetEventStreamRequest_ValidateProperties_PropertiesEntry { - return { key: isSet(object.key) ? String(object.key) : "", value: isSet(object.value) ? String(object.value) : "" }; - }, - - toJSON(message: GetEventStreamRequest_ValidateProperties_PropertiesEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = message.key); - message.value !== undefined && (obj.value = message.value); - return obj; - }, - - fromPartial, I>>( - object: I, - ): GetEventStreamRequest_ValidateProperties_PropertiesEntry { - const message = createBaseGetEventStreamRequest_ValidateProperties_PropertiesEntry(); - message.key = object.key ?? ""; - message.value = object.value ?? ""; - return message; - }, -}; - -function createBaseGetEventStreamRequest_StartSource(): GetEventStreamRequest_StartSource { - return { sourceId: 0, sourceType: SourceType.UNSPECIFIED, startOffset: "", properties: {} }; -} - -export const GetEventStreamRequest_StartSource = { - fromJSON(object: any): GetEventStreamRequest_StartSource { - return { - sourceId: isSet(object.sourceId) ? Number(object.sourceId) : 0, - sourceType: isSet(object.sourceType) ? sourceTypeFromJSON(object.sourceType) : SourceType.UNSPECIFIED, - startOffset: isSet(object.startOffset) ? String(object.startOffset) : "", - properties: isObject(object.properties) - ? Object.entries(object.properties).reduce<{ [key: string]: string }>((acc, [key, value]) => { - acc[key] = String(value); - return acc; - }, {}) - : {}, - }; - }, - - toJSON(message: GetEventStreamRequest_StartSource): unknown { - const obj: any = {}; - message.sourceId !== undefined && (obj.sourceId = Math.round(message.sourceId)); - message.sourceType !== undefined && (obj.sourceType = sourceTypeToJSON(message.sourceType)); - message.startOffset !== undefined && (obj.startOffset = message.startOffset); - obj.properties = {}; - if (message.properties) { - Object.entries(message.properties).forEach(([k, v]) => { - obj.properties[k] = v; - }); - } - return obj; - }, - - fromPartial, I>>( - object: I, - ): GetEventStreamRequest_StartSource { - const message = createBaseGetEventStreamRequest_StartSource(); - message.sourceId = object.sourceId ?? 0; - message.sourceType = object.sourceType ?? SourceType.UNSPECIFIED; - message.startOffset = object.startOffset ?? ""; - message.properties = Object.entries(object.properties ?? {}).reduce<{ [key: string]: string }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[key] = String(value); - } - return acc; - }, - {}, - ); - return message; - }, -}; - -function createBaseGetEventStreamRequest_StartSource_PropertiesEntry(): GetEventStreamRequest_StartSource_PropertiesEntry { - return { key: "", value: "" }; -} - -export const GetEventStreamRequest_StartSource_PropertiesEntry = { - fromJSON(object: any): GetEventStreamRequest_StartSource_PropertiesEntry { - return { key: isSet(object.key) ? String(object.key) : "", value: isSet(object.value) ? String(object.value) : "" }; - }, - - toJSON(message: GetEventStreamRequest_StartSource_PropertiesEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = message.key); - message.value !== undefined && (obj.value = message.value); - return obj; - }, - - fromPartial, I>>( - object: I, - ): GetEventStreamRequest_StartSource_PropertiesEntry { - const message = createBaseGetEventStreamRequest_StartSource_PropertiesEntry(); - message.key = object.key ?? ""; - message.value = object.value ?? ""; - return message; - }, -}; - -function createBaseGetEventStreamResponse(): GetEventStreamResponse { - return { sourceId: 0, events: [] }; -} - -export const GetEventStreamResponse = { - fromJSON(object: any): GetEventStreamResponse { - return { - sourceId: isSet(object.sourceId) ? Number(object.sourceId) : 0, - events: Array.isArray(object?.events) ? object.events.map((e: any) => CdcMessage.fromJSON(e)) : [], - }; - }, - - toJSON(message: GetEventStreamResponse): unknown { - const obj: any = {}; - message.sourceId !== undefined && (obj.sourceId = Math.round(message.sourceId)); - if (message.events) { - obj.events = message.events.map((e) => e ? CdcMessage.toJSON(e) : undefined); - } else { - obj.events = []; - } - return obj; - }, - - fromPartial, I>>(object: I): GetEventStreamResponse { - const message = createBaseGetEventStreamResponse(); - message.sourceId = object.sourceId ?? 0; - message.events = object.events?.map((e) => CdcMessage.fromPartial(e)) || []; - return message; - }, -}; - -declare var self: any | undefined; -declare var window: any | undefined; -declare var global: any | undefined; -var globalThis: any = (() => { - if (typeof globalThis !== "undefined") { - return globalThis; - } - if (typeof self !== "undefined") { - return self; - } - if (typeof window !== "undefined") { - return window; - } - if (typeof global !== "undefined") { - return global; - } - throw "Unable to locate global object"; -})(); - -function bytesFromBase64(b64: string): Uint8Array { - if (globalThis.Buffer) { - return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); - } else { - const bin = globalThis.atob(b64); - const arr = new Uint8Array(bin.length); - for (let i = 0; i < bin.length; ++i) { - arr[i] = bin.charCodeAt(i); - } - return arr; - } -} - -function base64FromBytes(arr: Uint8Array): string { - if (globalThis.Buffer) { - return globalThis.Buffer.from(arr).toString("base64"); - } else { - const bin: string[] = []; - arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); - }); - return globalThis.btoa(bin.join("")); - } -} - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> - : T extends { $case: string } ? { [K in keyof Omit]?: DeepPartial } & { $case: T["$case"] } - : T extends {} ? { [K in keyof T]?: DeepPartial } - : Partial; - -type KeysOfUnion = T extends T ? keyof T : never; -export type Exact = P extends Builtin ? P - : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; - -function isObject(value: any): boolean { - return typeof value === "object" && value !== null; -} - -function isSet(value: any): boolean { - return value !== null && value !== undefined; -} diff --git a/dashboard/proto/gen/data.ts b/dashboard/proto/gen/data.ts deleted file mode 100644 index d24bf8a9de15..000000000000 --- a/dashboard/proto/gen/data.ts +++ /dev/null @@ -1,964 +0,0 @@ -/* eslint-disable */ -import { Buffer } from "./common"; - -export const protobufPackage = "data"; - -export const RwArrayType = { - UNSPECIFIED: "UNSPECIFIED", - INT16: "INT16", - INT32: "INT32", - INT64: "INT64", - FLOAT32: "FLOAT32", - FLOAT64: "FLOAT64", - UTF8: "UTF8", - BOOL: "BOOL", - DECIMAL: "DECIMAL", - DATE: "DATE", - TIME: "TIME", - TIMESTAMP: "TIMESTAMP", - INTERVAL: "INTERVAL", - STRUCT: "STRUCT", - LIST: "LIST", - BYTEA: "BYTEA", - JSONB: "JSONB", - SERIAL: "SERIAL", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type RwArrayType = typeof RwArrayType[keyof typeof RwArrayType]; - -export function rwArrayTypeFromJSON(object: any): RwArrayType { - switch (object) { - case 0: - case "UNSPECIFIED": - return RwArrayType.UNSPECIFIED; - case 1: - case "INT16": - return RwArrayType.INT16; - case 2: - case "INT32": - return RwArrayType.INT32; - case 3: - case "INT64": - return RwArrayType.INT64; - case 4: - case "FLOAT32": - return RwArrayType.FLOAT32; - case 5: - case "FLOAT64": - return RwArrayType.FLOAT64; - case 6: - case "UTF8": - return RwArrayType.UTF8; - case 7: - case "BOOL": - return RwArrayType.BOOL; - case 8: - case "DECIMAL": - return RwArrayType.DECIMAL; - case 9: - case "DATE": - return RwArrayType.DATE; - case 10: - case "TIME": - return RwArrayType.TIME; - case 11: - case "TIMESTAMP": - return RwArrayType.TIMESTAMP; - case 12: - case "INTERVAL": - return RwArrayType.INTERVAL; - case 13: - case "STRUCT": - return RwArrayType.STRUCT; - case 14: - case "LIST": - return RwArrayType.LIST; - case 15: - case "BYTEA": - return RwArrayType.BYTEA; - case 16: - case "JSONB": - return RwArrayType.JSONB; - case 17: - case "SERIAL": - return RwArrayType.SERIAL; - case -1: - case "UNRECOGNIZED": - default: - return RwArrayType.UNRECOGNIZED; - } -} - -export function rwArrayTypeToJSON(object: RwArrayType): string { - switch (object) { - case RwArrayType.UNSPECIFIED: - return "UNSPECIFIED"; - case RwArrayType.INT16: - return "INT16"; - case RwArrayType.INT32: - return "INT32"; - case RwArrayType.INT64: - return "INT64"; - case RwArrayType.FLOAT32: - return "FLOAT32"; - case RwArrayType.FLOAT64: - return "FLOAT64"; - case RwArrayType.UTF8: - return "UTF8"; - case RwArrayType.BOOL: - return "BOOL"; - case RwArrayType.DECIMAL: - return "DECIMAL"; - case RwArrayType.DATE: - return "DATE"; - case RwArrayType.TIME: - return "TIME"; - case RwArrayType.TIMESTAMP: - return "TIMESTAMP"; - case RwArrayType.INTERVAL: - return "INTERVAL"; - case RwArrayType.STRUCT: - return "STRUCT"; - case RwArrayType.LIST: - return "LIST"; - case RwArrayType.BYTEA: - return "BYTEA"; - case RwArrayType.JSONB: - return "JSONB"; - case RwArrayType.SERIAL: - return "SERIAL"; - case RwArrayType.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export const Op = { - OP_UNSPECIFIED: "OP_UNSPECIFIED", - INSERT: "INSERT", - DELETE: "DELETE", - UPDATE_INSERT: "UPDATE_INSERT", - UPDATE_DELETE: "UPDATE_DELETE", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type Op = typeof Op[keyof typeof Op]; - -export function opFromJSON(object: any): Op { - switch (object) { - case 0: - case "OP_UNSPECIFIED": - return Op.OP_UNSPECIFIED; - case 1: - case "INSERT": - return Op.INSERT; - case 2: - case "DELETE": - return Op.DELETE; - case 3: - case "UPDATE_INSERT": - return Op.UPDATE_INSERT; - case 4: - case "UPDATE_DELETE": - return Op.UPDATE_DELETE; - case -1: - case "UNRECOGNIZED": - default: - return Op.UNRECOGNIZED; - } -} - -export function opToJSON(object: Op): string { - switch (object) { - case Op.OP_UNSPECIFIED: - return "OP_UNSPECIFIED"; - case Op.INSERT: - return "INSERT"; - case Op.DELETE: - return "DELETE"; - case Op.UPDATE_INSERT: - return "UPDATE_INSERT"; - case Op.UPDATE_DELETE: - return "UPDATE_DELETE"; - case Op.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export interface IntervalUnit { - months: number; - days: number; - usecs: number; -} - -export interface DataType { - typeName: DataType_TypeName; - /** - * Data length for char. - * Max data length for varchar. - * Precision for time, decimal. - */ - precision: number; - /** Scale for decimal. */ - scale: number; - isNullable: boolean; - intervalType: DataType_IntervalType; - /** - * For struct type, it represents all the fields in the struct. - * For list type it only contains 1 element which is the inner item type of the List. - * For example, `ARRAY` will be represented as `vec![DataType::Int32]`. - */ - fieldType: DataType[]; - /** Name of the fields if it is a struct type. For other types it will be empty. */ - fieldNames: string[]; -} - -export const DataType_IntervalType = { - UNSPECIFIED: "UNSPECIFIED", - YEAR: "YEAR", - MONTH: "MONTH", - DAY: "DAY", - HOUR: "HOUR", - MINUTE: "MINUTE", - SECOND: "SECOND", - YEAR_TO_MONTH: "YEAR_TO_MONTH", - DAY_TO_HOUR: "DAY_TO_HOUR", - DAY_TO_MINUTE: "DAY_TO_MINUTE", - DAY_TO_SECOND: "DAY_TO_SECOND", - HOUR_TO_MINUTE: "HOUR_TO_MINUTE", - HOUR_TO_SECOND: "HOUR_TO_SECOND", - MINUTE_TO_SECOND: "MINUTE_TO_SECOND", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type DataType_IntervalType = typeof DataType_IntervalType[keyof typeof DataType_IntervalType]; - -export function dataType_IntervalTypeFromJSON(object: any): DataType_IntervalType { - switch (object) { - case 0: - case "UNSPECIFIED": - return DataType_IntervalType.UNSPECIFIED; - case 1: - case "YEAR": - return DataType_IntervalType.YEAR; - case 2: - case "MONTH": - return DataType_IntervalType.MONTH; - case 3: - case "DAY": - return DataType_IntervalType.DAY; - case 4: - case "HOUR": - return DataType_IntervalType.HOUR; - case 5: - case "MINUTE": - return DataType_IntervalType.MINUTE; - case 6: - case "SECOND": - return DataType_IntervalType.SECOND; - case 7: - case "YEAR_TO_MONTH": - return DataType_IntervalType.YEAR_TO_MONTH; - case 8: - case "DAY_TO_HOUR": - return DataType_IntervalType.DAY_TO_HOUR; - case 9: - case "DAY_TO_MINUTE": - return DataType_IntervalType.DAY_TO_MINUTE; - case 10: - case "DAY_TO_SECOND": - return DataType_IntervalType.DAY_TO_SECOND; - case 11: - case "HOUR_TO_MINUTE": - return DataType_IntervalType.HOUR_TO_MINUTE; - case 12: - case "HOUR_TO_SECOND": - return DataType_IntervalType.HOUR_TO_SECOND; - case 13: - case "MINUTE_TO_SECOND": - return DataType_IntervalType.MINUTE_TO_SECOND; - case -1: - case "UNRECOGNIZED": - default: - return DataType_IntervalType.UNRECOGNIZED; - } -} - -export function dataType_IntervalTypeToJSON(object: DataType_IntervalType): string { - switch (object) { - case DataType_IntervalType.UNSPECIFIED: - return "UNSPECIFIED"; - case DataType_IntervalType.YEAR: - return "YEAR"; - case DataType_IntervalType.MONTH: - return "MONTH"; - case DataType_IntervalType.DAY: - return "DAY"; - case DataType_IntervalType.HOUR: - return "HOUR"; - case DataType_IntervalType.MINUTE: - return "MINUTE"; - case DataType_IntervalType.SECOND: - return "SECOND"; - case DataType_IntervalType.YEAR_TO_MONTH: - return "YEAR_TO_MONTH"; - case DataType_IntervalType.DAY_TO_HOUR: - return "DAY_TO_HOUR"; - case DataType_IntervalType.DAY_TO_MINUTE: - return "DAY_TO_MINUTE"; - case DataType_IntervalType.DAY_TO_SECOND: - return "DAY_TO_SECOND"; - case DataType_IntervalType.HOUR_TO_MINUTE: - return "HOUR_TO_MINUTE"; - case DataType_IntervalType.HOUR_TO_SECOND: - return "HOUR_TO_SECOND"; - case DataType_IntervalType.MINUTE_TO_SECOND: - return "MINUTE_TO_SECOND"; - case DataType_IntervalType.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export const DataType_TypeName = { - TYPE_UNSPECIFIED: "TYPE_UNSPECIFIED", - INT16: "INT16", - INT32: "INT32", - INT64: "INT64", - FLOAT: "FLOAT", - DOUBLE: "DOUBLE", - BOOLEAN: "BOOLEAN", - VARCHAR: "VARCHAR", - DECIMAL: "DECIMAL", - TIME: "TIME", - TIMESTAMP: "TIMESTAMP", - INTERVAL: "INTERVAL", - DATE: "DATE", - /** TIMESTAMPTZ - Timestamp type with timezone */ - TIMESTAMPTZ: "TIMESTAMPTZ", - STRUCT: "STRUCT", - LIST: "LIST", - BYTEA: "BYTEA", - JSONB: "JSONB", - SERIAL: "SERIAL", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type DataType_TypeName = typeof DataType_TypeName[keyof typeof DataType_TypeName]; - -export function dataType_TypeNameFromJSON(object: any): DataType_TypeName { - switch (object) { - case 0: - case "TYPE_UNSPECIFIED": - return DataType_TypeName.TYPE_UNSPECIFIED; - case 1: - case "INT16": - return DataType_TypeName.INT16; - case 2: - case "INT32": - return DataType_TypeName.INT32; - case 3: - case "INT64": - return DataType_TypeName.INT64; - case 4: - case "FLOAT": - return DataType_TypeName.FLOAT; - case 5: - case "DOUBLE": - return DataType_TypeName.DOUBLE; - case 6: - case "BOOLEAN": - return DataType_TypeName.BOOLEAN; - case 7: - case "VARCHAR": - return DataType_TypeName.VARCHAR; - case 8: - case "DECIMAL": - return DataType_TypeName.DECIMAL; - case 9: - case "TIME": - return DataType_TypeName.TIME; - case 10: - case "TIMESTAMP": - return DataType_TypeName.TIMESTAMP; - case 11: - case "INTERVAL": - return DataType_TypeName.INTERVAL; - case 12: - case "DATE": - return DataType_TypeName.DATE; - case 13: - case "TIMESTAMPTZ": - return DataType_TypeName.TIMESTAMPTZ; - case 15: - case "STRUCT": - return DataType_TypeName.STRUCT; - case 16: - case "LIST": - return DataType_TypeName.LIST; - case 17: - case "BYTEA": - return DataType_TypeName.BYTEA; - case 18: - case "JSONB": - return DataType_TypeName.JSONB; - case 19: - case "SERIAL": - return DataType_TypeName.SERIAL; - case -1: - case "UNRECOGNIZED": - default: - return DataType_TypeName.UNRECOGNIZED; - } -} - -export function dataType_TypeNameToJSON(object: DataType_TypeName): string { - switch (object) { - case DataType_TypeName.TYPE_UNSPECIFIED: - return "TYPE_UNSPECIFIED"; - case DataType_TypeName.INT16: - return "INT16"; - case DataType_TypeName.INT32: - return "INT32"; - case DataType_TypeName.INT64: - return "INT64"; - case DataType_TypeName.FLOAT: - return "FLOAT"; - case DataType_TypeName.DOUBLE: - return "DOUBLE"; - case DataType_TypeName.BOOLEAN: - return "BOOLEAN"; - case DataType_TypeName.VARCHAR: - return "VARCHAR"; - case DataType_TypeName.DECIMAL: - return "DECIMAL"; - case DataType_TypeName.TIME: - return "TIME"; - case DataType_TypeName.TIMESTAMP: - return "TIMESTAMP"; - case DataType_TypeName.INTERVAL: - return "INTERVAL"; - case DataType_TypeName.DATE: - return "DATE"; - case DataType_TypeName.TIMESTAMPTZ: - return "TIMESTAMPTZ"; - case DataType_TypeName.STRUCT: - return "STRUCT"; - case DataType_TypeName.LIST: - return "LIST"; - case DataType_TypeName.BYTEA: - return "BYTEA"; - case DataType_TypeName.JSONB: - return "JSONB"; - case DataType_TypeName.SERIAL: - return "SERIAL"; - case DataType_TypeName.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export interface StructRwArrayData { - childrenArray: RwArray[]; - childrenType: DataType[]; -} - -export interface ListRwArrayData { - offsets: number[]; - value: RwArray | undefined; - valueType: DataType | undefined; -} - -export interface RwArray { - arrayType: RwArrayType; - nullBitmap: Buffer | undefined; - values: Buffer[]; - structArrayData: StructRwArrayData | undefined; - listArrayData: ListRwArrayData | undefined; -} - -export interface Datum { - /** - * bool array/bitmap: one byte, 0 for false (null), non-zero for true (non-null) - * integer, float, double: big-endianness - * interval: encoded to (months, days, milliseconds), big-endianness - * varchar: encoded accorded to encoding, currently only utf8 is supported. - */ - body: Uint8Array; -} - -/** - * New column proto def to replace fixed width column. This def - * aims to include all column type. Currently it do not support struct/array - * but capable of extending in future by add other fields. - */ -export interface Column { - array: RwArray | undefined; -} - -export interface DataChunk { - cardinality: number; - columns: Column[]; -} - -export interface StreamChunk { - /** for Column::from_protobuf(), may not need later */ - cardinality: number; - ops: Op[]; - columns: Column[]; -} - -export interface Epoch { - curr: number; - prev: number; -} - -export interface Terminate { -} - -function createBaseIntervalUnit(): IntervalUnit { - return { months: 0, days: 0, usecs: 0 }; -} - -export const IntervalUnit = { - fromJSON(object: any): IntervalUnit { - return { - months: isSet(object.months) ? Number(object.months) : 0, - days: isSet(object.days) ? Number(object.days) : 0, - usecs: isSet(object.usecs) ? Number(object.usecs) : 0, - }; - }, - - toJSON(message: IntervalUnit): unknown { - const obj: any = {}; - message.months !== undefined && (obj.months = Math.round(message.months)); - message.days !== undefined && (obj.days = Math.round(message.days)); - message.usecs !== undefined && (obj.usecs = Math.round(message.usecs)); - return obj; - }, - - fromPartial, I>>(object: I): IntervalUnit { - const message = createBaseIntervalUnit(); - message.months = object.months ?? 0; - message.days = object.days ?? 0; - message.usecs = object.usecs ?? 0; - return message; - }, -}; - -function createBaseDataType(): DataType { - return { - typeName: DataType_TypeName.TYPE_UNSPECIFIED, - precision: 0, - scale: 0, - isNullable: false, - intervalType: DataType_IntervalType.UNSPECIFIED, - fieldType: [], - fieldNames: [], - }; -} - -export const DataType = { - fromJSON(object: any): DataType { - return { - typeName: isSet(object.typeName) - ? dataType_TypeNameFromJSON(object.typeName) - : DataType_TypeName.TYPE_UNSPECIFIED, - precision: isSet(object.precision) ? Number(object.precision) : 0, - scale: isSet(object.scale) ? Number(object.scale) : 0, - isNullable: isSet(object.isNullable) ? Boolean(object.isNullable) : false, - intervalType: isSet(object.intervalType) - ? dataType_IntervalTypeFromJSON(object.intervalType) - : DataType_IntervalType.UNSPECIFIED, - fieldType: Array.isArray(object?.fieldType) ? object.fieldType.map((e: any) => DataType.fromJSON(e)) : [], - fieldNames: Array.isArray(object?.fieldNames) ? object.fieldNames.map((e: any) => String(e)) : [], - }; - }, - - toJSON(message: DataType): unknown { - const obj: any = {}; - message.typeName !== undefined && (obj.typeName = dataType_TypeNameToJSON(message.typeName)); - message.precision !== undefined && (obj.precision = Math.round(message.precision)); - message.scale !== undefined && (obj.scale = Math.round(message.scale)); - message.isNullable !== undefined && (obj.isNullable = message.isNullable); - message.intervalType !== undefined && (obj.intervalType = dataType_IntervalTypeToJSON(message.intervalType)); - if (message.fieldType) { - obj.fieldType = message.fieldType.map((e) => e ? DataType.toJSON(e) : undefined); - } else { - obj.fieldType = []; - } - if (message.fieldNames) { - obj.fieldNames = message.fieldNames.map((e) => e); - } else { - obj.fieldNames = []; - } - return obj; - }, - - fromPartial, I>>(object: I): DataType { - const message = createBaseDataType(); - message.typeName = object.typeName ?? DataType_TypeName.TYPE_UNSPECIFIED; - message.precision = object.precision ?? 0; - message.scale = object.scale ?? 0; - message.isNullable = object.isNullable ?? false; - message.intervalType = object.intervalType ?? DataType_IntervalType.UNSPECIFIED; - message.fieldType = object.fieldType?.map((e) => DataType.fromPartial(e)) || []; - message.fieldNames = object.fieldNames?.map((e) => e) || []; - return message; - }, -}; - -function createBaseStructRwArrayData(): StructRwArrayData { - return { childrenArray: [], childrenType: [] }; -} - -export const StructRwArrayData = { - fromJSON(object: any): StructRwArrayData { - return { - childrenArray: Array.isArray(object?.childrenArray) - ? object.childrenArray.map((e: any) => RwArray.fromJSON(e)) - : [], - childrenType: Array.isArray(object?.childrenType) - ? object.childrenType.map((e: any) => DataType.fromJSON(e)) - : [], - }; - }, - - toJSON(message: StructRwArrayData): unknown { - const obj: any = {}; - if (message.childrenArray) { - obj.childrenArray = message.childrenArray.map((e) => e ? RwArray.toJSON(e) : undefined); - } else { - obj.childrenArray = []; - } - if (message.childrenType) { - obj.childrenType = message.childrenType.map((e) => e ? DataType.toJSON(e) : undefined); - } else { - obj.childrenType = []; - } - return obj; - }, - - fromPartial, I>>(object: I): StructRwArrayData { - const message = createBaseStructRwArrayData(); - message.childrenArray = object.childrenArray?.map((e) => RwArray.fromPartial(e)) || []; - message.childrenType = object.childrenType?.map((e) => DataType.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseListRwArrayData(): ListRwArrayData { - return { offsets: [], value: undefined, valueType: undefined }; -} - -export const ListRwArrayData = { - fromJSON(object: any): ListRwArrayData { - return { - offsets: Array.isArray(object?.offsets) ? object.offsets.map((e: any) => Number(e)) : [], - value: isSet(object.value) ? RwArray.fromJSON(object.value) : undefined, - valueType: isSet(object.valueType) ? DataType.fromJSON(object.valueType) : undefined, - }; - }, - - toJSON(message: ListRwArrayData): unknown { - const obj: any = {}; - if (message.offsets) { - obj.offsets = message.offsets.map((e) => Math.round(e)); - } else { - obj.offsets = []; - } - message.value !== undefined && (obj.value = message.value ? RwArray.toJSON(message.value) : undefined); - message.valueType !== undefined && - (obj.valueType = message.valueType ? DataType.toJSON(message.valueType) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): ListRwArrayData { - const message = createBaseListRwArrayData(); - message.offsets = object.offsets?.map((e) => e) || []; - message.value = (object.value !== undefined && object.value !== null) - ? RwArray.fromPartial(object.value) - : undefined; - message.valueType = (object.valueType !== undefined && object.valueType !== null) - ? DataType.fromPartial(object.valueType) - : undefined; - return message; - }, -}; - -function createBaseRwArray(): RwArray { - return { - arrayType: RwArrayType.UNSPECIFIED, - nullBitmap: undefined, - values: [], - structArrayData: undefined, - listArrayData: undefined, - }; -} - -export const RwArray = { - fromJSON(object: any): RwArray { - return { - arrayType: isSet(object.arrayType) ? rwArrayTypeFromJSON(object.arrayType) : RwArrayType.UNSPECIFIED, - nullBitmap: isSet(object.nullBitmap) ? Buffer.fromJSON(object.nullBitmap) : undefined, - values: Array.isArray(object?.values) ? object.values.map((e: any) => Buffer.fromJSON(e)) : [], - structArrayData: isSet(object.structArrayData) ? StructRwArrayData.fromJSON(object.structArrayData) : undefined, - listArrayData: isSet(object.listArrayData) ? ListRwArrayData.fromJSON(object.listArrayData) : undefined, - }; - }, - - toJSON(message: RwArray): unknown { - const obj: any = {}; - message.arrayType !== undefined && (obj.arrayType = rwArrayTypeToJSON(message.arrayType)); - message.nullBitmap !== undefined && - (obj.nullBitmap = message.nullBitmap ? Buffer.toJSON(message.nullBitmap) : undefined); - if (message.values) { - obj.values = message.values.map((e) => e ? Buffer.toJSON(e) : undefined); - } else { - obj.values = []; - } - message.structArrayData !== undefined && - (obj.structArrayData = message.structArrayData ? StructRwArrayData.toJSON(message.structArrayData) : undefined); - message.listArrayData !== undefined && - (obj.listArrayData = message.listArrayData ? ListRwArrayData.toJSON(message.listArrayData) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): RwArray { - const message = createBaseRwArray(); - message.arrayType = object.arrayType ?? RwArrayType.UNSPECIFIED; - message.nullBitmap = (object.nullBitmap !== undefined && object.nullBitmap !== null) - ? Buffer.fromPartial(object.nullBitmap) - : undefined; - message.values = object.values?.map((e) => Buffer.fromPartial(e)) || []; - message.structArrayData = (object.structArrayData !== undefined && object.structArrayData !== null) - ? StructRwArrayData.fromPartial(object.structArrayData) - : undefined; - message.listArrayData = (object.listArrayData !== undefined && object.listArrayData !== null) - ? ListRwArrayData.fromPartial(object.listArrayData) - : undefined; - return message; - }, -}; - -function createBaseDatum(): Datum { - return { body: new Uint8Array() }; -} - -export const Datum = { - fromJSON(object: any): Datum { - return { body: isSet(object.body) ? bytesFromBase64(object.body) : new Uint8Array() }; - }, - - toJSON(message: Datum): unknown { - const obj: any = {}; - message.body !== undefined && - (obj.body = base64FromBytes(message.body !== undefined ? message.body : new Uint8Array())); - return obj; - }, - - fromPartial, I>>(object: I): Datum { - const message = createBaseDatum(); - message.body = object.body ?? new Uint8Array(); - return message; - }, -}; - -function createBaseColumn(): Column { - return { array: undefined }; -} - -export const Column = { - fromJSON(object: any): Column { - return { array: isSet(object.array) ? RwArray.fromJSON(object.array) : undefined }; - }, - - toJSON(message: Column): unknown { - const obj: any = {}; - message.array !== undefined && (obj.array = message.array ? RwArray.toJSON(message.array) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): Column { - const message = createBaseColumn(); - message.array = (object.array !== undefined && object.array !== null) - ? RwArray.fromPartial(object.array) - : undefined; - return message; - }, -}; - -function createBaseDataChunk(): DataChunk { - return { cardinality: 0, columns: [] }; -} - -export const DataChunk = { - fromJSON(object: any): DataChunk { - return { - cardinality: isSet(object.cardinality) ? Number(object.cardinality) : 0, - columns: Array.isArray(object?.columns) ? object.columns.map((e: any) => Column.fromJSON(e)) : [], - }; - }, - - toJSON(message: DataChunk): unknown { - const obj: any = {}; - message.cardinality !== undefined && (obj.cardinality = Math.round(message.cardinality)); - if (message.columns) { - obj.columns = message.columns.map((e) => e ? Column.toJSON(e) : undefined); - } else { - obj.columns = []; - } - return obj; - }, - - fromPartial, I>>(object: I): DataChunk { - const message = createBaseDataChunk(); - message.cardinality = object.cardinality ?? 0; - message.columns = object.columns?.map((e) => Column.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseStreamChunk(): StreamChunk { - return { cardinality: 0, ops: [], columns: [] }; -} - -export const StreamChunk = { - fromJSON(object: any): StreamChunk { - return { - cardinality: isSet(object.cardinality) ? Number(object.cardinality) : 0, - ops: Array.isArray(object?.ops) ? object.ops.map((e: any) => opFromJSON(e)) : [], - columns: Array.isArray(object?.columns) ? object.columns.map((e: any) => Column.fromJSON(e)) : [], - }; - }, - - toJSON(message: StreamChunk): unknown { - const obj: any = {}; - message.cardinality !== undefined && (obj.cardinality = Math.round(message.cardinality)); - if (message.ops) { - obj.ops = message.ops.map((e) => opToJSON(e)); - } else { - obj.ops = []; - } - if (message.columns) { - obj.columns = message.columns.map((e) => e ? Column.toJSON(e) : undefined); - } else { - obj.columns = []; - } - return obj; - }, - - fromPartial, I>>(object: I): StreamChunk { - const message = createBaseStreamChunk(); - message.cardinality = object.cardinality ?? 0; - message.ops = object.ops?.map((e) => e) || []; - message.columns = object.columns?.map((e) => Column.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseEpoch(): Epoch { - return { curr: 0, prev: 0 }; -} - -export const Epoch = { - fromJSON(object: any): Epoch { - return { curr: isSet(object.curr) ? Number(object.curr) : 0, prev: isSet(object.prev) ? Number(object.prev) : 0 }; - }, - - toJSON(message: Epoch): unknown { - const obj: any = {}; - message.curr !== undefined && (obj.curr = Math.round(message.curr)); - message.prev !== undefined && (obj.prev = Math.round(message.prev)); - return obj; - }, - - fromPartial, I>>(object: I): Epoch { - const message = createBaseEpoch(); - message.curr = object.curr ?? 0; - message.prev = object.prev ?? 0; - return message; - }, -}; - -function createBaseTerminate(): Terminate { - return {}; -} - -export const Terminate = { - fromJSON(_: any): Terminate { - return {}; - }, - - toJSON(_: Terminate): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): Terminate { - const message = createBaseTerminate(); - return message; - }, -}; - -declare var self: any | undefined; -declare var window: any | undefined; -declare var global: any | undefined; -var globalThis: any = (() => { - if (typeof globalThis !== "undefined") { - return globalThis; - } - if (typeof self !== "undefined") { - return self; - } - if (typeof window !== "undefined") { - return window; - } - if (typeof global !== "undefined") { - return global; - } - throw "Unable to locate global object"; -})(); - -function bytesFromBase64(b64: string): Uint8Array { - if (globalThis.Buffer) { - return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); - } else { - const bin = globalThis.atob(b64); - const arr = new Uint8Array(bin.length); - for (let i = 0; i < bin.length; ++i) { - arr[i] = bin.charCodeAt(i); - } - return arr; - } -} - -function base64FromBytes(arr: Uint8Array): string { - if (globalThis.Buffer) { - return globalThis.Buffer.from(arr).toString("base64"); - } else { - const bin: string[] = []; - arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); - }); - return globalThis.btoa(bin.join("")); - } -} - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> - : T extends { $case: string } ? { [K in keyof Omit]?: DeepPartial } & { $case: T["$case"] } - : T extends {} ? { [K in keyof T]?: DeepPartial } - : Partial; - -type KeysOfUnion = T extends T ? keyof T : never; -export type Exact = P extends Builtin ? P - : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; - -function isSet(value: any): boolean { - return value !== null && value !== undefined; -} diff --git a/dashboard/proto/gen/ddl_service.ts b/dashboard/proto/gen/ddl_service.ts deleted file mode 100644 index 56ba0f8aefac..000000000000 --- a/dashboard/proto/gen/ddl_service.ts +++ /dev/null @@ -1,1738 +0,0 @@ -/* eslint-disable */ -import { ColIndexMapping, Connection, Database, Function, Index, Schema, Sink, Source, Table, View } from "./catalog"; -import { Status } from "./common"; -import { StreamFragmentGraph } from "./stream_plan"; - -export const protobufPackage = "ddl_service"; - -export interface CreateDatabaseRequest { - db: Database | undefined; -} - -export interface CreateDatabaseResponse { - status: Status | undefined; - databaseId: number; - version: number; -} - -export interface DropDatabaseRequest { - databaseId: number; -} - -export interface DropDatabaseResponse { - status: Status | undefined; - version: number; -} - -export interface CreateSchemaRequest { - schema: Schema | undefined; -} - -export interface CreateSchemaResponse { - status: Status | undefined; - schemaId: number; - version: number; -} - -export interface DropSchemaRequest { - schemaId: number; -} - -export interface DropSchemaResponse { - status: Status | undefined; - version: number; -} - -export interface CreateSourceRequest { - source: Source | undefined; -} - -export interface CreateSourceResponse { - status: Status | undefined; - sourceId: number; - version: number; -} - -export interface DropSourceRequest { - sourceId: number; -} - -export interface DropSourceResponse { - status: Status | undefined; - version: number; -} - -export interface CreateSinkRequest { - sink: Sink | undefined; - fragmentGraph: StreamFragmentGraph | undefined; -} - -export interface CreateSinkResponse { - status: Status | undefined; - sinkId: number; - version: number; -} - -export interface DropSinkRequest { - sinkId: number; -} - -export interface DropSinkResponse { - status: Status | undefined; - version: number; -} - -export interface CreateMaterializedViewRequest { - materializedView: Table | undefined; - fragmentGraph: StreamFragmentGraph | undefined; -} - -export interface CreateMaterializedViewResponse { - status: Status | undefined; - tableId: number; - version: number; -} - -export interface DropMaterializedViewRequest { - tableId: number; -} - -export interface DropMaterializedViewResponse { - status: Status | undefined; - version: number; -} - -export interface CreateViewRequest { - view: View | undefined; -} - -export interface CreateViewResponse { - status: Status | undefined; - viewId: number; - version: number; -} - -export interface DropViewRequest { - viewId: number; -} - -export interface DropViewResponse { - status: Status | undefined; - version: number; -} - -export interface CreateTableRequest { - /** - * An optional field and will be `Some` for tables with an external connector. If so, the table - * will subscribe to the changes of the external connector and materialize the data. - */ - source: Source | undefined; - materializedView: Table | undefined; - fragmentGraph: StreamFragmentGraph | undefined; -} - -export interface CreateTableResponse { - status: Status | undefined; - tableId: number; - version: number; -} - -export interface CreateFunctionRequest { - function: Function | undefined; -} - -export interface CreateFunctionResponse { - status: Status | undefined; - functionId: number; - version: number; -} - -export interface DropFunctionRequest { - functionId: number; -} - -export interface DropFunctionResponse { - status: Status | undefined; - version: number; -} - -export interface DropTableRequest { - sourceId?: { $case: "id"; id: number }; - tableId: number; -} - -export interface DropTableResponse { - status: Status | undefined; - version: number; -} - -/** Used by risectl (and in the future, dashboard) */ -export interface RisectlListStateTablesRequest { -} - -/** Used by risectl (and in the future, dashboard) */ -export interface RisectlListStateTablesResponse { - tables: Table[]; -} - -export interface CreateIndexRequest { - index: Index | undefined; - indexTable: Table | undefined; - fragmentGraph: StreamFragmentGraph | undefined; -} - -export interface CreateIndexResponse { - status: Status | undefined; - indexId: number; - version: number; -} - -export interface DropIndexRequest { - indexId: number; -} - -export interface DropIndexResponse { - status: Status | undefined; - version: number; -} - -export interface ReplaceTablePlanRequest { - /** - * The new table catalog, with the correct table ID and a new version. - * If the new version does not match the subsequent version in the meta service's - * catalog, this request will be rejected. - */ - table: - | Table - | undefined; - /** The new materialization plan, where all schema are updated. */ - fragmentGraph: - | StreamFragmentGraph - | undefined; - /** The mapping from the old columns to the new columns of the table. */ - tableColIndexMapping: ColIndexMapping | undefined; -} - -export interface ReplaceTablePlanResponse { - status: - | Status - | undefined; - /** The new global catalog version. */ - version: number; -} - -export interface GetTableRequest { - databaseName: string; - tableName: string; -} - -export interface GetTableResponse { - table: Table | undefined; -} - -export interface GetDdlProgressRequest { -} - -export interface DdlProgress { - id: number; - statement: string; - progress: string; -} - -export interface GetDdlProgressResponse { - ddlProgress: DdlProgress[]; -} - -export interface CreateConnectionRequest { - payload?: { $case: "privateLink"; privateLink: CreateConnectionRequest_PrivateLink }; -} - -export interface CreateConnectionRequest_PrivateLink { - provider: string; - serviceName: string; - availabilityZones: string[]; -} - -export interface CreateConnectionResponse { - connectionId: number; - /** global catalog version */ - version: number; -} - -export interface ListConnectionsRequest { -} - -export interface ListConnectionsResponse { - connections: Connection[]; -} - -export interface DropConnectionRequest { - connectionName: string; -} - -export interface DropConnectionResponse { -} - -function createBaseCreateDatabaseRequest(): CreateDatabaseRequest { - return { db: undefined }; -} - -export const CreateDatabaseRequest = { - fromJSON(object: any): CreateDatabaseRequest { - return { db: isSet(object.db) ? Database.fromJSON(object.db) : undefined }; - }, - - toJSON(message: CreateDatabaseRequest): unknown { - const obj: any = {}; - message.db !== undefined && (obj.db = message.db ? Database.toJSON(message.db) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): CreateDatabaseRequest { - const message = createBaseCreateDatabaseRequest(); - message.db = (object.db !== undefined && object.db !== null) ? Database.fromPartial(object.db) : undefined; - return message; - }, -}; - -function createBaseCreateDatabaseResponse(): CreateDatabaseResponse { - return { status: undefined, databaseId: 0, version: 0 }; -} - -export const CreateDatabaseResponse = { - fromJSON(object: any): CreateDatabaseResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - databaseId: isSet(object.databaseId) ? Number(object.databaseId) : 0, - version: isSet(object.version) ? Number(object.version) : 0, - }; - }, - - toJSON(message: CreateDatabaseResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - message.databaseId !== undefined && (obj.databaseId = Math.round(message.databaseId)); - message.version !== undefined && (obj.version = Math.round(message.version)); - return obj; - }, - - fromPartial, I>>(object: I): CreateDatabaseResponse { - const message = createBaseCreateDatabaseResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.databaseId = object.databaseId ?? 0; - message.version = object.version ?? 0; - return message; - }, -}; - -function createBaseDropDatabaseRequest(): DropDatabaseRequest { - return { databaseId: 0 }; -} - -export const DropDatabaseRequest = { - fromJSON(object: any): DropDatabaseRequest { - return { databaseId: isSet(object.databaseId) ? Number(object.databaseId) : 0 }; - }, - - toJSON(message: DropDatabaseRequest): unknown { - const obj: any = {}; - message.databaseId !== undefined && (obj.databaseId = Math.round(message.databaseId)); - return obj; - }, - - fromPartial, I>>(object: I): DropDatabaseRequest { - const message = createBaseDropDatabaseRequest(); - message.databaseId = object.databaseId ?? 0; - return message; - }, -}; - -function createBaseDropDatabaseResponse(): DropDatabaseResponse { - return { status: undefined, version: 0 }; -} - -export const DropDatabaseResponse = { - fromJSON(object: any): DropDatabaseResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - version: isSet(object.version) ? Number(object.version) : 0, - }; - }, - - toJSON(message: DropDatabaseResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - message.version !== undefined && (obj.version = Math.round(message.version)); - return obj; - }, - - fromPartial, I>>(object: I): DropDatabaseResponse { - const message = createBaseDropDatabaseResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.version = object.version ?? 0; - return message; - }, -}; - -function createBaseCreateSchemaRequest(): CreateSchemaRequest { - return { schema: undefined }; -} - -export const CreateSchemaRequest = { - fromJSON(object: any): CreateSchemaRequest { - return { schema: isSet(object.schema) ? Schema.fromJSON(object.schema) : undefined }; - }, - - toJSON(message: CreateSchemaRequest): unknown { - const obj: any = {}; - message.schema !== undefined && (obj.schema = message.schema ? Schema.toJSON(message.schema) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): CreateSchemaRequest { - const message = createBaseCreateSchemaRequest(); - message.schema = (object.schema !== undefined && object.schema !== null) - ? Schema.fromPartial(object.schema) - : undefined; - return message; - }, -}; - -function createBaseCreateSchemaResponse(): CreateSchemaResponse { - return { status: undefined, schemaId: 0, version: 0 }; -} - -export const CreateSchemaResponse = { - fromJSON(object: any): CreateSchemaResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - schemaId: isSet(object.schemaId) ? Number(object.schemaId) : 0, - version: isSet(object.version) ? Number(object.version) : 0, - }; - }, - - toJSON(message: CreateSchemaResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - message.schemaId !== undefined && (obj.schemaId = Math.round(message.schemaId)); - message.version !== undefined && (obj.version = Math.round(message.version)); - return obj; - }, - - fromPartial, I>>(object: I): CreateSchemaResponse { - const message = createBaseCreateSchemaResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.schemaId = object.schemaId ?? 0; - message.version = object.version ?? 0; - return message; - }, -}; - -function createBaseDropSchemaRequest(): DropSchemaRequest { - return { schemaId: 0 }; -} - -export const DropSchemaRequest = { - fromJSON(object: any): DropSchemaRequest { - return { schemaId: isSet(object.schemaId) ? Number(object.schemaId) : 0 }; - }, - - toJSON(message: DropSchemaRequest): unknown { - const obj: any = {}; - message.schemaId !== undefined && (obj.schemaId = Math.round(message.schemaId)); - return obj; - }, - - fromPartial, I>>(object: I): DropSchemaRequest { - const message = createBaseDropSchemaRequest(); - message.schemaId = object.schemaId ?? 0; - return message; - }, -}; - -function createBaseDropSchemaResponse(): DropSchemaResponse { - return { status: undefined, version: 0 }; -} - -export const DropSchemaResponse = { - fromJSON(object: any): DropSchemaResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - version: isSet(object.version) ? Number(object.version) : 0, - }; - }, - - toJSON(message: DropSchemaResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - message.version !== undefined && (obj.version = Math.round(message.version)); - return obj; - }, - - fromPartial, I>>(object: I): DropSchemaResponse { - const message = createBaseDropSchemaResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.version = object.version ?? 0; - return message; - }, -}; - -function createBaseCreateSourceRequest(): CreateSourceRequest { - return { source: undefined }; -} - -export const CreateSourceRequest = { - fromJSON(object: any): CreateSourceRequest { - return { source: isSet(object.source) ? Source.fromJSON(object.source) : undefined }; - }, - - toJSON(message: CreateSourceRequest): unknown { - const obj: any = {}; - message.source !== undefined && (obj.source = message.source ? Source.toJSON(message.source) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): CreateSourceRequest { - const message = createBaseCreateSourceRequest(); - message.source = (object.source !== undefined && object.source !== null) - ? Source.fromPartial(object.source) - : undefined; - return message; - }, -}; - -function createBaseCreateSourceResponse(): CreateSourceResponse { - return { status: undefined, sourceId: 0, version: 0 }; -} - -export const CreateSourceResponse = { - fromJSON(object: any): CreateSourceResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - sourceId: isSet(object.sourceId) ? Number(object.sourceId) : 0, - version: isSet(object.version) ? Number(object.version) : 0, - }; - }, - - toJSON(message: CreateSourceResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - message.sourceId !== undefined && (obj.sourceId = Math.round(message.sourceId)); - message.version !== undefined && (obj.version = Math.round(message.version)); - return obj; - }, - - fromPartial, I>>(object: I): CreateSourceResponse { - const message = createBaseCreateSourceResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.sourceId = object.sourceId ?? 0; - message.version = object.version ?? 0; - return message; - }, -}; - -function createBaseDropSourceRequest(): DropSourceRequest { - return { sourceId: 0 }; -} - -export const DropSourceRequest = { - fromJSON(object: any): DropSourceRequest { - return { sourceId: isSet(object.sourceId) ? Number(object.sourceId) : 0 }; - }, - - toJSON(message: DropSourceRequest): unknown { - const obj: any = {}; - message.sourceId !== undefined && (obj.sourceId = Math.round(message.sourceId)); - return obj; - }, - - fromPartial, I>>(object: I): DropSourceRequest { - const message = createBaseDropSourceRequest(); - message.sourceId = object.sourceId ?? 0; - return message; - }, -}; - -function createBaseDropSourceResponse(): DropSourceResponse { - return { status: undefined, version: 0 }; -} - -export const DropSourceResponse = { - fromJSON(object: any): DropSourceResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - version: isSet(object.version) ? Number(object.version) : 0, - }; - }, - - toJSON(message: DropSourceResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - message.version !== undefined && (obj.version = Math.round(message.version)); - return obj; - }, - - fromPartial, I>>(object: I): DropSourceResponse { - const message = createBaseDropSourceResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.version = object.version ?? 0; - return message; - }, -}; - -function createBaseCreateSinkRequest(): CreateSinkRequest { - return { sink: undefined, fragmentGraph: undefined }; -} - -export const CreateSinkRequest = { - fromJSON(object: any): CreateSinkRequest { - return { - sink: isSet(object.sink) ? Sink.fromJSON(object.sink) : undefined, - fragmentGraph: isSet(object.fragmentGraph) ? StreamFragmentGraph.fromJSON(object.fragmentGraph) : undefined, - }; - }, - - toJSON(message: CreateSinkRequest): unknown { - const obj: any = {}; - message.sink !== undefined && (obj.sink = message.sink ? Sink.toJSON(message.sink) : undefined); - message.fragmentGraph !== undefined && - (obj.fragmentGraph = message.fragmentGraph ? StreamFragmentGraph.toJSON(message.fragmentGraph) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): CreateSinkRequest { - const message = createBaseCreateSinkRequest(); - message.sink = (object.sink !== undefined && object.sink !== null) ? Sink.fromPartial(object.sink) : undefined; - message.fragmentGraph = (object.fragmentGraph !== undefined && object.fragmentGraph !== null) - ? StreamFragmentGraph.fromPartial(object.fragmentGraph) - : undefined; - return message; - }, -}; - -function createBaseCreateSinkResponse(): CreateSinkResponse { - return { status: undefined, sinkId: 0, version: 0 }; -} - -export const CreateSinkResponse = { - fromJSON(object: any): CreateSinkResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - sinkId: isSet(object.sinkId) ? Number(object.sinkId) : 0, - version: isSet(object.version) ? Number(object.version) : 0, - }; - }, - - toJSON(message: CreateSinkResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - message.sinkId !== undefined && (obj.sinkId = Math.round(message.sinkId)); - message.version !== undefined && (obj.version = Math.round(message.version)); - return obj; - }, - - fromPartial, I>>(object: I): CreateSinkResponse { - const message = createBaseCreateSinkResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.sinkId = object.sinkId ?? 0; - message.version = object.version ?? 0; - return message; - }, -}; - -function createBaseDropSinkRequest(): DropSinkRequest { - return { sinkId: 0 }; -} - -export const DropSinkRequest = { - fromJSON(object: any): DropSinkRequest { - return { sinkId: isSet(object.sinkId) ? Number(object.sinkId) : 0 }; - }, - - toJSON(message: DropSinkRequest): unknown { - const obj: any = {}; - message.sinkId !== undefined && (obj.sinkId = Math.round(message.sinkId)); - return obj; - }, - - fromPartial, I>>(object: I): DropSinkRequest { - const message = createBaseDropSinkRequest(); - message.sinkId = object.sinkId ?? 0; - return message; - }, -}; - -function createBaseDropSinkResponse(): DropSinkResponse { - return { status: undefined, version: 0 }; -} - -export const DropSinkResponse = { - fromJSON(object: any): DropSinkResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - version: isSet(object.version) ? Number(object.version) : 0, - }; - }, - - toJSON(message: DropSinkResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - message.version !== undefined && (obj.version = Math.round(message.version)); - return obj; - }, - - fromPartial, I>>(object: I): DropSinkResponse { - const message = createBaseDropSinkResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.version = object.version ?? 0; - return message; - }, -}; - -function createBaseCreateMaterializedViewRequest(): CreateMaterializedViewRequest { - return { materializedView: undefined, fragmentGraph: undefined }; -} - -export const CreateMaterializedViewRequest = { - fromJSON(object: any): CreateMaterializedViewRequest { - return { - materializedView: isSet(object.materializedView) ? Table.fromJSON(object.materializedView) : undefined, - fragmentGraph: isSet(object.fragmentGraph) ? StreamFragmentGraph.fromJSON(object.fragmentGraph) : undefined, - }; - }, - - toJSON(message: CreateMaterializedViewRequest): unknown { - const obj: any = {}; - message.materializedView !== undefined && - (obj.materializedView = message.materializedView ? Table.toJSON(message.materializedView) : undefined); - message.fragmentGraph !== undefined && - (obj.fragmentGraph = message.fragmentGraph ? StreamFragmentGraph.toJSON(message.fragmentGraph) : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): CreateMaterializedViewRequest { - const message = createBaseCreateMaterializedViewRequest(); - message.materializedView = (object.materializedView !== undefined && object.materializedView !== null) - ? Table.fromPartial(object.materializedView) - : undefined; - message.fragmentGraph = (object.fragmentGraph !== undefined && object.fragmentGraph !== null) - ? StreamFragmentGraph.fromPartial(object.fragmentGraph) - : undefined; - return message; - }, -}; - -function createBaseCreateMaterializedViewResponse(): CreateMaterializedViewResponse { - return { status: undefined, tableId: 0, version: 0 }; -} - -export const CreateMaterializedViewResponse = { - fromJSON(object: any): CreateMaterializedViewResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - tableId: isSet(object.tableId) ? Number(object.tableId) : 0, - version: isSet(object.version) ? Number(object.version) : 0, - }; - }, - - toJSON(message: CreateMaterializedViewResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - message.tableId !== undefined && (obj.tableId = Math.round(message.tableId)); - message.version !== undefined && (obj.version = Math.round(message.version)); - return obj; - }, - - fromPartial, I>>( - object: I, - ): CreateMaterializedViewResponse { - const message = createBaseCreateMaterializedViewResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.tableId = object.tableId ?? 0; - message.version = object.version ?? 0; - return message; - }, -}; - -function createBaseDropMaterializedViewRequest(): DropMaterializedViewRequest { - return { tableId: 0 }; -} - -export const DropMaterializedViewRequest = { - fromJSON(object: any): DropMaterializedViewRequest { - return { tableId: isSet(object.tableId) ? Number(object.tableId) : 0 }; - }, - - toJSON(message: DropMaterializedViewRequest): unknown { - const obj: any = {}; - message.tableId !== undefined && (obj.tableId = Math.round(message.tableId)); - return obj; - }, - - fromPartial, I>>(object: I): DropMaterializedViewRequest { - const message = createBaseDropMaterializedViewRequest(); - message.tableId = object.tableId ?? 0; - return message; - }, -}; - -function createBaseDropMaterializedViewResponse(): DropMaterializedViewResponse { - return { status: undefined, version: 0 }; -} - -export const DropMaterializedViewResponse = { - fromJSON(object: any): DropMaterializedViewResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - version: isSet(object.version) ? Number(object.version) : 0, - }; - }, - - toJSON(message: DropMaterializedViewResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - message.version !== undefined && (obj.version = Math.round(message.version)); - return obj; - }, - - fromPartial, I>>(object: I): DropMaterializedViewResponse { - const message = createBaseDropMaterializedViewResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.version = object.version ?? 0; - return message; - }, -}; - -function createBaseCreateViewRequest(): CreateViewRequest { - return { view: undefined }; -} - -export const CreateViewRequest = { - fromJSON(object: any): CreateViewRequest { - return { view: isSet(object.view) ? View.fromJSON(object.view) : undefined }; - }, - - toJSON(message: CreateViewRequest): unknown { - const obj: any = {}; - message.view !== undefined && (obj.view = message.view ? View.toJSON(message.view) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): CreateViewRequest { - const message = createBaseCreateViewRequest(); - message.view = (object.view !== undefined && object.view !== null) ? View.fromPartial(object.view) : undefined; - return message; - }, -}; - -function createBaseCreateViewResponse(): CreateViewResponse { - return { status: undefined, viewId: 0, version: 0 }; -} - -export const CreateViewResponse = { - fromJSON(object: any): CreateViewResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - viewId: isSet(object.viewId) ? Number(object.viewId) : 0, - version: isSet(object.version) ? Number(object.version) : 0, - }; - }, - - toJSON(message: CreateViewResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - message.viewId !== undefined && (obj.viewId = Math.round(message.viewId)); - message.version !== undefined && (obj.version = Math.round(message.version)); - return obj; - }, - - fromPartial, I>>(object: I): CreateViewResponse { - const message = createBaseCreateViewResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.viewId = object.viewId ?? 0; - message.version = object.version ?? 0; - return message; - }, -}; - -function createBaseDropViewRequest(): DropViewRequest { - return { viewId: 0 }; -} - -export const DropViewRequest = { - fromJSON(object: any): DropViewRequest { - return { viewId: isSet(object.viewId) ? Number(object.viewId) : 0 }; - }, - - toJSON(message: DropViewRequest): unknown { - const obj: any = {}; - message.viewId !== undefined && (obj.viewId = Math.round(message.viewId)); - return obj; - }, - - fromPartial, I>>(object: I): DropViewRequest { - const message = createBaseDropViewRequest(); - message.viewId = object.viewId ?? 0; - return message; - }, -}; - -function createBaseDropViewResponse(): DropViewResponse { - return { status: undefined, version: 0 }; -} - -export const DropViewResponse = { - fromJSON(object: any): DropViewResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - version: isSet(object.version) ? Number(object.version) : 0, - }; - }, - - toJSON(message: DropViewResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - message.version !== undefined && (obj.version = Math.round(message.version)); - return obj; - }, - - fromPartial, I>>(object: I): DropViewResponse { - const message = createBaseDropViewResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.version = object.version ?? 0; - return message; - }, -}; - -function createBaseCreateTableRequest(): CreateTableRequest { - return { source: undefined, materializedView: undefined, fragmentGraph: undefined }; -} - -export const CreateTableRequest = { - fromJSON(object: any): CreateTableRequest { - return { - source: isSet(object.source) ? Source.fromJSON(object.source) : undefined, - materializedView: isSet(object.materializedView) ? Table.fromJSON(object.materializedView) : undefined, - fragmentGraph: isSet(object.fragmentGraph) ? StreamFragmentGraph.fromJSON(object.fragmentGraph) : undefined, - }; - }, - - toJSON(message: CreateTableRequest): unknown { - const obj: any = {}; - message.source !== undefined && (obj.source = message.source ? Source.toJSON(message.source) : undefined); - message.materializedView !== undefined && - (obj.materializedView = message.materializedView ? Table.toJSON(message.materializedView) : undefined); - message.fragmentGraph !== undefined && - (obj.fragmentGraph = message.fragmentGraph ? StreamFragmentGraph.toJSON(message.fragmentGraph) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): CreateTableRequest { - const message = createBaseCreateTableRequest(); - message.source = (object.source !== undefined && object.source !== null) - ? Source.fromPartial(object.source) - : undefined; - message.materializedView = (object.materializedView !== undefined && object.materializedView !== null) - ? Table.fromPartial(object.materializedView) - : undefined; - message.fragmentGraph = (object.fragmentGraph !== undefined && object.fragmentGraph !== null) - ? StreamFragmentGraph.fromPartial(object.fragmentGraph) - : undefined; - return message; - }, -}; - -function createBaseCreateTableResponse(): CreateTableResponse { - return { status: undefined, tableId: 0, version: 0 }; -} - -export const CreateTableResponse = { - fromJSON(object: any): CreateTableResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - tableId: isSet(object.tableId) ? Number(object.tableId) : 0, - version: isSet(object.version) ? Number(object.version) : 0, - }; - }, - - toJSON(message: CreateTableResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - message.tableId !== undefined && (obj.tableId = Math.round(message.tableId)); - message.version !== undefined && (obj.version = Math.round(message.version)); - return obj; - }, - - fromPartial, I>>(object: I): CreateTableResponse { - const message = createBaseCreateTableResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.tableId = object.tableId ?? 0; - message.version = object.version ?? 0; - return message; - }, -}; - -function createBaseCreateFunctionRequest(): CreateFunctionRequest { - return { function: undefined }; -} - -export const CreateFunctionRequest = { - fromJSON(object: any): CreateFunctionRequest { - return { function: isSet(object.function) ? Function.fromJSON(object.function) : undefined }; - }, - - toJSON(message: CreateFunctionRequest): unknown { - const obj: any = {}; - message.function !== undefined && (obj.function = message.function ? Function.toJSON(message.function) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): CreateFunctionRequest { - const message = createBaseCreateFunctionRequest(); - message.function = (object.function !== undefined && object.function !== null) - ? Function.fromPartial(object.function) - : undefined; - return message; - }, -}; - -function createBaseCreateFunctionResponse(): CreateFunctionResponse { - return { status: undefined, functionId: 0, version: 0 }; -} - -export const CreateFunctionResponse = { - fromJSON(object: any): CreateFunctionResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - functionId: isSet(object.functionId) ? Number(object.functionId) : 0, - version: isSet(object.version) ? Number(object.version) : 0, - }; - }, - - toJSON(message: CreateFunctionResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - message.functionId !== undefined && (obj.functionId = Math.round(message.functionId)); - message.version !== undefined && (obj.version = Math.round(message.version)); - return obj; - }, - - fromPartial, I>>(object: I): CreateFunctionResponse { - const message = createBaseCreateFunctionResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.functionId = object.functionId ?? 0; - message.version = object.version ?? 0; - return message; - }, -}; - -function createBaseDropFunctionRequest(): DropFunctionRequest { - return { functionId: 0 }; -} - -export const DropFunctionRequest = { - fromJSON(object: any): DropFunctionRequest { - return { functionId: isSet(object.functionId) ? Number(object.functionId) : 0 }; - }, - - toJSON(message: DropFunctionRequest): unknown { - const obj: any = {}; - message.functionId !== undefined && (obj.functionId = Math.round(message.functionId)); - return obj; - }, - - fromPartial, I>>(object: I): DropFunctionRequest { - const message = createBaseDropFunctionRequest(); - message.functionId = object.functionId ?? 0; - return message; - }, -}; - -function createBaseDropFunctionResponse(): DropFunctionResponse { - return { status: undefined, version: 0 }; -} - -export const DropFunctionResponse = { - fromJSON(object: any): DropFunctionResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - version: isSet(object.version) ? Number(object.version) : 0, - }; - }, - - toJSON(message: DropFunctionResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - message.version !== undefined && (obj.version = Math.round(message.version)); - return obj; - }, - - fromPartial, I>>(object: I): DropFunctionResponse { - const message = createBaseDropFunctionResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.version = object.version ?? 0; - return message; - }, -}; - -function createBaseDropTableRequest(): DropTableRequest { - return { sourceId: undefined, tableId: 0 }; -} - -export const DropTableRequest = { - fromJSON(object: any): DropTableRequest { - return { - sourceId: isSet(object.id) ? { $case: "id", id: Number(object.id) } : undefined, - tableId: isSet(object.tableId) ? Number(object.tableId) : 0, - }; - }, - - toJSON(message: DropTableRequest): unknown { - const obj: any = {}; - message.sourceId?.$case === "id" && (obj.id = Math.round(message.sourceId?.id)); - message.tableId !== undefined && (obj.tableId = Math.round(message.tableId)); - return obj; - }, - - fromPartial, I>>(object: I): DropTableRequest { - const message = createBaseDropTableRequest(); - if (object.sourceId?.$case === "id" && object.sourceId?.id !== undefined && object.sourceId?.id !== null) { - message.sourceId = { $case: "id", id: object.sourceId.id }; - } - message.tableId = object.tableId ?? 0; - return message; - }, -}; - -function createBaseDropTableResponse(): DropTableResponse { - return { status: undefined, version: 0 }; -} - -export const DropTableResponse = { - fromJSON(object: any): DropTableResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - version: isSet(object.version) ? Number(object.version) : 0, - }; - }, - - toJSON(message: DropTableResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - message.version !== undefined && (obj.version = Math.round(message.version)); - return obj; - }, - - fromPartial, I>>(object: I): DropTableResponse { - const message = createBaseDropTableResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.version = object.version ?? 0; - return message; - }, -}; - -function createBaseRisectlListStateTablesRequest(): RisectlListStateTablesRequest { - return {}; -} - -export const RisectlListStateTablesRequest = { - fromJSON(_: any): RisectlListStateTablesRequest { - return {}; - }, - - toJSON(_: RisectlListStateTablesRequest): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): RisectlListStateTablesRequest { - const message = createBaseRisectlListStateTablesRequest(); - return message; - }, -}; - -function createBaseRisectlListStateTablesResponse(): RisectlListStateTablesResponse { - return { tables: [] }; -} - -export const RisectlListStateTablesResponse = { - fromJSON(object: any): RisectlListStateTablesResponse { - return { tables: Array.isArray(object?.tables) ? object.tables.map((e: any) => Table.fromJSON(e)) : [] }; - }, - - toJSON(message: RisectlListStateTablesResponse): unknown { - const obj: any = {}; - if (message.tables) { - obj.tables = message.tables.map((e) => e ? Table.toJSON(e) : undefined); - } else { - obj.tables = []; - } - return obj; - }, - - fromPartial, I>>( - object: I, - ): RisectlListStateTablesResponse { - const message = createBaseRisectlListStateTablesResponse(); - message.tables = object.tables?.map((e) => Table.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseCreateIndexRequest(): CreateIndexRequest { - return { index: undefined, indexTable: undefined, fragmentGraph: undefined }; -} - -export const CreateIndexRequest = { - fromJSON(object: any): CreateIndexRequest { - return { - index: isSet(object.index) ? Index.fromJSON(object.index) : undefined, - indexTable: isSet(object.indexTable) ? Table.fromJSON(object.indexTable) : undefined, - fragmentGraph: isSet(object.fragmentGraph) ? StreamFragmentGraph.fromJSON(object.fragmentGraph) : undefined, - }; - }, - - toJSON(message: CreateIndexRequest): unknown { - const obj: any = {}; - message.index !== undefined && (obj.index = message.index ? Index.toJSON(message.index) : undefined); - message.indexTable !== undefined && - (obj.indexTable = message.indexTable ? Table.toJSON(message.indexTable) : undefined); - message.fragmentGraph !== undefined && - (obj.fragmentGraph = message.fragmentGraph ? StreamFragmentGraph.toJSON(message.fragmentGraph) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): CreateIndexRequest { - const message = createBaseCreateIndexRequest(); - message.index = (object.index !== undefined && object.index !== null) ? Index.fromPartial(object.index) : undefined; - message.indexTable = (object.indexTable !== undefined && object.indexTable !== null) - ? Table.fromPartial(object.indexTable) - : undefined; - message.fragmentGraph = (object.fragmentGraph !== undefined && object.fragmentGraph !== null) - ? StreamFragmentGraph.fromPartial(object.fragmentGraph) - : undefined; - return message; - }, -}; - -function createBaseCreateIndexResponse(): CreateIndexResponse { - return { status: undefined, indexId: 0, version: 0 }; -} - -export const CreateIndexResponse = { - fromJSON(object: any): CreateIndexResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - indexId: isSet(object.indexId) ? Number(object.indexId) : 0, - version: isSet(object.version) ? Number(object.version) : 0, - }; - }, - - toJSON(message: CreateIndexResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - message.indexId !== undefined && (obj.indexId = Math.round(message.indexId)); - message.version !== undefined && (obj.version = Math.round(message.version)); - return obj; - }, - - fromPartial, I>>(object: I): CreateIndexResponse { - const message = createBaseCreateIndexResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.indexId = object.indexId ?? 0; - message.version = object.version ?? 0; - return message; - }, -}; - -function createBaseDropIndexRequest(): DropIndexRequest { - return { indexId: 0 }; -} - -export const DropIndexRequest = { - fromJSON(object: any): DropIndexRequest { - return { indexId: isSet(object.indexId) ? Number(object.indexId) : 0 }; - }, - - toJSON(message: DropIndexRequest): unknown { - const obj: any = {}; - message.indexId !== undefined && (obj.indexId = Math.round(message.indexId)); - return obj; - }, - - fromPartial, I>>(object: I): DropIndexRequest { - const message = createBaseDropIndexRequest(); - message.indexId = object.indexId ?? 0; - return message; - }, -}; - -function createBaseDropIndexResponse(): DropIndexResponse { - return { status: undefined, version: 0 }; -} - -export const DropIndexResponse = { - fromJSON(object: any): DropIndexResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - version: isSet(object.version) ? Number(object.version) : 0, - }; - }, - - toJSON(message: DropIndexResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - message.version !== undefined && (obj.version = Math.round(message.version)); - return obj; - }, - - fromPartial, I>>(object: I): DropIndexResponse { - const message = createBaseDropIndexResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.version = object.version ?? 0; - return message; - }, -}; - -function createBaseReplaceTablePlanRequest(): ReplaceTablePlanRequest { - return { table: undefined, fragmentGraph: undefined, tableColIndexMapping: undefined }; -} - -export const ReplaceTablePlanRequest = { - fromJSON(object: any): ReplaceTablePlanRequest { - return { - table: isSet(object.table) ? Table.fromJSON(object.table) : undefined, - fragmentGraph: isSet(object.fragmentGraph) ? StreamFragmentGraph.fromJSON(object.fragmentGraph) : undefined, - tableColIndexMapping: isSet(object.tableColIndexMapping) - ? ColIndexMapping.fromJSON(object.tableColIndexMapping) - : undefined, - }; - }, - - toJSON(message: ReplaceTablePlanRequest): unknown { - const obj: any = {}; - message.table !== undefined && (obj.table = message.table ? Table.toJSON(message.table) : undefined); - message.fragmentGraph !== undefined && - (obj.fragmentGraph = message.fragmentGraph ? StreamFragmentGraph.toJSON(message.fragmentGraph) : undefined); - message.tableColIndexMapping !== undefined && (obj.tableColIndexMapping = message.tableColIndexMapping - ? ColIndexMapping.toJSON(message.tableColIndexMapping) - : undefined); - return obj; - }, - - fromPartial, I>>(object: I): ReplaceTablePlanRequest { - const message = createBaseReplaceTablePlanRequest(); - message.table = (object.table !== undefined && object.table !== null) ? Table.fromPartial(object.table) : undefined; - message.fragmentGraph = (object.fragmentGraph !== undefined && object.fragmentGraph !== null) - ? StreamFragmentGraph.fromPartial(object.fragmentGraph) - : undefined; - message.tableColIndexMapping = (object.tableColIndexMapping !== undefined && object.tableColIndexMapping !== null) - ? ColIndexMapping.fromPartial(object.tableColIndexMapping) - : undefined; - return message; - }, -}; - -function createBaseReplaceTablePlanResponse(): ReplaceTablePlanResponse { - return { status: undefined, version: 0 }; -} - -export const ReplaceTablePlanResponse = { - fromJSON(object: any): ReplaceTablePlanResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - version: isSet(object.version) ? Number(object.version) : 0, - }; - }, - - toJSON(message: ReplaceTablePlanResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - message.version !== undefined && (obj.version = Math.round(message.version)); - return obj; - }, - - fromPartial, I>>(object: I): ReplaceTablePlanResponse { - const message = createBaseReplaceTablePlanResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.version = object.version ?? 0; - return message; - }, -}; - -function createBaseGetTableRequest(): GetTableRequest { - return { databaseName: "", tableName: "" }; -} - -export const GetTableRequest = { - fromJSON(object: any): GetTableRequest { - return { - databaseName: isSet(object.databaseName) ? String(object.databaseName) : "", - tableName: isSet(object.tableName) ? String(object.tableName) : "", - }; - }, - - toJSON(message: GetTableRequest): unknown { - const obj: any = {}; - message.databaseName !== undefined && (obj.databaseName = message.databaseName); - message.tableName !== undefined && (obj.tableName = message.tableName); - return obj; - }, - - fromPartial, I>>(object: I): GetTableRequest { - const message = createBaseGetTableRequest(); - message.databaseName = object.databaseName ?? ""; - message.tableName = object.tableName ?? ""; - return message; - }, -}; - -function createBaseGetTableResponse(): GetTableResponse { - return { table: undefined }; -} - -export const GetTableResponse = { - fromJSON(object: any): GetTableResponse { - return { table: isSet(object.table) ? Table.fromJSON(object.table) : undefined }; - }, - - toJSON(message: GetTableResponse): unknown { - const obj: any = {}; - message.table !== undefined && (obj.table = message.table ? Table.toJSON(message.table) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): GetTableResponse { - const message = createBaseGetTableResponse(); - message.table = (object.table !== undefined && object.table !== null) ? Table.fromPartial(object.table) : undefined; - return message; - }, -}; - -function createBaseGetDdlProgressRequest(): GetDdlProgressRequest { - return {}; -} - -export const GetDdlProgressRequest = { - fromJSON(_: any): GetDdlProgressRequest { - return {}; - }, - - toJSON(_: GetDdlProgressRequest): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): GetDdlProgressRequest { - const message = createBaseGetDdlProgressRequest(); - return message; - }, -}; - -function createBaseDdlProgress(): DdlProgress { - return { id: 0, statement: "", progress: "" }; -} - -export const DdlProgress = { - fromJSON(object: any): DdlProgress { - return { - id: isSet(object.id) ? Number(object.id) : 0, - statement: isSet(object.statement) ? String(object.statement) : "", - progress: isSet(object.progress) ? String(object.progress) : "", - }; - }, - - toJSON(message: DdlProgress): unknown { - const obj: any = {}; - message.id !== undefined && (obj.id = Math.round(message.id)); - message.statement !== undefined && (obj.statement = message.statement); - message.progress !== undefined && (obj.progress = message.progress); - return obj; - }, - - fromPartial, I>>(object: I): DdlProgress { - const message = createBaseDdlProgress(); - message.id = object.id ?? 0; - message.statement = object.statement ?? ""; - message.progress = object.progress ?? ""; - return message; - }, -}; - -function createBaseGetDdlProgressResponse(): GetDdlProgressResponse { - return { ddlProgress: [] }; -} - -export const GetDdlProgressResponse = { - fromJSON(object: any): GetDdlProgressResponse { - return { - ddlProgress: Array.isArray(object?.ddlProgress) - ? object.ddlProgress.map((e: any) => DdlProgress.fromJSON(e)) - : [], - }; - }, - - toJSON(message: GetDdlProgressResponse): unknown { - const obj: any = {}; - if (message.ddlProgress) { - obj.ddlProgress = message.ddlProgress.map((e) => e ? DdlProgress.toJSON(e) : undefined); - } else { - obj.ddlProgress = []; - } - return obj; - }, - - fromPartial, I>>(object: I): GetDdlProgressResponse { - const message = createBaseGetDdlProgressResponse(); - message.ddlProgress = object.ddlProgress?.map((e) => DdlProgress.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseCreateConnectionRequest(): CreateConnectionRequest { - return { payload: undefined }; -} - -export const CreateConnectionRequest = { - fromJSON(object: any): CreateConnectionRequest { - return { - payload: isSet(object.privateLink) - ? { $case: "privateLink", privateLink: CreateConnectionRequest_PrivateLink.fromJSON(object.privateLink) } - : undefined, - }; - }, - - toJSON(message: CreateConnectionRequest): unknown { - const obj: any = {}; - message.payload?.$case === "privateLink" && (obj.privateLink = message.payload?.privateLink - ? CreateConnectionRequest_PrivateLink.toJSON(message.payload?.privateLink) - : undefined); - return obj; - }, - - fromPartial, I>>(object: I): CreateConnectionRequest { - const message = createBaseCreateConnectionRequest(); - if ( - object.payload?.$case === "privateLink" && - object.payload?.privateLink !== undefined && - object.payload?.privateLink !== null - ) { - message.payload = { - $case: "privateLink", - privateLink: CreateConnectionRequest_PrivateLink.fromPartial(object.payload.privateLink), - }; - } - return message; - }, -}; - -function createBaseCreateConnectionRequest_PrivateLink(): CreateConnectionRequest_PrivateLink { - return { provider: "", serviceName: "", availabilityZones: [] }; -} - -export const CreateConnectionRequest_PrivateLink = { - fromJSON(object: any): CreateConnectionRequest_PrivateLink { - return { - provider: isSet(object.provider) ? String(object.provider) : "", - serviceName: isSet(object.serviceName) ? String(object.serviceName) : "", - availabilityZones: Array.isArray(object?.availabilityZones) - ? object.availabilityZones.map((e: any) => String(e)) - : [], - }; - }, - - toJSON(message: CreateConnectionRequest_PrivateLink): unknown { - const obj: any = {}; - message.provider !== undefined && (obj.provider = message.provider); - message.serviceName !== undefined && (obj.serviceName = message.serviceName); - if (message.availabilityZones) { - obj.availabilityZones = message.availabilityZones.map((e) => e); - } else { - obj.availabilityZones = []; - } - return obj; - }, - - fromPartial, I>>( - object: I, - ): CreateConnectionRequest_PrivateLink { - const message = createBaseCreateConnectionRequest_PrivateLink(); - message.provider = object.provider ?? ""; - message.serviceName = object.serviceName ?? ""; - message.availabilityZones = object.availabilityZones?.map((e) => e) || []; - return message; - }, -}; - -function createBaseCreateConnectionResponse(): CreateConnectionResponse { - return { connectionId: 0, version: 0 }; -} - -export const CreateConnectionResponse = { - fromJSON(object: any): CreateConnectionResponse { - return { - connectionId: isSet(object.connectionId) ? Number(object.connectionId) : 0, - version: isSet(object.version) ? Number(object.version) : 0, - }; - }, - - toJSON(message: CreateConnectionResponse): unknown { - const obj: any = {}; - message.connectionId !== undefined && (obj.connectionId = Math.round(message.connectionId)); - message.version !== undefined && (obj.version = Math.round(message.version)); - return obj; - }, - - fromPartial, I>>(object: I): CreateConnectionResponse { - const message = createBaseCreateConnectionResponse(); - message.connectionId = object.connectionId ?? 0; - message.version = object.version ?? 0; - return message; - }, -}; - -function createBaseListConnectionsRequest(): ListConnectionsRequest { - return {}; -} - -export const ListConnectionsRequest = { - fromJSON(_: any): ListConnectionsRequest { - return {}; - }, - - toJSON(_: ListConnectionsRequest): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): ListConnectionsRequest { - const message = createBaseListConnectionsRequest(); - return message; - }, -}; - -function createBaseListConnectionsResponse(): ListConnectionsResponse { - return { connections: [] }; -} - -export const ListConnectionsResponse = { - fromJSON(object: any): ListConnectionsResponse { - return { - connections: Array.isArray(object?.connections) ? object.connections.map((e: any) => Connection.fromJSON(e)) : [], - }; - }, - - toJSON(message: ListConnectionsResponse): unknown { - const obj: any = {}; - if (message.connections) { - obj.connections = message.connections.map((e) => e ? Connection.toJSON(e) : undefined); - } else { - obj.connections = []; - } - return obj; - }, - - fromPartial, I>>(object: I): ListConnectionsResponse { - const message = createBaseListConnectionsResponse(); - message.connections = object.connections?.map((e) => Connection.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseDropConnectionRequest(): DropConnectionRequest { - return { connectionName: "" }; -} - -export const DropConnectionRequest = { - fromJSON(object: any): DropConnectionRequest { - return { connectionName: isSet(object.connectionName) ? String(object.connectionName) : "" }; - }, - - toJSON(message: DropConnectionRequest): unknown { - const obj: any = {}; - message.connectionName !== undefined && (obj.connectionName = message.connectionName); - return obj; - }, - - fromPartial, I>>(object: I): DropConnectionRequest { - const message = createBaseDropConnectionRequest(); - message.connectionName = object.connectionName ?? ""; - return message; - }, -}; - -function createBaseDropConnectionResponse(): DropConnectionResponse { - return {}; -} - -export const DropConnectionResponse = { - fromJSON(_: any): DropConnectionResponse { - return {}; - }, - - toJSON(_: DropConnectionResponse): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): DropConnectionResponse { - const message = createBaseDropConnectionResponse(); - return message; - }, -}; - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> - : T extends { $case: string } ? { [K in keyof Omit]?: DeepPartial } & { $case: T["$case"] } - : T extends {} ? { [K in keyof T]?: DeepPartial } - : Partial; - -type KeysOfUnion = T extends T ? keyof T : never; -export type Exact = P extends Builtin ? P - : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; - -function isSet(value: any): boolean { - return value !== null && value !== undefined; -} diff --git a/dashboard/proto/gen/expr.ts b/dashboard/proto/gen/expr.ts deleted file mode 100644 index 4faa1e414aa7..000000000000 --- a/dashboard/proto/gen/expr.ts +++ /dev/null @@ -1,1267 +0,0 @@ -/* eslint-disable */ -import { ColumnOrder } from "./common"; -import { DataType, Datum } from "./data"; - -export const protobufPackage = "expr"; - -export interface ExprNode { - exprType: ExprNode_Type; - returnType: DataType | undefined; - rexNode?: { $case: "inputRef"; inputRef: number } | { $case: "constant"; constant: Datum } | { - $case: "funcCall"; - funcCall: FunctionCall; - } | { $case: "udf"; udf: UserDefinedFunction }; -} - -/** - * a "pure function" will be defined as having `1 < expr_node as i32 <= 600`. - * Please modify this definition if adding a pure function that does not belong - * to this range. - */ -export const ExprNode_Type = { - UNSPECIFIED: "UNSPECIFIED", - INPUT_REF: "INPUT_REF", - CONSTANT_VALUE: "CONSTANT_VALUE", - /** ADD - arithmetics operators */ - ADD: "ADD", - SUBTRACT: "SUBTRACT", - MULTIPLY: "MULTIPLY", - DIVIDE: "DIVIDE", - MODULUS: "MODULUS", - /** EQUAL - comparison operators */ - EQUAL: "EQUAL", - NOT_EQUAL: "NOT_EQUAL", - LESS_THAN: "LESS_THAN", - LESS_THAN_OR_EQUAL: "LESS_THAN_OR_EQUAL", - GREATER_THAN: "GREATER_THAN", - GREATER_THAN_OR_EQUAL: "GREATER_THAN_OR_EQUAL", - /** AND - logical operators */ - AND: "AND", - OR: "OR", - NOT: "NOT", - IN: "IN", - SOME: "SOME", - ALL: "ALL", - /** BITWISE_AND - bitwise operators */ - BITWISE_AND: "BITWISE_AND", - BITWISE_OR: "BITWISE_OR", - BITWISE_XOR: "BITWISE_XOR", - BITWISE_NOT: "BITWISE_NOT", - BITWISE_SHIFT_LEFT: "BITWISE_SHIFT_LEFT", - BITWISE_SHIFT_RIGHT: "BITWISE_SHIFT_RIGHT", - /** EXTRACT - date functions */ - EXTRACT: "EXTRACT", - TUMBLE_START: "TUMBLE_START", - /** - * TO_TIMESTAMP - From f64 to timestamp. - * e.g. `select to_timestamp(1672044740.0)` - */ - TO_TIMESTAMP: "TO_TIMESTAMP", - AT_TIME_ZONE: "AT_TIME_ZONE", - DATE_TRUNC: "DATE_TRUNC", - /** - * TO_TIMESTAMP1 - Parse text to timestamp by format string. - * e.g. `select to_timestamp('2022 08 21', 'YYYY MM DD')` - */ - TO_TIMESTAMP1: "TO_TIMESTAMP1", - /** CAST_WITH_TIME_ZONE - Performs a cast with additional timezone information. */ - CAST_WITH_TIME_ZONE: "CAST_WITH_TIME_ZONE", - /** CAST - other functions */ - CAST: "CAST", - SUBSTR: "SUBSTR", - LENGTH: "LENGTH", - LIKE: "LIKE", - UPPER: "UPPER", - LOWER: "LOWER", - TRIM: "TRIM", - REPLACE: "REPLACE", - POSITION: "POSITION", - LTRIM: "LTRIM", - RTRIM: "RTRIM", - CASE: "CASE", - /** ROUND_DIGIT - ROUND(numeric, integer) -> numeric */ - ROUND_DIGIT: "ROUND_DIGIT", - /** - * ROUND - ROUND(numeric) -> numeric - * ROUND(double precision) -> double precision - */ - ROUND: "ROUND", - ASCII: "ASCII", - TRANSLATE: "TRANSLATE", - COALESCE: "COALESCE", - CONCAT_WS: "CONCAT_WS", - ABS: "ABS", - SPLIT_PART: "SPLIT_PART", - CEIL: "CEIL", - FLOOR: "FLOOR", - TO_CHAR: "TO_CHAR", - MD5: "MD5", - CHAR_LENGTH: "CHAR_LENGTH", - REPEAT: "REPEAT", - CONCAT_OP: "CONCAT_OP", - /** BOOL_OUT - BOOL_OUT is different from CAST-bool-to-varchar in PostgreSQL. */ - BOOL_OUT: "BOOL_OUT", - OCTET_LENGTH: "OCTET_LENGTH", - BIT_LENGTH: "BIT_LENGTH", - OVERLAY: "OVERLAY", - REGEXP_MATCH: "REGEXP_MATCH", - POW: "POW", - EXP: "EXP", - /** IS_TRUE - Boolean comparison */ - IS_TRUE: "IS_TRUE", - IS_NOT_TRUE: "IS_NOT_TRUE", - IS_FALSE: "IS_FALSE", - IS_NOT_FALSE: "IS_NOT_FALSE", - IS_NULL: "IS_NULL", - IS_NOT_NULL: "IS_NOT_NULL", - IS_DISTINCT_FROM: "IS_DISTINCT_FROM", - IS_NOT_DISTINCT_FROM: "IS_NOT_DISTINCT_FROM", - /** NEG - Unary operators */ - NEG: "NEG", - /** FIELD - Nested selection operators */ - FIELD: "FIELD", - /** ARRAY - Array expression. */ - ARRAY: "ARRAY", - ARRAY_ACCESS: "ARRAY_ACCESS", - ROW: "ROW", - ARRAY_TO_STRING: "ARRAY_TO_STRING", - /** ARRAY_CAT - Array functions */ - ARRAY_CAT: "ARRAY_CAT", - ARRAY_APPEND: "ARRAY_APPEND", - ARRAY_PREPEND: "ARRAY_PREPEND", - FORMAT_TYPE: "FORMAT_TYPE", - ARRAY_DISTINCT: "ARRAY_DISTINCT", - /** JSONB_ACCESS_INNER - jsonb -> int, jsonb -> text, jsonb #> text[] that returns jsonb */ - JSONB_ACCESS_INNER: "JSONB_ACCESS_INNER", - /** JSONB_ACCESS_STR - jsonb ->> int, jsonb ->> text, jsonb #>> text[] that returns text */ - JSONB_ACCESS_STR: "JSONB_ACCESS_STR", - JSONB_TYPEOF: "JSONB_TYPEOF", - JSONB_ARRAY_LENGTH: "JSONB_ARRAY_LENGTH", - /** PI - Functions that return a constant value */ - PI: "PI", - /** - * VNODE - Non-pure functions below (> 1000) - * ------------------------ - * Internal functions - */ - VNODE: "VNODE", - /** NOW - Non-deterministic functions */ - NOW: "NOW", - /** UDF - User defined functions */ - UDF: "UDF", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type ExprNode_Type = typeof ExprNode_Type[keyof typeof ExprNode_Type]; - -export function exprNode_TypeFromJSON(object: any): ExprNode_Type { - switch (object) { - case 0: - case "UNSPECIFIED": - return ExprNode_Type.UNSPECIFIED; - case 1: - case "INPUT_REF": - return ExprNode_Type.INPUT_REF; - case 2: - case "CONSTANT_VALUE": - return ExprNode_Type.CONSTANT_VALUE; - case 3: - case "ADD": - return ExprNode_Type.ADD; - case 4: - case "SUBTRACT": - return ExprNode_Type.SUBTRACT; - case 5: - case "MULTIPLY": - return ExprNode_Type.MULTIPLY; - case 6: - case "DIVIDE": - return ExprNode_Type.DIVIDE; - case 7: - case "MODULUS": - return ExprNode_Type.MODULUS; - case 8: - case "EQUAL": - return ExprNode_Type.EQUAL; - case 9: - case "NOT_EQUAL": - return ExprNode_Type.NOT_EQUAL; - case 10: - case "LESS_THAN": - return ExprNode_Type.LESS_THAN; - case 11: - case "LESS_THAN_OR_EQUAL": - return ExprNode_Type.LESS_THAN_OR_EQUAL; - case 12: - case "GREATER_THAN": - return ExprNode_Type.GREATER_THAN; - case 13: - case "GREATER_THAN_OR_EQUAL": - return ExprNode_Type.GREATER_THAN_OR_EQUAL; - case 21: - case "AND": - return ExprNode_Type.AND; - case 22: - case "OR": - return ExprNode_Type.OR; - case 23: - case "NOT": - return ExprNode_Type.NOT; - case 24: - case "IN": - return ExprNode_Type.IN; - case 25: - case "SOME": - return ExprNode_Type.SOME; - case 26: - case "ALL": - return ExprNode_Type.ALL; - case 31: - case "BITWISE_AND": - return ExprNode_Type.BITWISE_AND; - case 32: - case "BITWISE_OR": - return ExprNode_Type.BITWISE_OR; - case 33: - case "BITWISE_XOR": - return ExprNode_Type.BITWISE_XOR; - case 34: - case "BITWISE_NOT": - return ExprNode_Type.BITWISE_NOT; - case 35: - case "BITWISE_SHIFT_LEFT": - return ExprNode_Type.BITWISE_SHIFT_LEFT; - case 36: - case "BITWISE_SHIFT_RIGHT": - return ExprNode_Type.BITWISE_SHIFT_RIGHT; - case 101: - case "EXTRACT": - return ExprNode_Type.EXTRACT; - case 103: - case "TUMBLE_START": - return ExprNode_Type.TUMBLE_START; - case 104: - case "TO_TIMESTAMP": - return ExprNode_Type.TO_TIMESTAMP; - case 105: - case "AT_TIME_ZONE": - return ExprNode_Type.AT_TIME_ZONE; - case 106: - case "DATE_TRUNC": - return ExprNode_Type.DATE_TRUNC; - case 107: - case "TO_TIMESTAMP1": - return ExprNode_Type.TO_TIMESTAMP1; - case 108: - case "CAST_WITH_TIME_ZONE": - return ExprNode_Type.CAST_WITH_TIME_ZONE; - case 201: - case "CAST": - return ExprNode_Type.CAST; - case 202: - case "SUBSTR": - return ExprNode_Type.SUBSTR; - case 203: - case "LENGTH": - return ExprNode_Type.LENGTH; - case 204: - case "LIKE": - return ExprNode_Type.LIKE; - case 205: - case "UPPER": - return ExprNode_Type.UPPER; - case 206: - case "LOWER": - return ExprNode_Type.LOWER; - case 207: - case "TRIM": - return ExprNode_Type.TRIM; - case 208: - case "REPLACE": - return ExprNode_Type.REPLACE; - case 209: - case "POSITION": - return ExprNode_Type.POSITION; - case 210: - case "LTRIM": - return ExprNode_Type.LTRIM; - case 211: - case "RTRIM": - return ExprNode_Type.RTRIM; - case 212: - case "CASE": - return ExprNode_Type.CASE; - case 213: - case "ROUND_DIGIT": - return ExprNode_Type.ROUND_DIGIT; - case 214: - case "ROUND": - return ExprNode_Type.ROUND; - case 215: - case "ASCII": - return ExprNode_Type.ASCII; - case 216: - case "TRANSLATE": - return ExprNode_Type.TRANSLATE; - case 217: - case "COALESCE": - return ExprNode_Type.COALESCE; - case 218: - case "CONCAT_WS": - return ExprNode_Type.CONCAT_WS; - case 219: - case "ABS": - return ExprNode_Type.ABS; - case 220: - case "SPLIT_PART": - return ExprNode_Type.SPLIT_PART; - case 221: - case "CEIL": - return ExprNode_Type.CEIL; - case 222: - case "FLOOR": - return ExprNode_Type.FLOOR; - case 223: - case "TO_CHAR": - return ExprNode_Type.TO_CHAR; - case 224: - case "MD5": - return ExprNode_Type.MD5; - case 225: - case "CHAR_LENGTH": - return ExprNode_Type.CHAR_LENGTH; - case 226: - case "REPEAT": - return ExprNode_Type.REPEAT; - case 227: - case "CONCAT_OP": - return ExprNode_Type.CONCAT_OP; - case 228: - case "BOOL_OUT": - return ExprNode_Type.BOOL_OUT; - case 229: - case "OCTET_LENGTH": - return ExprNode_Type.OCTET_LENGTH; - case 230: - case "BIT_LENGTH": - return ExprNode_Type.BIT_LENGTH; - case 231: - case "OVERLAY": - return ExprNode_Type.OVERLAY; - case 232: - case "REGEXP_MATCH": - return ExprNode_Type.REGEXP_MATCH; - case 233: - case "POW": - return ExprNode_Type.POW; - case 234: - case "EXP": - return ExprNode_Type.EXP; - case 301: - case "IS_TRUE": - return ExprNode_Type.IS_TRUE; - case 302: - case "IS_NOT_TRUE": - return ExprNode_Type.IS_NOT_TRUE; - case 303: - case "IS_FALSE": - return ExprNode_Type.IS_FALSE; - case 304: - case "IS_NOT_FALSE": - return ExprNode_Type.IS_NOT_FALSE; - case 305: - case "IS_NULL": - return ExprNode_Type.IS_NULL; - case 306: - case "IS_NOT_NULL": - return ExprNode_Type.IS_NOT_NULL; - case 307: - case "IS_DISTINCT_FROM": - return ExprNode_Type.IS_DISTINCT_FROM; - case 308: - case "IS_NOT_DISTINCT_FROM": - return ExprNode_Type.IS_NOT_DISTINCT_FROM; - case 401: - case "NEG": - return ExprNode_Type.NEG; - case 501: - case "FIELD": - return ExprNode_Type.FIELD; - case 521: - case "ARRAY": - return ExprNode_Type.ARRAY; - case 522: - case "ARRAY_ACCESS": - return ExprNode_Type.ARRAY_ACCESS; - case 523: - case "ROW": - return ExprNode_Type.ROW; - case 524: - case "ARRAY_TO_STRING": - return ExprNode_Type.ARRAY_TO_STRING; - case 531: - case "ARRAY_CAT": - return ExprNode_Type.ARRAY_CAT; - case 532: - case "ARRAY_APPEND": - return ExprNode_Type.ARRAY_APPEND; - case 533: - case "ARRAY_PREPEND": - return ExprNode_Type.ARRAY_PREPEND; - case 534: - case "FORMAT_TYPE": - return ExprNode_Type.FORMAT_TYPE; - case 535: - case "ARRAY_DISTINCT": - return ExprNode_Type.ARRAY_DISTINCT; - case 600: - case "JSONB_ACCESS_INNER": - return ExprNode_Type.JSONB_ACCESS_INNER; - case 601: - case "JSONB_ACCESS_STR": - return ExprNode_Type.JSONB_ACCESS_STR; - case 602: - case "JSONB_TYPEOF": - return ExprNode_Type.JSONB_TYPEOF; - case 603: - case "JSONB_ARRAY_LENGTH": - return ExprNode_Type.JSONB_ARRAY_LENGTH; - case 610: - case "PI": - return ExprNode_Type.PI; - case 1101: - case "VNODE": - return ExprNode_Type.VNODE; - case 2022: - case "NOW": - return ExprNode_Type.NOW; - case 3000: - case "UDF": - return ExprNode_Type.UDF; - case -1: - case "UNRECOGNIZED": - default: - return ExprNode_Type.UNRECOGNIZED; - } -} - -export function exprNode_TypeToJSON(object: ExprNode_Type): string { - switch (object) { - case ExprNode_Type.UNSPECIFIED: - return "UNSPECIFIED"; - case ExprNode_Type.INPUT_REF: - return "INPUT_REF"; - case ExprNode_Type.CONSTANT_VALUE: - return "CONSTANT_VALUE"; - case ExprNode_Type.ADD: - return "ADD"; - case ExprNode_Type.SUBTRACT: - return "SUBTRACT"; - case ExprNode_Type.MULTIPLY: - return "MULTIPLY"; - case ExprNode_Type.DIVIDE: - return "DIVIDE"; - case ExprNode_Type.MODULUS: - return "MODULUS"; - case ExprNode_Type.EQUAL: - return "EQUAL"; - case ExprNode_Type.NOT_EQUAL: - return "NOT_EQUAL"; - case ExprNode_Type.LESS_THAN: - return "LESS_THAN"; - case ExprNode_Type.LESS_THAN_OR_EQUAL: - return "LESS_THAN_OR_EQUAL"; - case ExprNode_Type.GREATER_THAN: - return "GREATER_THAN"; - case ExprNode_Type.GREATER_THAN_OR_EQUAL: - return "GREATER_THAN_OR_EQUAL"; - case ExprNode_Type.AND: - return "AND"; - case ExprNode_Type.OR: - return "OR"; - case ExprNode_Type.NOT: - return "NOT"; - case ExprNode_Type.IN: - return "IN"; - case ExprNode_Type.SOME: - return "SOME"; - case ExprNode_Type.ALL: - return "ALL"; - case ExprNode_Type.BITWISE_AND: - return "BITWISE_AND"; - case ExprNode_Type.BITWISE_OR: - return "BITWISE_OR"; - case ExprNode_Type.BITWISE_XOR: - return "BITWISE_XOR"; - case ExprNode_Type.BITWISE_NOT: - return "BITWISE_NOT"; - case ExprNode_Type.BITWISE_SHIFT_LEFT: - return "BITWISE_SHIFT_LEFT"; - case ExprNode_Type.BITWISE_SHIFT_RIGHT: - return "BITWISE_SHIFT_RIGHT"; - case ExprNode_Type.EXTRACT: - return "EXTRACT"; - case ExprNode_Type.TUMBLE_START: - return "TUMBLE_START"; - case ExprNode_Type.TO_TIMESTAMP: - return "TO_TIMESTAMP"; - case ExprNode_Type.AT_TIME_ZONE: - return "AT_TIME_ZONE"; - case ExprNode_Type.DATE_TRUNC: - return "DATE_TRUNC"; - case ExprNode_Type.TO_TIMESTAMP1: - return "TO_TIMESTAMP1"; - case ExprNode_Type.CAST_WITH_TIME_ZONE: - return "CAST_WITH_TIME_ZONE"; - case ExprNode_Type.CAST: - return "CAST"; - case ExprNode_Type.SUBSTR: - return "SUBSTR"; - case ExprNode_Type.LENGTH: - return "LENGTH"; - case ExprNode_Type.LIKE: - return "LIKE"; - case ExprNode_Type.UPPER: - return "UPPER"; - case ExprNode_Type.LOWER: - return "LOWER"; - case ExprNode_Type.TRIM: - return "TRIM"; - case ExprNode_Type.REPLACE: - return "REPLACE"; - case ExprNode_Type.POSITION: - return "POSITION"; - case ExprNode_Type.LTRIM: - return "LTRIM"; - case ExprNode_Type.RTRIM: - return "RTRIM"; - case ExprNode_Type.CASE: - return "CASE"; - case ExprNode_Type.ROUND_DIGIT: - return "ROUND_DIGIT"; - case ExprNode_Type.ROUND: - return "ROUND"; - case ExprNode_Type.ASCII: - return "ASCII"; - case ExprNode_Type.TRANSLATE: - return "TRANSLATE"; - case ExprNode_Type.COALESCE: - return "COALESCE"; - case ExprNode_Type.CONCAT_WS: - return "CONCAT_WS"; - case ExprNode_Type.ABS: - return "ABS"; - case ExprNode_Type.SPLIT_PART: - return "SPLIT_PART"; - case ExprNode_Type.CEIL: - return "CEIL"; - case ExprNode_Type.FLOOR: - return "FLOOR"; - case ExprNode_Type.TO_CHAR: - return "TO_CHAR"; - case ExprNode_Type.MD5: - return "MD5"; - case ExprNode_Type.CHAR_LENGTH: - return "CHAR_LENGTH"; - case ExprNode_Type.REPEAT: - return "REPEAT"; - case ExprNode_Type.CONCAT_OP: - return "CONCAT_OP"; - case ExprNode_Type.BOOL_OUT: - return "BOOL_OUT"; - case ExprNode_Type.OCTET_LENGTH: - return "OCTET_LENGTH"; - case ExprNode_Type.BIT_LENGTH: - return "BIT_LENGTH"; - case ExprNode_Type.OVERLAY: - return "OVERLAY"; - case ExprNode_Type.REGEXP_MATCH: - return "REGEXP_MATCH"; - case ExprNode_Type.POW: - return "POW"; - case ExprNode_Type.EXP: - return "EXP"; - case ExprNode_Type.IS_TRUE: - return "IS_TRUE"; - case ExprNode_Type.IS_NOT_TRUE: - return "IS_NOT_TRUE"; - case ExprNode_Type.IS_FALSE: - return "IS_FALSE"; - case ExprNode_Type.IS_NOT_FALSE: - return "IS_NOT_FALSE"; - case ExprNode_Type.IS_NULL: - return "IS_NULL"; - case ExprNode_Type.IS_NOT_NULL: - return "IS_NOT_NULL"; - case ExprNode_Type.IS_DISTINCT_FROM: - return "IS_DISTINCT_FROM"; - case ExprNode_Type.IS_NOT_DISTINCT_FROM: - return "IS_NOT_DISTINCT_FROM"; - case ExprNode_Type.NEG: - return "NEG"; - case ExprNode_Type.FIELD: - return "FIELD"; - case ExprNode_Type.ARRAY: - return "ARRAY"; - case ExprNode_Type.ARRAY_ACCESS: - return "ARRAY_ACCESS"; - case ExprNode_Type.ROW: - return "ROW"; - case ExprNode_Type.ARRAY_TO_STRING: - return "ARRAY_TO_STRING"; - case ExprNode_Type.ARRAY_CAT: - return "ARRAY_CAT"; - case ExprNode_Type.ARRAY_APPEND: - return "ARRAY_APPEND"; - case ExprNode_Type.ARRAY_PREPEND: - return "ARRAY_PREPEND"; - case ExprNode_Type.FORMAT_TYPE: - return "FORMAT_TYPE"; - case ExprNode_Type.ARRAY_DISTINCT: - return "ARRAY_DISTINCT"; - case ExprNode_Type.JSONB_ACCESS_INNER: - return "JSONB_ACCESS_INNER"; - case ExprNode_Type.JSONB_ACCESS_STR: - return "JSONB_ACCESS_STR"; - case ExprNode_Type.JSONB_TYPEOF: - return "JSONB_TYPEOF"; - case ExprNode_Type.JSONB_ARRAY_LENGTH: - return "JSONB_ARRAY_LENGTH"; - case ExprNode_Type.PI: - return "PI"; - case ExprNode_Type.VNODE: - return "VNODE"; - case ExprNode_Type.NOW: - return "NOW"; - case ExprNode_Type.UDF: - return "UDF"; - case ExprNode_Type.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export interface TableFunction { - functionType: TableFunction_Type; - args: ExprNode[]; - returnType: - | DataType - | undefined; - /** optional. only used when the type is UDTF. */ - udtf: UserDefinedTableFunction | undefined; -} - -export const TableFunction_Type = { - UNSPECIFIED: "UNSPECIFIED", - GENERATE: "GENERATE", - UNNEST: "UNNEST", - REGEXP_MATCHES: "REGEXP_MATCHES", - RANGE: "RANGE", - /** UDTF - User defined table function */ - UDTF: "UDTF", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type TableFunction_Type = typeof TableFunction_Type[keyof typeof TableFunction_Type]; - -export function tableFunction_TypeFromJSON(object: any): TableFunction_Type { - switch (object) { - case 0: - case "UNSPECIFIED": - return TableFunction_Type.UNSPECIFIED; - case 1: - case "GENERATE": - return TableFunction_Type.GENERATE; - case 2: - case "UNNEST": - return TableFunction_Type.UNNEST; - case 3: - case "REGEXP_MATCHES": - return TableFunction_Type.REGEXP_MATCHES; - case 4: - case "RANGE": - return TableFunction_Type.RANGE; - case 100: - case "UDTF": - return TableFunction_Type.UDTF; - case -1: - case "UNRECOGNIZED": - default: - return TableFunction_Type.UNRECOGNIZED; - } -} - -export function tableFunction_TypeToJSON(object: TableFunction_Type): string { - switch (object) { - case TableFunction_Type.UNSPECIFIED: - return "UNSPECIFIED"; - case TableFunction_Type.GENERATE: - return "GENERATE"; - case TableFunction_Type.UNNEST: - return "UNNEST"; - case TableFunction_Type.REGEXP_MATCHES: - return "REGEXP_MATCHES"; - case TableFunction_Type.RANGE: - return "RANGE"; - case TableFunction_Type.UDTF: - return "UDTF"; - case TableFunction_Type.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -/** Reference to an upstream column, containing its index and data type. */ -export interface InputRef { - index: number; - type: DataType | undefined; -} - -/** - * The items which can occur in the select list of `ProjectSet` operator. - * - * When there are table functions in the SQL query `SELECT ...`, it will be planned as `ProjectSet`. - * Otherwise it will be planned as `Project`. - * - * # Examples - * - * ```sql - * # Project - * select 1; - * - * # ProjectSet - * select unnest(array[1,2,3]); - * - * # ProjectSet (table function & usual expression) - * select unnest(array[1,2,3]), 1; - * - * # ProjectSet (multiple table functions) - * select unnest(array[1,2,3]), unnest(array[4,5]); - * - * # ProjectSet over ProjectSet (table function as parameters of table function) - * select unnest(regexp_matches(v1, 'a(\d)c(\d)', 'g')) from t; - * - * # Project over ProjectSet (table function as parameters of usual function) - * select unnest(regexp_matches(v1, 'a(\d)c(\d)', 'g')) from t; - * ``` - */ -export interface ProjectSetSelectItem { - selectItem?: { $case: "expr"; expr: ExprNode } | { $case: "tableFunction"; tableFunction: TableFunction }; -} - -export interface FunctionCall { - children: ExprNode[]; -} - -/** Aggregate Function Calls for Aggregation */ -export interface AggCall { - type: AggCall_Type; - args: InputRef[]; - returnType: DataType | undefined; - distinct: boolean; - orderBy: ColumnOrder[]; - filter: ExprNode | undefined; -} - -export const AggCall_Type = { - UNSPECIFIED: "UNSPECIFIED", - SUM: "SUM", - MIN: "MIN", - MAX: "MAX", - COUNT: "COUNT", - AVG: "AVG", - STRING_AGG: "STRING_AGG", - APPROX_COUNT_DISTINCT: "APPROX_COUNT_DISTINCT", - ARRAY_AGG: "ARRAY_AGG", - FIRST_VALUE: "FIRST_VALUE", - SUM0: "SUM0", - VAR_POP: "VAR_POP", - VAR_SAMP: "VAR_SAMP", - STDDEV_POP: "STDDEV_POP", - STDDEV_SAMP: "STDDEV_SAMP", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type AggCall_Type = typeof AggCall_Type[keyof typeof AggCall_Type]; - -export function aggCall_TypeFromJSON(object: any): AggCall_Type { - switch (object) { - case 0: - case "UNSPECIFIED": - return AggCall_Type.UNSPECIFIED; - case 1: - case "SUM": - return AggCall_Type.SUM; - case 2: - case "MIN": - return AggCall_Type.MIN; - case 3: - case "MAX": - return AggCall_Type.MAX; - case 4: - case "COUNT": - return AggCall_Type.COUNT; - case 5: - case "AVG": - return AggCall_Type.AVG; - case 6: - case "STRING_AGG": - return AggCall_Type.STRING_AGG; - case 7: - case "APPROX_COUNT_DISTINCT": - return AggCall_Type.APPROX_COUNT_DISTINCT; - case 8: - case "ARRAY_AGG": - return AggCall_Type.ARRAY_AGG; - case 9: - case "FIRST_VALUE": - return AggCall_Type.FIRST_VALUE; - case 10: - case "SUM0": - return AggCall_Type.SUM0; - case 11: - case "VAR_POP": - return AggCall_Type.VAR_POP; - case 12: - case "VAR_SAMP": - return AggCall_Type.VAR_SAMP; - case 13: - case "STDDEV_POP": - return AggCall_Type.STDDEV_POP; - case 14: - case "STDDEV_SAMP": - return AggCall_Type.STDDEV_SAMP; - case -1: - case "UNRECOGNIZED": - default: - return AggCall_Type.UNRECOGNIZED; - } -} - -export function aggCall_TypeToJSON(object: AggCall_Type): string { - switch (object) { - case AggCall_Type.UNSPECIFIED: - return "UNSPECIFIED"; - case AggCall_Type.SUM: - return "SUM"; - case AggCall_Type.MIN: - return "MIN"; - case AggCall_Type.MAX: - return "MAX"; - case AggCall_Type.COUNT: - return "COUNT"; - case AggCall_Type.AVG: - return "AVG"; - case AggCall_Type.STRING_AGG: - return "STRING_AGG"; - case AggCall_Type.APPROX_COUNT_DISTINCT: - return "APPROX_COUNT_DISTINCT"; - case AggCall_Type.ARRAY_AGG: - return "ARRAY_AGG"; - case AggCall_Type.FIRST_VALUE: - return "FIRST_VALUE"; - case AggCall_Type.SUM0: - return "SUM0"; - case AggCall_Type.VAR_POP: - return "VAR_POP"; - case AggCall_Type.VAR_SAMP: - return "VAR_SAMP"; - case AggCall_Type.STDDEV_POP: - return "STDDEV_POP"; - case AggCall_Type.STDDEV_SAMP: - return "STDDEV_SAMP"; - case AggCall_Type.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export interface UserDefinedFunction { - children: ExprNode[]; - name: string; - argTypes: DataType[]; - language: string; - link: string; - identifier: string; -} - -export interface UserDefinedTableFunction { - argTypes: DataType[]; - language: string; - link: string; - identifier: string; -} - -function createBaseExprNode(): ExprNode { - return { exprType: ExprNode_Type.UNSPECIFIED, returnType: undefined, rexNode: undefined }; -} - -export const ExprNode = { - fromJSON(object: any): ExprNode { - return { - exprType: isSet(object.exprType) ? exprNode_TypeFromJSON(object.exprType) : ExprNode_Type.UNSPECIFIED, - returnType: isSet(object.returnType) ? DataType.fromJSON(object.returnType) : undefined, - rexNode: isSet(object.inputRef) - ? { $case: "inputRef", inputRef: Number(object.inputRef) } - : isSet(object.constant) - ? { $case: "constant", constant: Datum.fromJSON(object.constant) } - : isSet(object.funcCall) - ? { $case: "funcCall", funcCall: FunctionCall.fromJSON(object.funcCall) } - : isSet(object.udf) - ? { $case: "udf", udf: UserDefinedFunction.fromJSON(object.udf) } - : undefined, - }; - }, - - toJSON(message: ExprNode): unknown { - const obj: any = {}; - message.exprType !== undefined && (obj.exprType = exprNode_TypeToJSON(message.exprType)); - message.returnType !== undefined && - (obj.returnType = message.returnType ? DataType.toJSON(message.returnType) : undefined); - message.rexNode?.$case === "inputRef" && (obj.inputRef = Math.round(message.rexNode?.inputRef)); - message.rexNode?.$case === "constant" && - (obj.constant = message.rexNode?.constant ? Datum.toJSON(message.rexNode?.constant) : undefined); - message.rexNode?.$case === "funcCall" && - (obj.funcCall = message.rexNode?.funcCall ? FunctionCall.toJSON(message.rexNode?.funcCall) : undefined); - message.rexNode?.$case === "udf" && - (obj.udf = message.rexNode?.udf ? UserDefinedFunction.toJSON(message.rexNode?.udf) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): ExprNode { - const message = createBaseExprNode(); - message.exprType = object.exprType ?? ExprNode_Type.UNSPECIFIED; - message.returnType = (object.returnType !== undefined && object.returnType !== null) - ? DataType.fromPartial(object.returnType) - : undefined; - if ( - object.rexNode?.$case === "inputRef" && - object.rexNode?.inputRef !== undefined && - object.rexNode?.inputRef !== null - ) { - message.rexNode = { $case: "inputRef", inputRef: object.rexNode.inputRef }; - } - if ( - object.rexNode?.$case === "constant" && - object.rexNode?.constant !== undefined && - object.rexNode?.constant !== null - ) { - message.rexNode = { $case: "constant", constant: Datum.fromPartial(object.rexNode.constant) }; - } - if ( - object.rexNode?.$case === "funcCall" && - object.rexNode?.funcCall !== undefined && - object.rexNode?.funcCall !== null - ) { - message.rexNode = { $case: "funcCall", funcCall: FunctionCall.fromPartial(object.rexNode.funcCall) }; - } - if (object.rexNode?.$case === "udf" && object.rexNode?.udf !== undefined && object.rexNode?.udf !== null) { - message.rexNode = { $case: "udf", udf: UserDefinedFunction.fromPartial(object.rexNode.udf) }; - } - return message; - }, -}; - -function createBaseTableFunction(): TableFunction { - return { functionType: TableFunction_Type.UNSPECIFIED, args: [], returnType: undefined, udtf: undefined }; -} - -export const TableFunction = { - fromJSON(object: any): TableFunction { - return { - functionType: isSet(object.functionType) - ? tableFunction_TypeFromJSON(object.functionType) - : TableFunction_Type.UNSPECIFIED, - args: Array.isArray(object?.args) - ? object.args.map((e: any) => ExprNode.fromJSON(e)) - : [], - returnType: isSet(object.returnType) ? DataType.fromJSON(object.returnType) : undefined, - udtf: isSet(object.udtf) ? UserDefinedTableFunction.fromJSON(object.udtf) : undefined, - }; - }, - - toJSON(message: TableFunction): unknown { - const obj: any = {}; - message.functionType !== undefined && (obj.functionType = tableFunction_TypeToJSON(message.functionType)); - if (message.args) { - obj.args = message.args.map((e) => e ? ExprNode.toJSON(e) : undefined); - } else { - obj.args = []; - } - message.returnType !== undefined && - (obj.returnType = message.returnType ? DataType.toJSON(message.returnType) : undefined); - message.udtf !== undefined && (obj.udtf = message.udtf ? UserDefinedTableFunction.toJSON(message.udtf) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): TableFunction { - const message = createBaseTableFunction(); - message.functionType = object.functionType ?? TableFunction_Type.UNSPECIFIED; - message.args = object.args?.map((e) => ExprNode.fromPartial(e)) || []; - message.returnType = (object.returnType !== undefined && object.returnType !== null) - ? DataType.fromPartial(object.returnType) - : undefined; - message.udtf = (object.udtf !== undefined && object.udtf !== null) - ? UserDefinedTableFunction.fromPartial(object.udtf) - : undefined; - return message; - }, -}; - -function createBaseInputRef(): InputRef { - return { index: 0, type: undefined }; -} - -export const InputRef = { - fromJSON(object: any): InputRef { - return { - index: isSet(object.index) ? Number(object.index) : 0, - type: isSet(object.type) ? DataType.fromJSON(object.type) : undefined, - }; - }, - - toJSON(message: InputRef): unknown { - const obj: any = {}; - message.index !== undefined && (obj.index = Math.round(message.index)); - message.type !== undefined && (obj.type = message.type ? DataType.toJSON(message.type) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): InputRef { - const message = createBaseInputRef(); - message.index = object.index ?? 0; - message.type = (object.type !== undefined && object.type !== null) ? DataType.fromPartial(object.type) : undefined; - return message; - }, -}; - -function createBaseProjectSetSelectItem(): ProjectSetSelectItem { - return { selectItem: undefined }; -} - -export const ProjectSetSelectItem = { - fromJSON(object: any): ProjectSetSelectItem { - return { - selectItem: isSet(object.expr) - ? { $case: "expr", expr: ExprNode.fromJSON(object.expr) } - : isSet(object.tableFunction) - ? { $case: "tableFunction", tableFunction: TableFunction.fromJSON(object.tableFunction) } - : undefined, - }; - }, - - toJSON(message: ProjectSetSelectItem): unknown { - const obj: any = {}; - message.selectItem?.$case === "expr" && - (obj.expr = message.selectItem?.expr ? ExprNode.toJSON(message.selectItem?.expr) : undefined); - message.selectItem?.$case === "tableFunction" && (obj.tableFunction = message.selectItem?.tableFunction - ? TableFunction.toJSON(message.selectItem?.tableFunction) - : undefined); - return obj; - }, - - fromPartial, I>>(object: I): ProjectSetSelectItem { - const message = createBaseProjectSetSelectItem(); - if ( - object.selectItem?.$case === "expr" && object.selectItem?.expr !== undefined && object.selectItem?.expr !== null - ) { - message.selectItem = { $case: "expr", expr: ExprNode.fromPartial(object.selectItem.expr) }; - } - if ( - object.selectItem?.$case === "tableFunction" && - object.selectItem?.tableFunction !== undefined && - object.selectItem?.tableFunction !== null - ) { - message.selectItem = { - $case: "tableFunction", - tableFunction: TableFunction.fromPartial(object.selectItem.tableFunction), - }; - } - return message; - }, -}; - -function createBaseFunctionCall(): FunctionCall { - return { children: [] }; -} - -export const FunctionCall = { - fromJSON(object: any): FunctionCall { - return { children: Array.isArray(object?.children) ? object.children.map((e: any) => ExprNode.fromJSON(e)) : [] }; - }, - - toJSON(message: FunctionCall): unknown { - const obj: any = {}; - if (message.children) { - obj.children = message.children.map((e) => e ? ExprNode.toJSON(e) : undefined); - } else { - obj.children = []; - } - return obj; - }, - - fromPartial, I>>(object: I): FunctionCall { - const message = createBaseFunctionCall(); - message.children = object.children?.map((e) => ExprNode.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseAggCall(): AggCall { - return { - type: AggCall_Type.UNSPECIFIED, - args: [], - returnType: undefined, - distinct: false, - orderBy: [], - filter: undefined, - }; -} - -export const AggCall = { - fromJSON(object: any): AggCall { - return { - type: isSet(object.type) ? aggCall_TypeFromJSON(object.type) : AggCall_Type.UNSPECIFIED, - args: Array.isArray(object?.args) ? object.args.map((e: any) => InputRef.fromJSON(e)) : [], - returnType: isSet(object.returnType) ? DataType.fromJSON(object.returnType) : undefined, - distinct: isSet(object.distinct) ? Boolean(object.distinct) : false, - orderBy: Array.isArray(object?.orderBy) ? object.orderBy.map((e: any) => ColumnOrder.fromJSON(e)) : [], - filter: isSet(object.filter) ? ExprNode.fromJSON(object.filter) : undefined, - }; - }, - - toJSON(message: AggCall): unknown { - const obj: any = {}; - message.type !== undefined && (obj.type = aggCall_TypeToJSON(message.type)); - if (message.args) { - obj.args = message.args.map((e) => e ? InputRef.toJSON(e) : undefined); - } else { - obj.args = []; - } - message.returnType !== undefined && - (obj.returnType = message.returnType ? DataType.toJSON(message.returnType) : undefined); - message.distinct !== undefined && (obj.distinct = message.distinct); - if (message.orderBy) { - obj.orderBy = message.orderBy.map((e) => e ? ColumnOrder.toJSON(e) : undefined); - } else { - obj.orderBy = []; - } - message.filter !== undefined && (obj.filter = message.filter ? ExprNode.toJSON(message.filter) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): AggCall { - const message = createBaseAggCall(); - message.type = object.type ?? AggCall_Type.UNSPECIFIED; - message.args = object.args?.map((e) => InputRef.fromPartial(e)) || []; - message.returnType = (object.returnType !== undefined && object.returnType !== null) - ? DataType.fromPartial(object.returnType) - : undefined; - message.distinct = object.distinct ?? false; - message.orderBy = object.orderBy?.map((e) => ColumnOrder.fromPartial(e)) || []; - message.filter = (object.filter !== undefined && object.filter !== null) - ? ExprNode.fromPartial(object.filter) - : undefined; - return message; - }, -}; - -function createBaseUserDefinedFunction(): UserDefinedFunction { - return { children: [], name: "", argTypes: [], language: "", link: "", identifier: "" }; -} - -export const UserDefinedFunction = { - fromJSON(object: any): UserDefinedFunction { - return { - children: Array.isArray(object?.children) ? object.children.map((e: any) => ExprNode.fromJSON(e)) : [], - name: isSet(object.name) ? String(object.name) : "", - argTypes: Array.isArray(object?.argTypes) ? object.argTypes.map((e: any) => DataType.fromJSON(e)) : [], - language: isSet(object.language) ? String(object.language) : "", - link: isSet(object.link) ? String(object.link) : "", - identifier: isSet(object.identifier) ? String(object.identifier) : "", - }; - }, - - toJSON(message: UserDefinedFunction): unknown { - const obj: any = {}; - if (message.children) { - obj.children = message.children.map((e) => e ? ExprNode.toJSON(e) : undefined); - } else { - obj.children = []; - } - message.name !== undefined && (obj.name = message.name); - if (message.argTypes) { - obj.argTypes = message.argTypes.map((e) => e ? DataType.toJSON(e) : undefined); - } else { - obj.argTypes = []; - } - message.language !== undefined && (obj.language = message.language); - message.link !== undefined && (obj.link = message.link); - message.identifier !== undefined && (obj.identifier = message.identifier); - return obj; - }, - - fromPartial, I>>(object: I): UserDefinedFunction { - const message = createBaseUserDefinedFunction(); - message.children = object.children?.map((e) => ExprNode.fromPartial(e)) || []; - message.name = object.name ?? ""; - message.argTypes = object.argTypes?.map((e) => DataType.fromPartial(e)) || []; - message.language = object.language ?? ""; - message.link = object.link ?? ""; - message.identifier = object.identifier ?? ""; - return message; - }, -}; - -function createBaseUserDefinedTableFunction(): UserDefinedTableFunction { - return { argTypes: [], language: "", link: "", identifier: "" }; -} - -export const UserDefinedTableFunction = { - fromJSON(object: any): UserDefinedTableFunction { - return { - argTypes: Array.isArray(object?.argTypes) ? object.argTypes.map((e: any) => DataType.fromJSON(e)) : [], - language: isSet(object.language) ? String(object.language) : "", - link: isSet(object.link) ? String(object.link) : "", - identifier: isSet(object.identifier) ? String(object.identifier) : "", - }; - }, - - toJSON(message: UserDefinedTableFunction): unknown { - const obj: any = {}; - if (message.argTypes) { - obj.argTypes = message.argTypes.map((e) => e ? DataType.toJSON(e) : undefined); - } else { - obj.argTypes = []; - } - message.language !== undefined && (obj.language = message.language); - message.link !== undefined && (obj.link = message.link); - message.identifier !== undefined && (obj.identifier = message.identifier); - return obj; - }, - - fromPartial, I>>(object: I): UserDefinedTableFunction { - const message = createBaseUserDefinedTableFunction(); - message.argTypes = object.argTypes?.map((e) => DataType.fromPartial(e)) || []; - message.language = object.language ?? ""; - message.link = object.link ?? ""; - message.identifier = object.identifier ?? ""; - return message; - }, -}; - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> - : T extends { $case: string } ? { [K in keyof Omit]?: DeepPartial } & { $case: T["$case"] } - : T extends {} ? { [K in keyof T]?: DeepPartial } - : Partial; - -type KeysOfUnion = T extends T ? keyof T : never; -export type Exact = P extends Builtin ? P - : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; - -function isSet(value: any): boolean { - return value !== null && value !== undefined; -} diff --git a/dashboard/proto/gen/health.ts b/dashboard/proto/gen/health.ts deleted file mode 100644 index c77e2b8bebe9..000000000000 --- a/dashboard/proto/gen/health.ts +++ /dev/null @@ -1,117 +0,0 @@ -/* eslint-disable */ - -export const protobufPackage = "health"; - -export interface HealthCheckRequest { - service: string; -} - -export interface HealthCheckResponse { - status: HealthCheckResponse_ServingStatus; -} - -export const HealthCheckResponse_ServingStatus = { - UNKNOWN: "UNKNOWN", - SERVING: "SERVING", - NOT_SERVING: "NOT_SERVING", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type HealthCheckResponse_ServingStatus = - typeof HealthCheckResponse_ServingStatus[keyof typeof HealthCheckResponse_ServingStatus]; - -export function healthCheckResponse_ServingStatusFromJSON(object: any): HealthCheckResponse_ServingStatus { - switch (object) { - case 0: - case "UNKNOWN": - return HealthCheckResponse_ServingStatus.UNKNOWN; - case 1: - case "SERVING": - return HealthCheckResponse_ServingStatus.SERVING; - case 2: - case "NOT_SERVING": - return HealthCheckResponse_ServingStatus.NOT_SERVING; - case -1: - case "UNRECOGNIZED": - default: - return HealthCheckResponse_ServingStatus.UNRECOGNIZED; - } -} - -export function healthCheckResponse_ServingStatusToJSON(object: HealthCheckResponse_ServingStatus): string { - switch (object) { - case HealthCheckResponse_ServingStatus.UNKNOWN: - return "UNKNOWN"; - case HealthCheckResponse_ServingStatus.SERVING: - return "SERVING"; - case HealthCheckResponse_ServingStatus.NOT_SERVING: - return "NOT_SERVING"; - case HealthCheckResponse_ServingStatus.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -function createBaseHealthCheckRequest(): HealthCheckRequest { - return { service: "" }; -} - -export const HealthCheckRequest = { - fromJSON(object: any): HealthCheckRequest { - return { service: isSet(object.service) ? String(object.service) : "" }; - }, - - toJSON(message: HealthCheckRequest): unknown { - const obj: any = {}; - message.service !== undefined && (obj.service = message.service); - return obj; - }, - - fromPartial, I>>(object: I): HealthCheckRequest { - const message = createBaseHealthCheckRequest(); - message.service = object.service ?? ""; - return message; - }, -}; - -function createBaseHealthCheckResponse(): HealthCheckResponse { - return { status: HealthCheckResponse_ServingStatus.UNKNOWN }; -} - -export const HealthCheckResponse = { - fromJSON(object: any): HealthCheckResponse { - return { - status: isSet(object.status) - ? healthCheckResponse_ServingStatusFromJSON(object.status) - : HealthCheckResponse_ServingStatus.UNKNOWN, - }; - }, - - toJSON(message: HealthCheckResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = healthCheckResponse_ServingStatusToJSON(message.status)); - return obj; - }, - - fromPartial, I>>(object: I): HealthCheckResponse { - const message = createBaseHealthCheckResponse(); - message.status = object.status ?? HealthCheckResponse_ServingStatus.UNKNOWN; - return message; - }, -}; - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> - : T extends { $case: string } ? { [K in keyof Omit]?: DeepPartial } & { $case: T["$case"] } - : T extends {} ? { [K in keyof T]?: DeepPartial } - : Partial; - -type KeysOfUnion = T extends T ? keyof T : never; -export type Exact = P extends Builtin ? P - : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; - -function isSet(value: any): boolean { - return value !== null && value !== undefined; -} diff --git a/dashboard/proto/gen/hummock.ts b/dashboard/proto/gen/hummock.ts deleted file mode 100644 index 6a0c817576b3..000000000000 --- a/dashboard/proto/gen/hummock.ts +++ /dev/null @@ -1,4824 +0,0 @@ -/* eslint-disable */ -import { Table } from "./catalog"; -import { Status, WorkerNode } from "./common"; -import { CompactorRuntimeConfig } from "./compactor"; - -export const protobufPackage = "hummock"; - -export const LevelType = { - UNSPECIFIED: "UNSPECIFIED", - NONOVERLAPPING: "NONOVERLAPPING", - OVERLAPPING: "OVERLAPPING", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type LevelType = typeof LevelType[keyof typeof LevelType]; - -export function levelTypeFromJSON(object: any): LevelType { - switch (object) { - case 0: - case "UNSPECIFIED": - return LevelType.UNSPECIFIED; - case 1: - case "NONOVERLAPPING": - return LevelType.NONOVERLAPPING; - case 2: - case "OVERLAPPING": - return LevelType.OVERLAPPING; - case -1: - case "UNRECOGNIZED": - default: - return LevelType.UNRECOGNIZED; - } -} - -export function levelTypeToJSON(object: LevelType): string { - switch (object) { - case LevelType.UNSPECIFIED: - return "UNSPECIFIED"; - case LevelType.NONOVERLAPPING: - return "NONOVERLAPPING"; - case LevelType.OVERLAPPING: - return "OVERLAPPING"; - case LevelType.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export interface SstableInfo { - objectId: number; - sstId: number; - keyRange: KeyRange | undefined; - fileSize: number; - tableIds: number[]; - metaOffset: number; - staleKeyCount: number; - totalKeyCount: number; - minEpoch: number; - maxEpoch: number; - uncompressedFileSize: number; -} - -export interface OverlappingLevel { - subLevels: Level[]; - totalFileSize: number; - uncompressedFileSize: number; -} - -export interface Level { - levelIdx: number; - levelType: LevelType; - tableInfos: SstableInfo[]; - totalFileSize: number; - subLevelId: number; - uncompressedFileSize: number; -} - -export interface InputLevel { - levelIdx: number; - levelType: LevelType; - tableInfos: SstableInfo[]; -} - -export interface IntraLevelDelta { - levelIdx: number; - l0SubLevelId: number; - removedTableIds: number[]; - insertedTableInfos: SstableInfo[]; -} - -export interface GroupConstruct { - groupConfig: - | CompactionConfig - | undefined; - /** If `parent_group_id` is not 0, it means `parent_group_id` splits into `parent_group_id` and this group, so this group is not empty initially. */ - parentGroupId: number; - tableIds: number[]; - groupId: number; - newSstStartId: number; -} - -export interface GroupMetaChange { - tableIdsAdd: number[]; - tableIdsRemove: number[]; -} - -export interface GroupDestroy { -} - -export interface GroupDelta { - deltaType?: - | { $case: "intraLevel"; intraLevel: IntraLevelDelta } - | { $case: "groupConstruct"; groupConstruct: GroupConstruct } - | { $case: "groupDestroy"; groupDestroy: GroupDestroy } - | { $case: "groupMetaChange"; groupMetaChange: GroupMetaChange }; -} - -export interface UncommittedEpoch { - epoch: number; - tables: SstableInfo[]; -} - -export interface HummockVersion { - id: number; - /** Levels of each compaction group */ - levels: { [key: number]: HummockVersion_Levels }; - maxCommittedEpoch: number; - /** - * Snapshots with epoch less than the safe epoch have been GCed. - * Reads against such an epoch will fail. - */ - safeEpoch: number; -} - -export interface HummockVersion_Levels { - levels: Level[]; - l0: OverlappingLevel | undefined; - groupId: number; - parentGroupId: number; - memberTableIds: number[]; -} - -export interface HummockVersion_LevelsEntry { - key: number; - value: HummockVersion_Levels | undefined; -} - -export interface HummockVersionDelta { - id: number; - prevId: number; - /** Levels of each compaction group */ - groupDeltas: { [key: number]: HummockVersionDelta_GroupDeltas }; - maxCommittedEpoch: number; - /** - * Snapshots with epoch less than the safe epoch have been GCed. - * Reads against such an epoch will fail. - */ - safeEpoch: number; - trivialMove: boolean; - gcObjectIds: number[]; -} - -export interface HummockVersionDelta_GroupDeltas { - groupDeltas: GroupDelta[]; -} - -export interface HummockVersionDelta_GroupDeltasEntry { - key: number; - value: HummockVersionDelta_GroupDeltas | undefined; -} - -export interface HummockVersionDeltas { - versionDeltas: HummockVersionDelta[]; -} - -/** We will have two epoch after decouple */ -export interface HummockSnapshot { - /** Epoch with checkpoint, we will read durable data with it. */ - committedEpoch: number; - /** Epoch without checkpoint, we will read real-time data with it. But it may be rolled back. */ - currentEpoch: number; -} - -export interface VersionUpdatePayload { - payload?: { $case: "versionDeltas"; versionDeltas: HummockVersionDeltas } | { - $case: "pinnedVersion"; - pinnedVersion: HummockVersion; - }; -} - -export interface UnpinVersionBeforeRequest { - contextId: number; - unpinVersionBefore: number; -} - -export interface UnpinVersionBeforeResponse { - status: Status | undefined; -} - -export interface GetCurrentVersionRequest { -} - -export interface GetCurrentVersionResponse { - status: Status | undefined; - currentVersion: HummockVersion | undefined; -} - -export interface UnpinVersionRequest { - contextId: number; -} - -export interface UnpinVersionResponse { - status: Status | undefined; -} - -export interface PinSnapshotRequest { - contextId: number; -} - -export interface PinSpecificSnapshotRequest { - contextId: number; - epoch: number; -} - -export interface GetAssignedCompactTaskNumRequest { -} - -export interface GetAssignedCompactTaskNumResponse { - numTasks: number; -} - -export interface PinSnapshotResponse { - status: Status | undefined; - snapshot: HummockSnapshot | undefined; -} - -export interface GetEpochRequest { -} - -export interface GetEpochResponse { - status: Status | undefined; - snapshot: HummockSnapshot | undefined; -} - -export interface UnpinSnapshotRequest { - contextId: number; -} - -export interface UnpinSnapshotResponse { - status: Status | undefined; -} - -export interface UnpinSnapshotBeforeRequest { - contextId: number; - minSnapshot: HummockSnapshot | undefined; -} - -export interface UnpinSnapshotBeforeResponse { - status: Status | undefined; -} - -/** - * When `right_exclusive=false`, it represents [left, right], of which both boundary are open. When `right_exclusive=true`, - * it represents [left, right), of which right is exclusive. - */ -export interface KeyRange { - left: Uint8Array; - right: Uint8Array; - rightExclusive: boolean; -} - -export interface TableOption { - retentionSeconds: number; -} - -export interface CompactTask { - /** SSTs to be compacted, which will be removed from LSM after compaction */ - inputSsts: InputLevel[]; - /** - * In ideal case, the compaction will generate `splits.len()` tables which have key range - * corresponding to that in [`splits`], respectively - */ - splits: KeyRange[]; - /** low watermark in 'ts-aware compaction' */ - watermark: number; - /** compaction output, which will be added to [`target_level`] of LSM after compaction */ - sortedOutputSsts: SstableInfo[]; - /** task id assigned by hummock storage service */ - taskId: number; - /** compaction output will be added to [`target_level`] of LSM after compaction */ - targetLevel: number; - gcDeleteKeys: boolean; - taskStatus: CompactTask_TaskStatus; - /** compaction group the task belongs to */ - compactionGroupId: number; - /** existing_table_ids for compaction drop key */ - existingTableIds: number[]; - compressionAlgorithm: number; - targetFileSize: number; - compactionFilterMask: number; - tableOptions: { [key: number]: TableOption }; - currentEpochTime: number; - targetSubLevelId: number; - /** Identifies whether the task is space_reclaim, if the compact_task_type increases, it will be refactored to enum */ - taskType: CompactTask_TaskType; - splitByStateTable: boolean; -} - -export const CompactTask_TaskStatus = { - UNSPECIFIED: "UNSPECIFIED", - PENDING: "PENDING", - SUCCESS: "SUCCESS", - HEARTBEAT_CANCELED: "HEARTBEAT_CANCELED", - NO_AVAIL_CANCELED: "NO_AVAIL_CANCELED", - ASSIGN_FAIL_CANCELED: "ASSIGN_FAIL_CANCELED", - SEND_FAIL_CANCELED: "SEND_FAIL_CANCELED", - MANUAL_CANCELED: "MANUAL_CANCELED", - INVALID_GROUP_CANCELED: "INVALID_GROUP_CANCELED", - EXECUTE_FAILED: "EXECUTE_FAILED", - JOIN_HANDLE_FAILED: "JOIN_HANDLE_FAILED", - TRACK_SST_OBJECT_ID_FAILED: "TRACK_SST_OBJECT_ID_FAILED", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type CompactTask_TaskStatus = typeof CompactTask_TaskStatus[keyof typeof CompactTask_TaskStatus]; - -export function compactTask_TaskStatusFromJSON(object: any): CompactTask_TaskStatus { - switch (object) { - case 0: - case "UNSPECIFIED": - return CompactTask_TaskStatus.UNSPECIFIED; - case 1: - case "PENDING": - return CompactTask_TaskStatus.PENDING; - case 2: - case "SUCCESS": - return CompactTask_TaskStatus.SUCCESS; - case 3: - case "HEARTBEAT_CANCELED": - return CompactTask_TaskStatus.HEARTBEAT_CANCELED; - case 4: - case "NO_AVAIL_CANCELED": - return CompactTask_TaskStatus.NO_AVAIL_CANCELED; - case 5: - case "ASSIGN_FAIL_CANCELED": - return CompactTask_TaskStatus.ASSIGN_FAIL_CANCELED; - case 6: - case "SEND_FAIL_CANCELED": - return CompactTask_TaskStatus.SEND_FAIL_CANCELED; - case 7: - case "MANUAL_CANCELED": - return CompactTask_TaskStatus.MANUAL_CANCELED; - case 8: - case "INVALID_GROUP_CANCELED": - return CompactTask_TaskStatus.INVALID_GROUP_CANCELED; - case 9: - case "EXECUTE_FAILED": - return CompactTask_TaskStatus.EXECUTE_FAILED; - case 10: - case "JOIN_HANDLE_FAILED": - return CompactTask_TaskStatus.JOIN_HANDLE_FAILED; - case 11: - case "TRACK_SST_OBJECT_ID_FAILED": - return CompactTask_TaskStatus.TRACK_SST_OBJECT_ID_FAILED; - case -1: - case "UNRECOGNIZED": - default: - return CompactTask_TaskStatus.UNRECOGNIZED; - } -} - -export function compactTask_TaskStatusToJSON(object: CompactTask_TaskStatus): string { - switch (object) { - case CompactTask_TaskStatus.UNSPECIFIED: - return "UNSPECIFIED"; - case CompactTask_TaskStatus.PENDING: - return "PENDING"; - case CompactTask_TaskStatus.SUCCESS: - return "SUCCESS"; - case CompactTask_TaskStatus.HEARTBEAT_CANCELED: - return "HEARTBEAT_CANCELED"; - case CompactTask_TaskStatus.NO_AVAIL_CANCELED: - return "NO_AVAIL_CANCELED"; - case CompactTask_TaskStatus.ASSIGN_FAIL_CANCELED: - return "ASSIGN_FAIL_CANCELED"; - case CompactTask_TaskStatus.SEND_FAIL_CANCELED: - return "SEND_FAIL_CANCELED"; - case CompactTask_TaskStatus.MANUAL_CANCELED: - return "MANUAL_CANCELED"; - case CompactTask_TaskStatus.INVALID_GROUP_CANCELED: - return "INVALID_GROUP_CANCELED"; - case CompactTask_TaskStatus.EXECUTE_FAILED: - return "EXECUTE_FAILED"; - case CompactTask_TaskStatus.JOIN_HANDLE_FAILED: - return "JOIN_HANDLE_FAILED"; - case CompactTask_TaskStatus.TRACK_SST_OBJECT_ID_FAILED: - return "TRACK_SST_OBJECT_ID_FAILED"; - case CompactTask_TaskStatus.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export const CompactTask_TaskType = { - TYPE_UNSPECIFIED: "TYPE_UNSPECIFIED", - DYNAMIC: "DYNAMIC", - SPACE_RECLAIM: "SPACE_RECLAIM", - MANUAL: "MANUAL", - SHARED_BUFFER: "SHARED_BUFFER", - TTL: "TTL", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type CompactTask_TaskType = typeof CompactTask_TaskType[keyof typeof CompactTask_TaskType]; - -export function compactTask_TaskTypeFromJSON(object: any): CompactTask_TaskType { - switch (object) { - case 0: - case "TYPE_UNSPECIFIED": - return CompactTask_TaskType.TYPE_UNSPECIFIED; - case 1: - case "DYNAMIC": - return CompactTask_TaskType.DYNAMIC; - case 2: - case "SPACE_RECLAIM": - return CompactTask_TaskType.SPACE_RECLAIM; - case 3: - case "MANUAL": - return CompactTask_TaskType.MANUAL; - case 4: - case "SHARED_BUFFER": - return CompactTask_TaskType.SHARED_BUFFER; - case 5: - case "TTL": - return CompactTask_TaskType.TTL; - case -1: - case "UNRECOGNIZED": - default: - return CompactTask_TaskType.UNRECOGNIZED; - } -} - -export function compactTask_TaskTypeToJSON(object: CompactTask_TaskType): string { - switch (object) { - case CompactTask_TaskType.TYPE_UNSPECIFIED: - return "TYPE_UNSPECIFIED"; - case CompactTask_TaskType.DYNAMIC: - return "DYNAMIC"; - case CompactTask_TaskType.SPACE_RECLAIM: - return "SPACE_RECLAIM"; - case CompactTask_TaskType.MANUAL: - return "MANUAL"; - case CompactTask_TaskType.SHARED_BUFFER: - return "SHARED_BUFFER"; - case CompactTask_TaskType.TTL: - return "TTL"; - case CompactTask_TaskType.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export interface CompactTask_TableOptionsEntry { - key: number; - value: TableOption | undefined; -} - -export interface LevelHandler { - level: number; - tasks: LevelHandler_RunningCompactTask[]; -} - -export interface LevelHandler_RunningCompactTask { - taskId: number; - ssts: number[]; - totalFileSize: number; - targetLevel: number; -} - -export interface CompactStatus { - compactionGroupId: number; - levelHandlers: LevelHandler[]; -} - -/** Config info of compaction group. */ -export interface CompactionGroup { - id: number; - compactionConfig: CompactionConfig | undefined; -} - -/** - * Complete info of compaction group. - * The info is the aggregate of `HummockVersion` and `CompactionGroupConfig` - */ -export interface CompactionGroupInfo { - id: number; - parentId: number; - memberTableIds: number[]; - compactionConfig: CompactionConfig | undefined; -} - -export interface CompactTaskAssignment { - compactTask: CompactTask | undefined; - contextId: number; -} - -export interface GetCompactionTasksRequest { -} - -export interface GetCompactionTasksResponse { - status: Status | undefined; - compactTask: CompactTask | undefined; -} - -export interface ReportCompactionTasksRequest { - contextId: number; - compactTask: CompactTask | undefined; - tableStatsChange: { [key: number]: TableStats }; -} - -export interface ReportCompactionTasksRequest_TableStatsChangeEntry { - key: number; - value: TableStats | undefined; -} - -export interface ReportCompactionTasksResponse { - status: Status | undefined; -} - -export interface HummockPinnedVersion { - contextId: number; - minPinnedId: number; -} - -export interface HummockPinnedSnapshot { - contextId: number; - minimalPinnedSnapshot: number; -} - -export interface GetNewSstIdsRequest { - number: number; -} - -export interface GetNewSstIdsResponse { - status: - | Status - | undefined; - /** inclusive */ - startId: number; - /** exclusive */ - endId: number; -} - -/** - * This is a heartbeat message. Task will be considered dead if - * `CompactTaskProgress` is not received for a timeout - * or `num_ssts_sealed`/`num_ssts_uploaded` do not increase for a timeout. - */ -export interface CompactTaskProgress { - taskId: number; - numSstsSealed: number; - numSstsUploaded: number; -} - -/** The measurement of the workload on a compactor to determine whether it is idle. */ -export interface CompactorWorkload { - cpu: number; -} - -export interface CompactorHeartbeatRequest { - contextId: number; - progress: CompactTaskProgress[]; - workload: CompactorWorkload | undefined; -} - -export interface CompactorHeartbeatResponse { - status: Status | undefined; -} - -export interface SubscribeCompactTasksRequest { - contextId: number; - maxConcurrentTaskNumber: number; - cpuCoreNum: number; -} - -export interface ValidationTask { - sstInfos: SstableInfo[]; - sstIdToWorkerId: { [key: number]: number }; - epoch: number; -} - -export interface ValidationTask_SstIdToWorkerIdEntry { - key: number; - value: number; -} - -export interface SubscribeCompactTasksResponse { - task?: - | { $case: "compactTask"; compactTask: CompactTask } - | { $case: "vacuumTask"; vacuumTask: VacuumTask } - | { $case: "fullScanTask"; fullScanTask: FullScanTask } - | { $case: "validationTask"; validationTask: ValidationTask } - | { $case: "cancelCompactTask"; cancelCompactTask: CancelCompactTask }; -} - -/** Delete SSTs in object store */ -export interface VacuumTask { - sstableObjectIds: number[]; -} - -/** Scan object store to get candidate orphan SSTs. */ -export interface FullScanTask { - sstRetentionTimeSec: number; -} - -/** Cancel compact task */ -export interface CancelCompactTask { - contextId: number; - taskId: number; -} - -export interface ReportVacuumTaskRequest { - vacuumTask: VacuumTask | undefined; -} - -export interface ReportVacuumTaskResponse { - status: Status | undefined; -} - -export interface TriggerManualCompactionRequest { - compactionGroupId: number; - keyRange: KeyRange | undefined; - tableId: number; - level: number; - sstIds: number[]; -} - -export interface TriggerManualCompactionResponse { - status: Status | undefined; -} - -export interface ReportFullScanTaskRequest { - objectIds: number[]; -} - -export interface ReportFullScanTaskResponse { - status: Status | undefined; -} - -export interface TriggerFullGCRequest { - sstRetentionTimeSec: number; -} - -export interface TriggerFullGCResponse { - status: Status | undefined; -} - -export interface ListVersionDeltasRequest { - startId: number; - numLimit: number; - committedEpochLimit: number; -} - -export interface ListVersionDeltasResponse { - versionDeltas: HummockVersionDeltas | undefined; -} - -export interface PinnedVersionsSummary { - pinnedVersions: HummockPinnedVersion[]; - workers: { [key: number]: WorkerNode }; -} - -export interface PinnedVersionsSummary_WorkersEntry { - key: number; - value: WorkerNode | undefined; -} - -export interface PinnedSnapshotsSummary { - pinnedSnapshots: HummockPinnedSnapshot[]; - workers: { [key: number]: WorkerNode }; -} - -export interface PinnedSnapshotsSummary_WorkersEntry { - key: number; - value: WorkerNode | undefined; -} - -export interface RiseCtlGetPinnedVersionsSummaryRequest { -} - -export interface RiseCtlGetPinnedVersionsSummaryResponse { - summary: PinnedVersionsSummary | undefined; -} - -export interface RiseCtlGetPinnedSnapshotsSummaryRequest { -} - -export interface RiseCtlGetPinnedSnapshotsSummaryResponse { - summary: PinnedSnapshotsSummary | undefined; -} - -export interface InitMetadataForReplayRequest { - tables: Table[]; - compactionGroups: CompactionGroupInfo[]; -} - -export interface InitMetadataForReplayResponse { -} - -export interface ReplayVersionDeltaRequest { - versionDelta: HummockVersionDelta | undefined; -} - -export interface ReplayVersionDeltaResponse { - version: HummockVersion | undefined; - modifiedCompactionGroups: number[]; -} - -export interface TriggerCompactionDeterministicRequest { - versionId: number; - compactionGroups: number[]; -} - -export interface TriggerCompactionDeterministicResponse { -} - -export interface DisableCommitEpochRequest { -} - -export interface DisableCommitEpochResponse { - currentVersion: HummockVersion | undefined; -} - -export interface RiseCtlListCompactionGroupRequest { -} - -export interface RiseCtlListCompactionGroupResponse { - status: Status | undefined; - compactionGroups: CompactionGroupInfo[]; -} - -export interface RiseCtlUpdateCompactionConfigRequest { - compactionGroupIds: number[]; - configs: RiseCtlUpdateCompactionConfigRequest_MutableConfig[]; -} - -export interface RiseCtlUpdateCompactionConfigRequest_MutableConfig { - mutableConfig?: - | { $case: "maxBytesForLevelBase"; maxBytesForLevelBase: number } - | { $case: "maxBytesForLevelMultiplier"; maxBytesForLevelMultiplier: number } - | { $case: "maxCompactionBytes"; maxCompactionBytes: number } - | { $case: "subLevelMaxCompactionBytes"; subLevelMaxCompactionBytes: number } - | { $case: "level0TierCompactFileNumber"; level0TierCompactFileNumber: number } - | { $case: "targetFileSizeBase"; targetFileSizeBase: number } - | { $case: "compactionFilterMask"; compactionFilterMask: number } - | { $case: "maxSubCompaction"; maxSubCompaction: number } - | { $case: "level0StopWriteThresholdSubLevelNumber"; level0StopWriteThresholdSubLevelNumber: number }; -} - -export interface RiseCtlUpdateCompactionConfigResponse { - status: Status | undefined; -} - -export interface SetCompactorRuntimeConfigRequest { - contextId: number; - config: CompactorRuntimeConfig | undefined; -} - -export interface SetCompactorRuntimeConfigResponse { -} - -export interface PinVersionRequest { - contextId: number; -} - -export interface PinVersionResponse { - pinnedVersion: HummockVersion | undefined; -} - -export interface SplitCompactionGroupRequest { - groupId: number; - tableIds: number[]; -} - -export interface SplitCompactionGroupResponse { - newGroupId: number; -} - -export interface CompactionConfig { - maxBytesForLevelBase: number; - maxLevel: number; - maxBytesForLevelMultiplier: number; - maxCompactionBytes: number; - subLevelMaxCompactionBytes: number; - level0TierCompactFileNumber: number; - compactionMode: CompactionConfig_CompactionMode; - compressionAlgorithm: string[]; - targetFileSizeBase: number; - compactionFilterMask: number; - maxSubCompaction: number; - maxSpaceReclaimBytes: number; - splitByStateTable: boolean; - /** soft limit for max number of sub level number */ - level0StopWriteThresholdSubLevelNumber: number; - level0MaxCompactFileNumber: number; -} - -export const CompactionConfig_CompactionMode = { - UNSPECIFIED: "UNSPECIFIED", - RANGE: "RANGE", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type CompactionConfig_CompactionMode = - typeof CompactionConfig_CompactionMode[keyof typeof CompactionConfig_CompactionMode]; - -export function compactionConfig_CompactionModeFromJSON(object: any): CompactionConfig_CompactionMode { - switch (object) { - case 0: - case "UNSPECIFIED": - return CompactionConfig_CompactionMode.UNSPECIFIED; - case 1: - case "RANGE": - return CompactionConfig_CompactionMode.RANGE; - case -1: - case "UNRECOGNIZED": - default: - return CompactionConfig_CompactionMode.UNRECOGNIZED; - } -} - -export function compactionConfig_CompactionModeToJSON(object: CompactionConfig_CompactionMode): string { - switch (object) { - case CompactionConfig_CompactionMode.UNSPECIFIED: - return "UNSPECIFIED"; - case CompactionConfig_CompactionMode.RANGE: - return "RANGE"; - case CompactionConfig_CompactionMode.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export interface TableStats { - totalKeySize: number; - totalValueSize: number; - totalKeyCount: number; -} - -export interface HummockVersionStats { - hummockVersionId: number; - tableStats: { [key: number]: TableStats }; -} - -export interface HummockVersionStats_TableStatsEntry { - key: number; - value: TableStats | undefined; -} - -export interface GetScaleCompactorRequest { -} - -export interface GetScaleCompactorResponse { - suggestCores: number; - runningCores: number; - totalCores: number; - waitingCompactionBytes: number; -} - -export interface WriteLimits { - /** < compaction group id, write limit info > */ - writeLimits: { [key: number]: WriteLimits_WriteLimit }; -} - -export interface WriteLimits_WriteLimit { - tableIds: number[]; - reason: string; -} - -export interface WriteLimits_WriteLimitsEntry { - key: number; - value: WriteLimits_WriteLimit | undefined; -} - -function createBaseSstableInfo(): SstableInfo { - return { - objectId: 0, - sstId: 0, - keyRange: undefined, - fileSize: 0, - tableIds: [], - metaOffset: 0, - staleKeyCount: 0, - totalKeyCount: 0, - minEpoch: 0, - maxEpoch: 0, - uncompressedFileSize: 0, - }; -} - -export const SstableInfo = { - fromJSON(object: any): SstableInfo { - return { - objectId: isSet(object.objectId) ? Number(object.objectId) : 0, - sstId: isSet(object.sstId) ? Number(object.sstId) : 0, - keyRange: isSet(object.keyRange) ? KeyRange.fromJSON(object.keyRange) : undefined, - fileSize: isSet(object.fileSize) ? Number(object.fileSize) : 0, - tableIds: Array.isArray(object?.tableIds) ? object.tableIds.map((e: any) => Number(e)) : [], - metaOffset: isSet(object.metaOffset) ? Number(object.metaOffset) : 0, - staleKeyCount: isSet(object.staleKeyCount) ? Number(object.staleKeyCount) : 0, - totalKeyCount: isSet(object.totalKeyCount) ? Number(object.totalKeyCount) : 0, - minEpoch: isSet(object.minEpoch) ? Number(object.minEpoch) : 0, - maxEpoch: isSet(object.maxEpoch) ? Number(object.maxEpoch) : 0, - uncompressedFileSize: isSet(object.uncompressedFileSize) ? Number(object.uncompressedFileSize) : 0, - }; - }, - - toJSON(message: SstableInfo): unknown { - const obj: any = {}; - message.objectId !== undefined && (obj.objectId = Math.round(message.objectId)); - message.sstId !== undefined && (obj.sstId = Math.round(message.sstId)); - message.keyRange !== undefined && (obj.keyRange = message.keyRange ? KeyRange.toJSON(message.keyRange) : undefined); - message.fileSize !== undefined && (obj.fileSize = Math.round(message.fileSize)); - if (message.tableIds) { - obj.tableIds = message.tableIds.map((e) => Math.round(e)); - } else { - obj.tableIds = []; - } - message.metaOffset !== undefined && (obj.metaOffset = Math.round(message.metaOffset)); - message.staleKeyCount !== undefined && (obj.staleKeyCount = Math.round(message.staleKeyCount)); - message.totalKeyCount !== undefined && (obj.totalKeyCount = Math.round(message.totalKeyCount)); - message.minEpoch !== undefined && (obj.minEpoch = Math.round(message.minEpoch)); - message.maxEpoch !== undefined && (obj.maxEpoch = Math.round(message.maxEpoch)); - message.uncompressedFileSize !== undefined && (obj.uncompressedFileSize = Math.round(message.uncompressedFileSize)); - return obj; - }, - - fromPartial, I>>(object: I): SstableInfo { - const message = createBaseSstableInfo(); - message.objectId = object.objectId ?? 0; - message.sstId = object.sstId ?? 0; - message.keyRange = (object.keyRange !== undefined && object.keyRange !== null) - ? KeyRange.fromPartial(object.keyRange) - : undefined; - message.fileSize = object.fileSize ?? 0; - message.tableIds = object.tableIds?.map((e) => e) || []; - message.metaOffset = object.metaOffset ?? 0; - message.staleKeyCount = object.staleKeyCount ?? 0; - message.totalKeyCount = object.totalKeyCount ?? 0; - message.minEpoch = object.minEpoch ?? 0; - message.maxEpoch = object.maxEpoch ?? 0; - message.uncompressedFileSize = object.uncompressedFileSize ?? 0; - return message; - }, -}; - -function createBaseOverlappingLevel(): OverlappingLevel { - return { subLevels: [], totalFileSize: 0, uncompressedFileSize: 0 }; -} - -export const OverlappingLevel = { - fromJSON(object: any): OverlappingLevel { - return { - subLevels: Array.isArray(object?.subLevels) ? object.subLevels.map((e: any) => Level.fromJSON(e)) : [], - totalFileSize: isSet(object.totalFileSize) ? Number(object.totalFileSize) : 0, - uncompressedFileSize: isSet(object.uncompressedFileSize) ? Number(object.uncompressedFileSize) : 0, - }; - }, - - toJSON(message: OverlappingLevel): unknown { - const obj: any = {}; - if (message.subLevels) { - obj.subLevels = message.subLevels.map((e) => e ? Level.toJSON(e) : undefined); - } else { - obj.subLevels = []; - } - message.totalFileSize !== undefined && (obj.totalFileSize = Math.round(message.totalFileSize)); - message.uncompressedFileSize !== undefined && (obj.uncompressedFileSize = Math.round(message.uncompressedFileSize)); - return obj; - }, - - fromPartial, I>>(object: I): OverlappingLevel { - const message = createBaseOverlappingLevel(); - message.subLevels = object.subLevels?.map((e) => Level.fromPartial(e)) || []; - message.totalFileSize = object.totalFileSize ?? 0; - message.uncompressedFileSize = object.uncompressedFileSize ?? 0; - return message; - }, -}; - -function createBaseLevel(): Level { - return { - levelIdx: 0, - levelType: LevelType.UNSPECIFIED, - tableInfos: [], - totalFileSize: 0, - subLevelId: 0, - uncompressedFileSize: 0, - }; -} - -export const Level = { - fromJSON(object: any): Level { - return { - levelIdx: isSet(object.levelIdx) ? Number(object.levelIdx) : 0, - levelType: isSet(object.levelType) ? levelTypeFromJSON(object.levelType) : LevelType.UNSPECIFIED, - tableInfos: Array.isArray(object?.tableInfos) ? object.tableInfos.map((e: any) => SstableInfo.fromJSON(e)) : [], - totalFileSize: isSet(object.totalFileSize) ? Number(object.totalFileSize) : 0, - subLevelId: isSet(object.subLevelId) ? Number(object.subLevelId) : 0, - uncompressedFileSize: isSet(object.uncompressedFileSize) ? Number(object.uncompressedFileSize) : 0, - }; - }, - - toJSON(message: Level): unknown { - const obj: any = {}; - message.levelIdx !== undefined && (obj.levelIdx = Math.round(message.levelIdx)); - message.levelType !== undefined && (obj.levelType = levelTypeToJSON(message.levelType)); - if (message.tableInfos) { - obj.tableInfos = message.tableInfos.map((e) => e ? SstableInfo.toJSON(e) : undefined); - } else { - obj.tableInfos = []; - } - message.totalFileSize !== undefined && (obj.totalFileSize = Math.round(message.totalFileSize)); - message.subLevelId !== undefined && (obj.subLevelId = Math.round(message.subLevelId)); - message.uncompressedFileSize !== undefined && (obj.uncompressedFileSize = Math.round(message.uncompressedFileSize)); - return obj; - }, - - fromPartial, I>>(object: I): Level { - const message = createBaseLevel(); - message.levelIdx = object.levelIdx ?? 0; - message.levelType = object.levelType ?? LevelType.UNSPECIFIED; - message.tableInfos = object.tableInfos?.map((e) => SstableInfo.fromPartial(e)) || []; - message.totalFileSize = object.totalFileSize ?? 0; - message.subLevelId = object.subLevelId ?? 0; - message.uncompressedFileSize = object.uncompressedFileSize ?? 0; - return message; - }, -}; - -function createBaseInputLevel(): InputLevel { - return { levelIdx: 0, levelType: LevelType.UNSPECIFIED, tableInfos: [] }; -} - -export const InputLevel = { - fromJSON(object: any): InputLevel { - return { - levelIdx: isSet(object.levelIdx) ? Number(object.levelIdx) : 0, - levelType: isSet(object.levelType) ? levelTypeFromJSON(object.levelType) : LevelType.UNSPECIFIED, - tableInfos: Array.isArray(object?.tableInfos) ? object.tableInfos.map((e: any) => SstableInfo.fromJSON(e)) : [], - }; - }, - - toJSON(message: InputLevel): unknown { - const obj: any = {}; - message.levelIdx !== undefined && (obj.levelIdx = Math.round(message.levelIdx)); - message.levelType !== undefined && (obj.levelType = levelTypeToJSON(message.levelType)); - if (message.tableInfos) { - obj.tableInfos = message.tableInfos.map((e) => e ? SstableInfo.toJSON(e) : undefined); - } else { - obj.tableInfos = []; - } - return obj; - }, - - fromPartial, I>>(object: I): InputLevel { - const message = createBaseInputLevel(); - message.levelIdx = object.levelIdx ?? 0; - message.levelType = object.levelType ?? LevelType.UNSPECIFIED; - message.tableInfos = object.tableInfos?.map((e) => SstableInfo.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseIntraLevelDelta(): IntraLevelDelta { - return { levelIdx: 0, l0SubLevelId: 0, removedTableIds: [], insertedTableInfos: [] }; -} - -export const IntraLevelDelta = { - fromJSON(object: any): IntraLevelDelta { - return { - levelIdx: isSet(object.levelIdx) ? Number(object.levelIdx) : 0, - l0SubLevelId: isSet(object.l0SubLevelId) ? Number(object.l0SubLevelId) : 0, - removedTableIds: Array.isArray(object?.removedTableIds) ? object.removedTableIds.map((e: any) => Number(e)) : [], - insertedTableInfos: Array.isArray(object?.insertedTableInfos) - ? object.insertedTableInfos.map((e: any) => SstableInfo.fromJSON(e)) - : [], - }; - }, - - toJSON(message: IntraLevelDelta): unknown { - const obj: any = {}; - message.levelIdx !== undefined && (obj.levelIdx = Math.round(message.levelIdx)); - message.l0SubLevelId !== undefined && (obj.l0SubLevelId = Math.round(message.l0SubLevelId)); - if (message.removedTableIds) { - obj.removedTableIds = message.removedTableIds.map((e) => Math.round(e)); - } else { - obj.removedTableIds = []; - } - if (message.insertedTableInfos) { - obj.insertedTableInfos = message.insertedTableInfos.map((e) => e ? SstableInfo.toJSON(e) : undefined); - } else { - obj.insertedTableInfos = []; - } - return obj; - }, - - fromPartial, I>>(object: I): IntraLevelDelta { - const message = createBaseIntraLevelDelta(); - message.levelIdx = object.levelIdx ?? 0; - message.l0SubLevelId = object.l0SubLevelId ?? 0; - message.removedTableIds = object.removedTableIds?.map((e) => e) || []; - message.insertedTableInfos = object.insertedTableInfos?.map((e) => SstableInfo.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseGroupConstruct(): GroupConstruct { - return { groupConfig: undefined, parentGroupId: 0, tableIds: [], groupId: 0, newSstStartId: 0 }; -} - -export const GroupConstruct = { - fromJSON(object: any): GroupConstruct { - return { - groupConfig: isSet(object.groupConfig) ? CompactionConfig.fromJSON(object.groupConfig) : undefined, - parentGroupId: isSet(object.parentGroupId) ? Number(object.parentGroupId) : 0, - tableIds: Array.isArray(object?.tableIds) ? object.tableIds.map((e: any) => Number(e)) : [], - groupId: isSet(object.groupId) ? Number(object.groupId) : 0, - newSstStartId: isSet(object.newSstStartId) ? Number(object.newSstStartId) : 0, - }; - }, - - toJSON(message: GroupConstruct): unknown { - const obj: any = {}; - message.groupConfig !== undefined && - (obj.groupConfig = message.groupConfig ? CompactionConfig.toJSON(message.groupConfig) : undefined); - message.parentGroupId !== undefined && (obj.parentGroupId = Math.round(message.parentGroupId)); - if (message.tableIds) { - obj.tableIds = message.tableIds.map((e) => Math.round(e)); - } else { - obj.tableIds = []; - } - message.groupId !== undefined && (obj.groupId = Math.round(message.groupId)); - message.newSstStartId !== undefined && (obj.newSstStartId = Math.round(message.newSstStartId)); - return obj; - }, - - fromPartial, I>>(object: I): GroupConstruct { - const message = createBaseGroupConstruct(); - message.groupConfig = (object.groupConfig !== undefined && object.groupConfig !== null) - ? CompactionConfig.fromPartial(object.groupConfig) - : undefined; - message.parentGroupId = object.parentGroupId ?? 0; - message.tableIds = object.tableIds?.map((e) => e) || []; - message.groupId = object.groupId ?? 0; - message.newSstStartId = object.newSstStartId ?? 0; - return message; - }, -}; - -function createBaseGroupMetaChange(): GroupMetaChange { - return { tableIdsAdd: [], tableIdsRemove: [] }; -} - -export const GroupMetaChange = { - fromJSON(object: any): GroupMetaChange { - return { - tableIdsAdd: Array.isArray(object?.tableIdsAdd) ? object.tableIdsAdd.map((e: any) => Number(e)) : [], - tableIdsRemove: Array.isArray(object?.tableIdsRemove) ? object.tableIdsRemove.map((e: any) => Number(e)) : [], - }; - }, - - toJSON(message: GroupMetaChange): unknown { - const obj: any = {}; - if (message.tableIdsAdd) { - obj.tableIdsAdd = message.tableIdsAdd.map((e) => Math.round(e)); - } else { - obj.tableIdsAdd = []; - } - if (message.tableIdsRemove) { - obj.tableIdsRemove = message.tableIdsRemove.map((e) => Math.round(e)); - } else { - obj.tableIdsRemove = []; - } - return obj; - }, - - fromPartial, I>>(object: I): GroupMetaChange { - const message = createBaseGroupMetaChange(); - message.tableIdsAdd = object.tableIdsAdd?.map((e) => e) || []; - message.tableIdsRemove = object.tableIdsRemove?.map((e) => e) || []; - return message; - }, -}; - -function createBaseGroupDestroy(): GroupDestroy { - return {}; -} - -export const GroupDestroy = { - fromJSON(_: any): GroupDestroy { - return {}; - }, - - toJSON(_: GroupDestroy): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): GroupDestroy { - const message = createBaseGroupDestroy(); - return message; - }, -}; - -function createBaseGroupDelta(): GroupDelta { - return { deltaType: undefined }; -} - -export const GroupDelta = { - fromJSON(object: any): GroupDelta { - return { - deltaType: isSet(object.intraLevel) - ? { $case: "intraLevel", intraLevel: IntraLevelDelta.fromJSON(object.intraLevel) } - : isSet(object.groupConstruct) - ? { $case: "groupConstruct", groupConstruct: GroupConstruct.fromJSON(object.groupConstruct) } - : isSet(object.groupDestroy) - ? { $case: "groupDestroy", groupDestroy: GroupDestroy.fromJSON(object.groupDestroy) } - : isSet(object.groupMetaChange) - ? { $case: "groupMetaChange", groupMetaChange: GroupMetaChange.fromJSON(object.groupMetaChange) } - : undefined, - }; - }, - - toJSON(message: GroupDelta): unknown { - const obj: any = {}; - message.deltaType?.$case === "intraLevel" && (obj.intraLevel = message.deltaType?.intraLevel - ? IntraLevelDelta.toJSON(message.deltaType?.intraLevel) - : undefined); - message.deltaType?.$case === "groupConstruct" && (obj.groupConstruct = message.deltaType?.groupConstruct - ? GroupConstruct.toJSON(message.deltaType?.groupConstruct) - : undefined); - message.deltaType?.$case === "groupDestroy" && (obj.groupDestroy = message.deltaType?.groupDestroy - ? GroupDestroy.toJSON(message.deltaType?.groupDestroy) - : undefined); - message.deltaType?.$case === "groupMetaChange" && (obj.groupMetaChange = message.deltaType?.groupMetaChange - ? GroupMetaChange.toJSON(message.deltaType?.groupMetaChange) - : undefined); - return obj; - }, - - fromPartial, I>>(object: I): GroupDelta { - const message = createBaseGroupDelta(); - if ( - object.deltaType?.$case === "intraLevel" && - object.deltaType?.intraLevel !== undefined && - object.deltaType?.intraLevel !== null - ) { - message.deltaType = { $case: "intraLevel", intraLevel: IntraLevelDelta.fromPartial(object.deltaType.intraLevel) }; - } - if ( - object.deltaType?.$case === "groupConstruct" && - object.deltaType?.groupConstruct !== undefined && - object.deltaType?.groupConstruct !== null - ) { - message.deltaType = { - $case: "groupConstruct", - groupConstruct: GroupConstruct.fromPartial(object.deltaType.groupConstruct), - }; - } - if ( - object.deltaType?.$case === "groupDestroy" && - object.deltaType?.groupDestroy !== undefined && - object.deltaType?.groupDestroy !== null - ) { - message.deltaType = { - $case: "groupDestroy", - groupDestroy: GroupDestroy.fromPartial(object.deltaType.groupDestroy), - }; - } - if ( - object.deltaType?.$case === "groupMetaChange" && - object.deltaType?.groupMetaChange !== undefined && - object.deltaType?.groupMetaChange !== null - ) { - message.deltaType = { - $case: "groupMetaChange", - groupMetaChange: GroupMetaChange.fromPartial(object.deltaType.groupMetaChange), - }; - } - return message; - }, -}; - -function createBaseUncommittedEpoch(): UncommittedEpoch { - return { epoch: 0, tables: [] }; -} - -export const UncommittedEpoch = { - fromJSON(object: any): UncommittedEpoch { - return { - epoch: isSet(object.epoch) ? Number(object.epoch) : 0, - tables: Array.isArray(object?.tables) ? object.tables.map((e: any) => SstableInfo.fromJSON(e)) : [], - }; - }, - - toJSON(message: UncommittedEpoch): unknown { - const obj: any = {}; - message.epoch !== undefined && (obj.epoch = Math.round(message.epoch)); - if (message.tables) { - obj.tables = message.tables.map((e) => e ? SstableInfo.toJSON(e) : undefined); - } else { - obj.tables = []; - } - return obj; - }, - - fromPartial, I>>(object: I): UncommittedEpoch { - const message = createBaseUncommittedEpoch(); - message.epoch = object.epoch ?? 0; - message.tables = object.tables?.map((e) => SstableInfo.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseHummockVersion(): HummockVersion { - return { id: 0, levels: {}, maxCommittedEpoch: 0, safeEpoch: 0 }; -} - -export const HummockVersion = { - fromJSON(object: any): HummockVersion { - return { - id: isSet(object.id) ? Number(object.id) : 0, - levels: isObject(object.levels) - ? Object.entries(object.levels).reduce<{ [key: number]: HummockVersion_Levels }>((acc, [key, value]) => { - acc[Number(key)] = HummockVersion_Levels.fromJSON(value); - return acc; - }, {}) - : {}, - maxCommittedEpoch: isSet(object.maxCommittedEpoch) ? Number(object.maxCommittedEpoch) : 0, - safeEpoch: isSet(object.safeEpoch) ? Number(object.safeEpoch) : 0, - }; - }, - - toJSON(message: HummockVersion): unknown { - const obj: any = {}; - message.id !== undefined && (obj.id = Math.round(message.id)); - obj.levels = {}; - if (message.levels) { - Object.entries(message.levels).forEach(([k, v]) => { - obj.levels[k] = HummockVersion_Levels.toJSON(v); - }); - } - message.maxCommittedEpoch !== undefined && (obj.maxCommittedEpoch = Math.round(message.maxCommittedEpoch)); - message.safeEpoch !== undefined && (obj.safeEpoch = Math.round(message.safeEpoch)); - return obj; - }, - - fromPartial, I>>(object: I): HummockVersion { - const message = createBaseHummockVersion(); - message.id = object.id ?? 0; - message.levels = Object.entries(object.levels ?? {}).reduce<{ [key: number]: HummockVersion_Levels }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[Number(key)] = HummockVersion_Levels.fromPartial(value); - } - return acc; - }, - {}, - ); - message.maxCommittedEpoch = object.maxCommittedEpoch ?? 0; - message.safeEpoch = object.safeEpoch ?? 0; - return message; - }, -}; - -function createBaseHummockVersion_Levels(): HummockVersion_Levels { - return { levels: [], l0: undefined, groupId: 0, parentGroupId: 0, memberTableIds: [] }; -} - -export const HummockVersion_Levels = { - fromJSON(object: any): HummockVersion_Levels { - return { - levels: Array.isArray(object?.levels) ? object.levels.map((e: any) => Level.fromJSON(e)) : [], - l0: isSet(object.l0) ? OverlappingLevel.fromJSON(object.l0) : undefined, - groupId: isSet(object.groupId) ? Number(object.groupId) : 0, - parentGroupId: isSet(object.parentGroupId) ? Number(object.parentGroupId) : 0, - memberTableIds: Array.isArray(object?.memberTableIds) ? object.memberTableIds.map((e: any) => Number(e)) : [], - }; - }, - - toJSON(message: HummockVersion_Levels): unknown { - const obj: any = {}; - if (message.levels) { - obj.levels = message.levels.map((e) => e ? Level.toJSON(e) : undefined); - } else { - obj.levels = []; - } - message.l0 !== undefined && (obj.l0 = message.l0 ? OverlappingLevel.toJSON(message.l0) : undefined); - message.groupId !== undefined && (obj.groupId = Math.round(message.groupId)); - message.parentGroupId !== undefined && (obj.parentGroupId = Math.round(message.parentGroupId)); - if (message.memberTableIds) { - obj.memberTableIds = message.memberTableIds.map((e) => Math.round(e)); - } else { - obj.memberTableIds = []; - } - return obj; - }, - - fromPartial, I>>(object: I): HummockVersion_Levels { - const message = createBaseHummockVersion_Levels(); - message.levels = object.levels?.map((e) => Level.fromPartial(e)) || []; - message.l0 = (object.l0 !== undefined && object.l0 !== null) ? OverlappingLevel.fromPartial(object.l0) : undefined; - message.groupId = object.groupId ?? 0; - message.parentGroupId = object.parentGroupId ?? 0; - message.memberTableIds = object.memberTableIds?.map((e) => e) || []; - return message; - }, -}; - -function createBaseHummockVersion_LevelsEntry(): HummockVersion_LevelsEntry { - return { key: 0, value: undefined }; -} - -export const HummockVersion_LevelsEntry = { - fromJSON(object: any): HummockVersion_LevelsEntry { - return { - key: isSet(object.key) ? Number(object.key) : 0, - value: isSet(object.value) ? HummockVersion_Levels.fromJSON(object.value) : undefined, - }; - }, - - toJSON(message: HummockVersion_LevelsEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = Math.round(message.key)); - message.value !== undefined && - (obj.value = message.value ? HummockVersion_Levels.toJSON(message.value) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): HummockVersion_LevelsEntry { - const message = createBaseHummockVersion_LevelsEntry(); - message.key = object.key ?? 0; - message.value = (object.value !== undefined && object.value !== null) - ? HummockVersion_Levels.fromPartial(object.value) - : undefined; - return message; - }, -}; - -function createBaseHummockVersionDelta(): HummockVersionDelta { - return { id: 0, prevId: 0, groupDeltas: {}, maxCommittedEpoch: 0, safeEpoch: 0, trivialMove: false, gcObjectIds: [] }; -} - -export const HummockVersionDelta = { - fromJSON(object: any): HummockVersionDelta { - return { - id: isSet(object.id) ? Number(object.id) : 0, - prevId: isSet(object.prevId) ? Number(object.prevId) : 0, - groupDeltas: isObject(object.groupDeltas) - ? Object.entries(object.groupDeltas).reduce<{ [key: number]: HummockVersionDelta_GroupDeltas }>( - (acc, [key, value]) => { - acc[Number(key)] = HummockVersionDelta_GroupDeltas.fromJSON(value); - return acc; - }, - {}, - ) - : {}, - maxCommittedEpoch: isSet(object.maxCommittedEpoch) ? Number(object.maxCommittedEpoch) : 0, - safeEpoch: isSet(object.safeEpoch) ? Number(object.safeEpoch) : 0, - trivialMove: isSet(object.trivialMove) ? Boolean(object.trivialMove) : false, - gcObjectIds: Array.isArray(object?.gcObjectIds) - ? object.gcObjectIds.map((e: any) => Number(e)) - : [], - }; - }, - - toJSON(message: HummockVersionDelta): unknown { - const obj: any = {}; - message.id !== undefined && (obj.id = Math.round(message.id)); - message.prevId !== undefined && (obj.prevId = Math.round(message.prevId)); - obj.groupDeltas = {}; - if (message.groupDeltas) { - Object.entries(message.groupDeltas).forEach(([k, v]) => { - obj.groupDeltas[k] = HummockVersionDelta_GroupDeltas.toJSON(v); - }); - } - message.maxCommittedEpoch !== undefined && (obj.maxCommittedEpoch = Math.round(message.maxCommittedEpoch)); - message.safeEpoch !== undefined && (obj.safeEpoch = Math.round(message.safeEpoch)); - message.trivialMove !== undefined && (obj.trivialMove = message.trivialMove); - if (message.gcObjectIds) { - obj.gcObjectIds = message.gcObjectIds.map((e) => Math.round(e)); - } else { - obj.gcObjectIds = []; - } - return obj; - }, - - fromPartial, I>>(object: I): HummockVersionDelta { - const message = createBaseHummockVersionDelta(); - message.id = object.id ?? 0; - message.prevId = object.prevId ?? 0; - message.groupDeltas = Object.entries(object.groupDeltas ?? {}).reduce< - { [key: number]: HummockVersionDelta_GroupDeltas } - >((acc, [key, value]) => { - if (value !== undefined) { - acc[Number(key)] = HummockVersionDelta_GroupDeltas.fromPartial(value); - } - return acc; - }, {}); - message.maxCommittedEpoch = object.maxCommittedEpoch ?? 0; - message.safeEpoch = object.safeEpoch ?? 0; - message.trivialMove = object.trivialMove ?? false; - message.gcObjectIds = object.gcObjectIds?.map((e) => e) || []; - return message; - }, -}; - -function createBaseHummockVersionDelta_GroupDeltas(): HummockVersionDelta_GroupDeltas { - return { groupDeltas: [] }; -} - -export const HummockVersionDelta_GroupDeltas = { - fromJSON(object: any): HummockVersionDelta_GroupDeltas { - return { - groupDeltas: Array.isArray(object?.groupDeltas) ? object.groupDeltas.map((e: any) => GroupDelta.fromJSON(e)) : [], - }; - }, - - toJSON(message: HummockVersionDelta_GroupDeltas): unknown { - const obj: any = {}; - if (message.groupDeltas) { - obj.groupDeltas = message.groupDeltas.map((e) => e ? GroupDelta.toJSON(e) : undefined); - } else { - obj.groupDeltas = []; - } - return obj; - }, - - fromPartial, I>>( - object: I, - ): HummockVersionDelta_GroupDeltas { - const message = createBaseHummockVersionDelta_GroupDeltas(); - message.groupDeltas = object.groupDeltas?.map((e) => GroupDelta.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseHummockVersionDelta_GroupDeltasEntry(): HummockVersionDelta_GroupDeltasEntry { - return { key: 0, value: undefined }; -} - -export const HummockVersionDelta_GroupDeltasEntry = { - fromJSON(object: any): HummockVersionDelta_GroupDeltasEntry { - return { - key: isSet(object.key) ? Number(object.key) : 0, - value: isSet(object.value) ? HummockVersionDelta_GroupDeltas.fromJSON(object.value) : undefined, - }; - }, - - toJSON(message: HummockVersionDelta_GroupDeltasEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = Math.round(message.key)); - message.value !== undefined && - (obj.value = message.value ? HummockVersionDelta_GroupDeltas.toJSON(message.value) : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): HummockVersionDelta_GroupDeltasEntry { - const message = createBaseHummockVersionDelta_GroupDeltasEntry(); - message.key = object.key ?? 0; - message.value = (object.value !== undefined && object.value !== null) - ? HummockVersionDelta_GroupDeltas.fromPartial(object.value) - : undefined; - return message; - }, -}; - -function createBaseHummockVersionDeltas(): HummockVersionDeltas { - return { versionDeltas: [] }; -} - -export const HummockVersionDeltas = { - fromJSON(object: any): HummockVersionDeltas { - return { - versionDeltas: Array.isArray(object?.versionDeltas) - ? object.versionDeltas.map((e: any) => HummockVersionDelta.fromJSON(e)) - : [], - }; - }, - - toJSON(message: HummockVersionDeltas): unknown { - const obj: any = {}; - if (message.versionDeltas) { - obj.versionDeltas = message.versionDeltas.map((e) => e ? HummockVersionDelta.toJSON(e) : undefined); - } else { - obj.versionDeltas = []; - } - return obj; - }, - - fromPartial, I>>(object: I): HummockVersionDeltas { - const message = createBaseHummockVersionDeltas(); - message.versionDeltas = object.versionDeltas?.map((e) => HummockVersionDelta.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseHummockSnapshot(): HummockSnapshot { - return { committedEpoch: 0, currentEpoch: 0 }; -} - -export const HummockSnapshot = { - fromJSON(object: any): HummockSnapshot { - return { - committedEpoch: isSet(object.committedEpoch) ? Number(object.committedEpoch) : 0, - currentEpoch: isSet(object.currentEpoch) ? Number(object.currentEpoch) : 0, - }; - }, - - toJSON(message: HummockSnapshot): unknown { - const obj: any = {}; - message.committedEpoch !== undefined && (obj.committedEpoch = Math.round(message.committedEpoch)); - message.currentEpoch !== undefined && (obj.currentEpoch = Math.round(message.currentEpoch)); - return obj; - }, - - fromPartial, I>>(object: I): HummockSnapshot { - const message = createBaseHummockSnapshot(); - message.committedEpoch = object.committedEpoch ?? 0; - message.currentEpoch = object.currentEpoch ?? 0; - return message; - }, -}; - -function createBaseVersionUpdatePayload(): VersionUpdatePayload { - return { payload: undefined }; -} - -export const VersionUpdatePayload = { - fromJSON(object: any): VersionUpdatePayload { - return { - payload: isSet(object.versionDeltas) - ? { $case: "versionDeltas", versionDeltas: HummockVersionDeltas.fromJSON(object.versionDeltas) } - : isSet(object.pinnedVersion) - ? { $case: "pinnedVersion", pinnedVersion: HummockVersion.fromJSON(object.pinnedVersion) } - : undefined, - }; - }, - - toJSON(message: VersionUpdatePayload): unknown { - const obj: any = {}; - message.payload?.$case === "versionDeltas" && (obj.versionDeltas = message.payload?.versionDeltas - ? HummockVersionDeltas.toJSON(message.payload?.versionDeltas) - : undefined); - message.payload?.$case === "pinnedVersion" && (obj.pinnedVersion = message.payload?.pinnedVersion - ? HummockVersion.toJSON(message.payload?.pinnedVersion) - : undefined); - return obj; - }, - - fromPartial, I>>(object: I): VersionUpdatePayload { - const message = createBaseVersionUpdatePayload(); - if ( - object.payload?.$case === "versionDeltas" && - object.payload?.versionDeltas !== undefined && - object.payload?.versionDeltas !== null - ) { - message.payload = { - $case: "versionDeltas", - versionDeltas: HummockVersionDeltas.fromPartial(object.payload.versionDeltas), - }; - } - if ( - object.payload?.$case === "pinnedVersion" && - object.payload?.pinnedVersion !== undefined && - object.payload?.pinnedVersion !== null - ) { - message.payload = { - $case: "pinnedVersion", - pinnedVersion: HummockVersion.fromPartial(object.payload.pinnedVersion), - }; - } - return message; - }, -}; - -function createBaseUnpinVersionBeforeRequest(): UnpinVersionBeforeRequest { - return { contextId: 0, unpinVersionBefore: 0 }; -} - -export const UnpinVersionBeforeRequest = { - fromJSON(object: any): UnpinVersionBeforeRequest { - return { - contextId: isSet(object.contextId) ? Number(object.contextId) : 0, - unpinVersionBefore: isSet(object.unpinVersionBefore) ? Number(object.unpinVersionBefore) : 0, - }; - }, - - toJSON(message: UnpinVersionBeforeRequest): unknown { - const obj: any = {}; - message.contextId !== undefined && (obj.contextId = Math.round(message.contextId)); - message.unpinVersionBefore !== undefined && (obj.unpinVersionBefore = Math.round(message.unpinVersionBefore)); - return obj; - }, - - fromPartial, I>>(object: I): UnpinVersionBeforeRequest { - const message = createBaseUnpinVersionBeforeRequest(); - message.contextId = object.contextId ?? 0; - message.unpinVersionBefore = object.unpinVersionBefore ?? 0; - return message; - }, -}; - -function createBaseUnpinVersionBeforeResponse(): UnpinVersionBeforeResponse { - return { status: undefined }; -} - -export const UnpinVersionBeforeResponse = { - fromJSON(object: any): UnpinVersionBeforeResponse { - return { status: isSet(object.status) ? Status.fromJSON(object.status) : undefined }; - }, - - toJSON(message: UnpinVersionBeforeResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): UnpinVersionBeforeResponse { - const message = createBaseUnpinVersionBeforeResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - return message; - }, -}; - -function createBaseGetCurrentVersionRequest(): GetCurrentVersionRequest { - return {}; -} - -export const GetCurrentVersionRequest = { - fromJSON(_: any): GetCurrentVersionRequest { - return {}; - }, - - toJSON(_: GetCurrentVersionRequest): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): GetCurrentVersionRequest { - const message = createBaseGetCurrentVersionRequest(); - return message; - }, -}; - -function createBaseGetCurrentVersionResponse(): GetCurrentVersionResponse { - return { status: undefined, currentVersion: undefined }; -} - -export const GetCurrentVersionResponse = { - fromJSON(object: any): GetCurrentVersionResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - currentVersion: isSet(object.currentVersion) ? HummockVersion.fromJSON(object.currentVersion) : undefined, - }; - }, - - toJSON(message: GetCurrentVersionResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - message.currentVersion !== undefined && - (obj.currentVersion = message.currentVersion ? HummockVersion.toJSON(message.currentVersion) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): GetCurrentVersionResponse { - const message = createBaseGetCurrentVersionResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.currentVersion = (object.currentVersion !== undefined && object.currentVersion !== null) - ? HummockVersion.fromPartial(object.currentVersion) - : undefined; - return message; - }, -}; - -function createBaseUnpinVersionRequest(): UnpinVersionRequest { - return { contextId: 0 }; -} - -export const UnpinVersionRequest = { - fromJSON(object: any): UnpinVersionRequest { - return { contextId: isSet(object.contextId) ? Number(object.contextId) : 0 }; - }, - - toJSON(message: UnpinVersionRequest): unknown { - const obj: any = {}; - message.contextId !== undefined && (obj.contextId = Math.round(message.contextId)); - return obj; - }, - - fromPartial, I>>(object: I): UnpinVersionRequest { - const message = createBaseUnpinVersionRequest(); - message.contextId = object.contextId ?? 0; - return message; - }, -}; - -function createBaseUnpinVersionResponse(): UnpinVersionResponse { - return { status: undefined }; -} - -export const UnpinVersionResponse = { - fromJSON(object: any): UnpinVersionResponse { - return { status: isSet(object.status) ? Status.fromJSON(object.status) : undefined }; - }, - - toJSON(message: UnpinVersionResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): UnpinVersionResponse { - const message = createBaseUnpinVersionResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - return message; - }, -}; - -function createBasePinSnapshotRequest(): PinSnapshotRequest { - return { contextId: 0 }; -} - -export const PinSnapshotRequest = { - fromJSON(object: any): PinSnapshotRequest { - return { contextId: isSet(object.contextId) ? Number(object.contextId) : 0 }; - }, - - toJSON(message: PinSnapshotRequest): unknown { - const obj: any = {}; - message.contextId !== undefined && (obj.contextId = Math.round(message.contextId)); - return obj; - }, - - fromPartial, I>>(object: I): PinSnapshotRequest { - const message = createBasePinSnapshotRequest(); - message.contextId = object.contextId ?? 0; - return message; - }, -}; - -function createBasePinSpecificSnapshotRequest(): PinSpecificSnapshotRequest { - return { contextId: 0, epoch: 0 }; -} - -export const PinSpecificSnapshotRequest = { - fromJSON(object: any): PinSpecificSnapshotRequest { - return { - contextId: isSet(object.contextId) ? Number(object.contextId) : 0, - epoch: isSet(object.epoch) ? Number(object.epoch) : 0, - }; - }, - - toJSON(message: PinSpecificSnapshotRequest): unknown { - const obj: any = {}; - message.contextId !== undefined && (obj.contextId = Math.round(message.contextId)); - message.epoch !== undefined && (obj.epoch = Math.round(message.epoch)); - return obj; - }, - - fromPartial, I>>(object: I): PinSpecificSnapshotRequest { - const message = createBasePinSpecificSnapshotRequest(); - message.contextId = object.contextId ?? 0; - message.epoch = object.epoch ?? 0; - return message; - }, -}; - -function createBaseGetAssignedCompactTaskNumRequest(): GetAssignedCompactTaskNumRequest { - return {}; -} - -export const GetAssignedCompactTaskNumRequest = { - fromJSON(_: any): GetAssignedCompactTaskNumRequest { - return {}; - }, - - toJSON(_: GetAssignedCompactTaskNumRequest): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>( - _: I, - ): GetAssignedCompactTaskNumRequest { - const message = createBaseGetAssignedCompactTaskNumRequest(); - return message; - }, -}; - -function createBaseGetAssignedCompactTaskNumResponse(): GetAssignedCompactTaskNumResponse { - return { numTasks: 0 }; -} - -export const GetAssignedCompactTaskNumResponse = { - fromJSON(object: any): GetAssignedCompactTaskNumResponse { - return { numTasks: isSet(object.numTasks) ? Number(object.numTasks) : 0 }; - }, - - toJSON(message: GetAssignedCompactTaskNumResponse): unknown { - const obj: any = {}; - message.numTasks !== undefined && (obj.numTasks = Math.round(message.numTasks)); - return obj; - }, - - fromPartial, I>>( - object: I, - ): GetAssignedCompactTaskNumResponse { - const message = createBaseGetAssignedCompactTaskNumResponse(); - message.numTasks = object.numTasks ?? 0; - return message; - }, -}; - -function createBasePinSnapshotResponse(): PinSnapshotResponse { - return { status: undefined, snapshot: undefined }; -} - -export const PinSnapshotResponse = { - fromJSON(object: any): PinSnapshotResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - snapshot: isSet(object.snapshot) ? HummockSnapshot.fromJSON(object.snapshot) : undefined, - }; - }, - - toJSON(message: PinSnapshotResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - message.snapshot !== undefined && - (obj.snapshot = message.snapshot ? HummockSnapshot.toJSON(message.snapshot) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): PinSnapshotResponse { - const message = createBasePinSnapshotResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.snapshot = (object.snapshot !== undefined && object.snapshot !== null) - ? HummockSnapshot.fromPartial(object.snapshot) - : undefined; - return message; - }, -}; - -function createBaseGetEpochRequest(): GetEpochRequest { - return {}; -} - -export const GetEpochRequest = { - fromJSON(_: any): GetEpochRequest { - return {}; - }, - - toJSON(_: GetEpochRequest): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): GetEpochRequest { - const message = createBaseGetEpochRequest(); - return message; - }, -}; - -function createBaseGetEpochResponse(): GetEpochResponse { - return { status: undefined, snapshot: undefined }; -} - -export const GetEpochResponse = { - fromJSON(object: any): GetEpochResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - snapshot: isSet(object.snapshot) ? HummockSnapshot.fromJSON(object.snapshot) : undefined, - }; - }, - - toJSON(message: GetEpochResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - message.snapshot !== undefined && - (obj.snapshot = message.snapshot ? HummockSnapshot.toJSON(message.snapshot) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): GetEpochResponse { - const message = createBaseGetEpochResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.snapshot = (object.snapshot !== undefined && object.snapshot !== null) - ? HummockSnapshot.fromPartial(object.snapshot) - : undefined; - return message; - }, -}; - -function createBaseUnpinSnapshotRequest(): UnpinSnapshotRequest { - return { contextId: 0 }; -} - -export const UnpinSnapshotRequest = { - fromJSON(object: any): UnpinSnapshotRequest { - return { contextId: isSet(object.contextId) ? Number(object.contextId) : 0 }; - }, - - toJSON(message: UnpinSnapshotRequest): unknown { - const obj: any = {}; - message.contextId !== undefined && (obj.contextId = Math.round(message.contextId)); - return obj; - }, - - fromPartial, I>>(object: I): UnpinSnapshotRequest { - const message = createBaseUnpinSnapshotRequest(); - message.contextId = object.contextId ?? 0; - return message; - }, -}; - -function createBaseUnpinSnapshotResponse(): UnpinSnapshotResponse { - return { status: undefined }; -} - -export const UnpinSnapshotResponse = { - fromJSON(object: any): UnpinSnapshotResponse { - return { status: isSet(object.status) ? Status.fromJSON(object.status) : undefined }; - }, - - toJSON(message: UnpinSnapshotResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): UnpinSnapshotResponse { - const message = createBaseUnpinSnapshotResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - return message; - }, -}; - -function createBaseUnpinSnapshotBeforeRequest(): UnpinSnapshotBeforeRequest { - return { contextId: 0, minSnapshot: undefined }; -} - -export const UnpinSnapshotBeforeRequest = { - fromJSON(object: any): UnpinSnapshotBeforeRequest { - return { - contextId: isSet(object.contextId) ? Number(object.contextId) : 0, - minSnapshot: isSet(object.minSnapshot) ? HummockSnapshot.fromJSON(object.minSnapshot) : undefined, - }; - }, - - toJSON(message: UnpinSnapshotBeforeRequest): unknown { - const obj: any = {}; - message.contextId !== undefined && (obj.contextId = Math.round(message.contextId)); - message.minSnapshot !== undefined && - (obj.minSnapshot = message.minSnapshot ? HummockSnapshot.toJSON(message.minSnapshot) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): UnpinSnapshotBeforeRequest { - const message = createBaseUnpinSnapshotBeforeRequest(); - message.contextId = object.contextId ?? 0; - message.minSnapshot = (object.minSnapshot !== undefined && object.minSnapshot !== null) - ? HummockSnapshot.fromPartial(object.minSnapshot) - : undefined; - return message; - }, -}; - -function createBaseUnpinSnapshotBeforeResponse(): UnpinSnapshotBeforeResponse { - return { status: undefined }; -} - -export const UnpinSnapshotBeforeResponse = { - fromJSON(object: any): UnpinSnapshotBeforeResponse { - return { status: isSet(object.status) ? Status.fromJSON(object.status) : undefined }; - }, - - toJSON(message: UnpinSnapshotBeforeResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): UnpinSnapshotBeforeResponse { - const message = createBaseUnpinSnapshotBeforeResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - return message; - }, -}; - -function createBaseKeyRange(): KeyRange { - return { left: new Uint8Array(), right: new Uint8Array(), rightExclusive: false }; -} - -export const KeyRange = { - fromJSON(object: any): KeyRange { - return { - left: isSet(object.left) ? bytesFromBase64(object.left) : new Uint8Array(), - right: isSet(object.right) ? bytesFromBase64(object.right) : new Uint8Array(), - rightExclusive: isSet(object.rightExclusive) ? Boolean(object.rightExclusive) : false, - }; - }, - - toJSON(message: KeyRange): unknown { - const obj: any = {}; - message.left !== undefined && - (obj.left = base64FromBytes(message.left !== undefined ? message.left : new Uint8Array())); - message.right !== undefined && - (obj.right = base64FromBytes(message.right !== undefined ? message.right : new Uint8Array())); - message.rightExclusive !== undefined && (obj.rightExclusive = message.rightExclusive); - return obj; - }, - - fromPartial, I>>(object: I): KeyRange { - const message = createBaseKeyRange(); - message.left = object.left ?? new Uint8Array(); - message.right = object.right ?? new Uint8Array(); - message.rightExclusive = object.rightExclusive ?? false; - return message; - }, -}; - -function createBaseTableOption(): TableOption { - return { retentionSeconds: 0 }; -} - -export const TableOption = { - fromJSON(object: any): TableOption { - return { retentionSeconds: isSet(object.retentionSeconds) ? Number(object.retentionSeconds) : 0 }; - }, - - toJSON(message: TableOption): unknown { - const obj: any = {}; - message.retentionSeconds !== undefined && (obj.retentionSeconds = Math.round(message.retentionSeconds)); - return obj; - }, - - fromPartial, I>>(object: I): TableOption { - const message = createBaseTableOption(); - message.retentionSeconds = object.retentionSeconds ?? 0; - return message; - }, -}; - -function createBaseCompactTask(): CompactTask { - return { - inputSsts: [], - splits: [], - watermark: 0, - sortedOutputSsts: [], - taskId: 0, - targetLevel: 0, - gcDeleteKeys: false, - taskStatus: CompactTask_TaskStatus.UNSPECIFIED, - compactionGroupId: 0, - existingTableIds: [], - compressionAlgorithm: 0, - targetFileSize: 0, - compactionFilterMask: 0, - tableOptions: {}, - currentEpochTime: 0, - targetSubLevelId: 0, - taskType: CompactTask_TaskType.TYPE_UNSPECIFIED, - splitByStateTable: false, - }; -} - -export const CompactTask = { - fromJSON(object: any): CompactTask { - return { - inputSsts: Array.isArray(object?.inputSsts) ? object.inputSsts.map((e: any) => InputLevel.fromJSON(e)) : [], - splits: Array.isArray(object?.splits) ? object.splits.map((e: any) => KeyRange.fromJSON(e)) : [], - watermark: isSet(object.watermark) ? Number(object.watermark) : 0, - sortedOutputSsts: Array.isArray(object?.sortedOutputSsts) - ? object.sortedOutputSsts.map((e: any) => SstableInfo.fromJSON(e)) - : [], - taskId: isSet(object.taskId) ? Number(object.taskId) : 0, - targetLevel: isSet(object.targetLevel) ? Number(object.targetLevel) : 0, - gcDeleteKeys: isSet(object.gcDeleteKeys) ? Boolean(object.gcDeleteKeys) : false, - taskStatus: isSet(object.taskStatus) - ? compactTask_TaskStatusFromJSON(object.taskStatus) - : CompactTask_TaskStatus.UNSPECIFIED, - compactionGroupId: isSet(object.compactionGroupId) ? Number(object.compactionGroupId) : 0, - existingTableIds: Array.isArray(object?.existingTableIds) - ? object.existingTableIds.map((e: any) => Number(e)) - : [], - compressionAlgorithm: isSet(object.compressionAlgorithm) ? Number(object.compressionAlgorithm) : 0, - targetFileSize: isSet(object.targetFileSize) ? Number(object.targetFileSize) : 0, - compactionFilterMask: isSet(object.compactionFilterMask) ? Number(object.compactionFilterMask) : 0, - tableOptions: isObject(object.tableOptions) - ? Object.entries(object.tableOptions).reduce<{ [key: number]: TableOption }>((acc, [key, value]) => { - acc[Number(key)] = TableOption.fromJSON(value); - return acc; - }, {}) - : {}, - currentEpochTime: isSet(object.currentEpochTime) ? Number(object.currentEpochTime) : 0, - targetSubLevelId: isSet(object.targetSubLevelId) ? Number(object.targetSubLevelId) : 0, - taskType: isSet(object.taskType) - ? compactTask_TaskTypeFromJSON(object.taskType) - : CompactTask_TaskType.TYPE_UNSPECIFIED, - splitByStateTable: isSet(object.splitByStateTable) ? Boolean(object.splitByStateTable) : false, - }; - }, - - toJSON(message: CompactTask): unknown { - const obj: any = {}; - if (message.inputSsts) { - obj.inputSsts = message.inputSsts.map((e) => e ? InputLevel.toJSON(e) : undefined); - } else { - obj.inputSsts = []; - } - if (message.splits) { - obj.splits = message.splits.map((e) => e ? KeyRange.toJSON(e) : undefined); - } else { - obj.splits = []; - } - message.watermark !== undefined && (obj.watermark = Math.round(message.watermark)); - if (message.sortedOutputSsts) { - obj.sortedOutputSsts = message.sortedOutputSsts.map((e) => e ? SstableInfo.toJSON(e) : undefined); - } else { - obj.sortedOutputSsts = []; - } - message.taskId !== undefined && (obj.taskId = Math.round(message.taskId)); - message.targetLevel !== undefined && (obj.targetLevel = Math.round(message.targetLevel)); - message.gcDeleteKeys !== undefined && (obj.gcDeleteKeys = message.gcDeleteKeys); - message.taskStatus !== undefined && (obj.taskStatus = compactTask_TaskStatusToJSON(message.taskStatus)); - message.compactionGroupId !== undefined && (obj.compactionGroupId = Math.round(message.compactionGroupId)); - if (message.existingTableIds) { - obj.existingTableIds = message.existingTableIds.map((e) => Math.round(e)); - } else { - obj.existingTableIds = []; - } - message.compressionAlgorithm !== undefined && (obj.compressionAlgorithm = Math.round(message.compressionAlgorithm)); - message.targetFileSize !== undefined && (obj.targetFileSize = Math.round(message.targetFileSize)); - message.compactionFilterMask !== undefined && (obj.compactionFilterMask = Math.round(message.compactionFilterMask)); - obj.tableOptions = {}; - if (message.tableOptions) { - Object.entries(message.tableOptions).forEach(([k, v]) => { - obj.tableOptions[k] = TableOption.toJSON(v); - }); - } - message.currentEpochTime !== undefined && (obj.currentEpochTime = Math.round(message.currentEpochTime)); - message.targetSubLevelId !== undefined && (obj.targetSubLevelId = Math.round(message.targetSubLevelId)); - message.taskType !== undefined && (obj.taskType = compactTask_TaskTypeToJSON(message.taskType)); - message.splitByStateTable !== undefined && (obj.splitByStateTable = message.splitByStateTable); - return obj; - }, - - fromPartial, I>>(object: I): CompactTask { - const message = createBaseCompactTask(); - message.inputSsts = object.inputSsts?.map((e) => InputLevel.fromPartial(e)) || []; - message.splits = object.splits?.map((e) => KeyRange.fromPartial(e)) || []; - message.watermark = object.watermark ?? 0; - message.sortedOutputSsts = object.sortedOutputSsts?.map((e) => SstableInfo.fromPartial(e)) || []; - message.taskId = object.taskId ?? 0; - message.targetLevel = object.targetLevel ?? 0; - message.gcDeleteKeys = object.gcDeleteKeys ?? false; - message.taskStatus = object.taskStatus ?? CompactTask_TaskStatus.UNSPECIFIED; - message.compactionGroupId = object.compactionGroupId ?? 0; - message.existingTableIds = object.existingTableIds?.map((e) => e) || []; - message.compressionAlgorithm = object.compressionAlgorithm ?? 0; - message.targetFileSize = object.targetFileSize ?? 0; - message.compactionFilterMask = object.compactionFilterMask ?? 0; - message.tableOptions = Object.entries(object.tableOptions ?? {}).reduce<{ [key: number]: TableOption }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[Number(key)] = TableOption.fromPartial(value); - } - return acc; - }, - {}, - ); - message.currentEpochTime = object.currentEpochTime ?? 0; - message.targetSubLevelId = object.targetSubLevelId ?? 0; - message.taskType = object.taskType ?? CompactTask_TaskType.TYPE_UNSPECIFIED; - message.splitByStateTable = object.splitByStateTable ?? false; - return message; - }, -}; - -function createBaseCompactTask_TableOptionsEntry(): CompactTask_TableOptionsEntry { - return { key: 0, value: undefined }; -} - -export const CompactTask_TableOptionsEntry = { - fromJSON(object: any): CompactTask_TableOptionsEntry { - return { - key: isSet(object.key) ? Number(object.key) : 0, - value: isSet(object.value) ? TableOption.fromJSON(object.value) : undefined, - }; - }, - - toJSON(message: CompactTask_TableOptionsEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = Math.round(message.key)); - message.value !== undefined && (obj.value = message.value ? TableOption.toJSON(message.value) : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): CompactTask_TableOptionsEntry { - const message = createBaseCompactTask_TableOptionsEntry(); - message.key = object.key ?? 0; - message.value = (object.value !== undefined && object.value !== null) - ? TableOption.fromPartial(object.value) - : undefined; - return message; - }, -}; - -function createBaseLevelHandler(): LevelHandler { - return { level: 0, tasks: [] }; -} - -export const LevelHandler = { - fromJSON(object: any): LevelHandler { - return { - level: isSet(object.level) ? Number(object.level) : 0, - tasks: Array.isArray(object?.tasks) - ? object.tasks.map((e: any) => LevelHandler_RunningCompactTask.fromJSON(e)) - : [], - }; - }, - - toJSON(message: LevelHandler): unknown { - const obj: any = {}; - message.level !== undefined && (obj.level = Math.round(message.level)); - if (message.tasks) { - obj.tasks = message.tasks.map((e) => e ? LevelHandler_RunningCompactTask.toJSON(e) : undefined); - } else { - obj.tasks = []; - } - return obj; - }, - - fromPartial, I>>(object: I): LevelHandler { - const message = createBaseLevelHandler(); - message.level = object.level ?? 0; - message.tasks = object.tasks?.map((e) => LevelHandler_RunningCompactTask.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseLevelHandler_RunningCompactTask(): LevelHandler_RunningCompactTask { - return { taskId: 0, ssts: [], totalFileSize: 0, targetLevel: 0 }; -} - -export const LevelHandler_RunningCompactTask = { - fromJSON(object: any): LevelHandler_RunningCompactTask { - return { - taskId: isSet(object.taskId) ? Number(object.taskId) : 0, - ssts: Array.isArray(object?.ssts) ? object.ssts.map((e: any) => Number(e)) : [], - totalFileSize: isSet(object.totalFileSize) ? Number(object.totalFileSize) : 0, - targetLevel: isSet(object.targetLevel) ? Number(object.targetLevel) : 0, - }; - }, - - toJSON(message: LevelHandler_RunningCompactTask): unknown { - const obj: any = {}; - message.taskId !== undefined && (obj.taskId = Math.round(message.taskId)); - if (message.ssts) { - obj.ssts = message.ssts.map((e) => Math.round(e)); - } else { - obj.ssts = []; - } - message.totalFileSize !== undefined && (obj.totalFileSize = Math.round(message.totalFileSize)); - message.targetLevel !== undefined && (obj.targetLevel = Math.round(message.targetLevel)); - return obj; - }, - - fromPartial, I>>( - object: I, - ): LevelHandler_RunningCompactTask { - const message = createBaseLevelHandler_RunningCompactTask(); - message.taskId = object.taskId ?? 0; - message.ssts = object.ssts?.map((e) => e) || []; - message.totalFileSize = object.totalFileSize ?? 0; - message.targetLevel = object.targetLevel ?? 0; - return message; - }, -}; - -function createBaseCompactStatus(): CompactStatus { - return { compactionGroupId: 0, levelHandlers: [] }; -} - -export const CompactStatus = { - fromJSON(object: any): CompactStatus { - return { - compactionGroupId: isSet(object.compactionGroupId) ? Number(object.compactionGroupId) : 0, - levelHandlers: Array.isArray(object?.levelHandlers) - ? object.levelHandlers.map((e: any) => LevelHandler.fromJSON(e)) - : [], - }; - }, - - toJSON(message: CompactStatus): unknown { - const obj: any = {}; - message.compactionGroupId !== undefined && (obj.compactionGroupId = Math.round(message.compactionGroupId)); - if (message.levelHandlers) { - obj.levelHandlers = message.levelHandlers.map((e) => e ? LevelHandler.toJSON(e) : undefined); - } else { - obj.levelHandlers = []; - } - return obj; - }, - - fromPartial, I>>(object: I): CompactStatus { - const message = createBaseCompactStatus(); - message.compactionGroupId = object.compactionGroupId ?? 0; - message.levelHandlers = object.levelHandlers?.map((e) => LevelHandler.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseCompactionGroup(): CompactionGroup { - return { id: 0, compactionConfig: undefined }; -} - -export const CompactionGroup = { - fromJSON(object: any): CompactionGroup { - return { - id: isSet(object.id) ? Number(object.id) : 0, - compactionConfig: isSet(object.compactionConfig) ? CompactionConfig.fromJSON(object.compactionConfig) : undefined, - }; - }, - - toJSON(message: CompactionGroup): unknown { - const obj: any = {}; - message.id !== undefined && (obj.id = Math.round(message.id)); - message.compactionConfig !== undefined && - (obj.compactionConfig = message.compactionConfig ? CompactionConfig.toJSON(message.compactionConfig) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): CompactionGroup { - const message = createBaseCompactionGroup(); - message.id = object.id ?? 0; - message.compactionConfig = (object.compactionConfig !== undefined && object.compactionConfig !== null) - ? CompactionConfig.fromPartial(object.compactionConfig) - : undefined; - return message; - }, -}; - -function createBaseCompactionGroupInfo(): CompactionGroupInfo { - return { id: 0, parentId: 0, memberTableIds: [], compactionConfig: undefined }; -} - -export const CompactionGroupInfo = { - fromJSON(object: any): CompactionGroupInfo { - return { - id: isSet(object.id) ? Number(object.id) : 0, - parentId: isSet(object.parentId) ? Number(object.parentId) : 0, - memberTableIds: Array.isArray(object?.memberTableIds) ? object.memberTableIds.map((e: any) => Number(e)) : [], - compactionConfig: isSet(object.compactionConfig) ? CompactionConfig.fromJSON(object.compactionConfig) : undefined, - }; - }, - - toJSON(message: CompactionGroupInfo): unknown { - const obj: any = {}; - message.id !== undefined && (obj.id = Math.round(message.id)); - message.parentId !== undefined && (obj.parentId = Math.round(message.parentId)); - if (message.memberTableIds) { - obj.memberTableIds = message.memberTableIds.map((e) => Math.round(e)); - } else { - obj.memberTableIds = []; - } - message.compactionConfig !== undefined && - (obj.compactionConfig = message.compactionConfig ? CompactionConfig.toJSON(message.compactionConfig) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): CompactionGroupInfo { - const message = createBaseCompactionGroupInfo(); - message.id = object.id ?? 0; - message.parentId = object.parentId ?? 0; - message.memberTableIds = object.memberTableIds?.map((e) => e) || []; - message.compactionConfig = (object.compactionConfig !== undefined && object.compactionConfig !== null) - ? CompactionConfig.fromPartial(object.compactionConfig) - : undefined; - return message; - }, -}; - -function createBaseCompactTaskAssignment(): CompactTaskAssignment { - return { compactTask: undefined, contextId: 0 }; -} - -export const CompactTaskAssignment = { - fromJSON(object: any): CompactTaskAssignment { - return { - compactTask: isSet(object.compactTask) ? CompactTask.fromJSON(object.compactTask) : undefined, - contextId: isSet(object.contextId) ? Number(object.contextId) : 0, - }; - }, - - toJSON(message: CompactTaskAssignment): unknown { - const obj: any = {}; - message.compactTask !== undefined && - (obj.compactTask = message.compactTask ? CompactTask.toJSON(message.compactTask) : undefined); - message.contextId !== undefined && (obj.contextId = Math.round(message.contextId)); - return obj; - }, - - fromPartial, I>>(object: I): CompactTaskAssignment { - const message = createBaseCompactTaskAssignment(); - message.compactTask = (object.compactTask !== undefined && object.compactTask !== null) - ? CompactTask.fromPartial(object.compactTask) - : undefined; - message.contextId = object.contextId ?? 0; - return message; - }, -}; - -function createBaseGetCompactionTasksRequest(): GetCompactionTasksRequest { - return {}; -} - -export const GetCompactionTasksRequest = { - fromJSON(_: any): GetCompactionTasksRequest { - return {}; - }, - - toJSON(_: GetCompactionTasksRequest): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): GetCompactionTasksRequest { - const message = createBaseGetCompactionTasksRequest(); - return message; - }, -}; - -function createBaseGetCompactionTasksResponse(): GetCompactionTasksResponse { - return { status: undefined, compactTask: undefined }; -} - -export const GetCompactionTasksResponse = { - fromJSON(object: any): GetCompactionTasksResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - compactTask: isSet(object.compactTask) ? CompactTask.fromJSON(object.compactTask) : undefined, - }; - }, - - toJSON(message: GetCompactionTasksResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - message.compactTask !== undefined && - (obj.compactTask = message.compactTask ? CompactTask.toJSON(message.compactTask) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): GetCompactionTasksResponse { - const message = createBaseGetCompactionTasksResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.compactTask = (object.compactTask !== undefined && object.compactTask !== null) - ? CompactTask.fromPartial(object.compactTask) - : undefined; - return message; - }, -}; - -function createBaseReportCompactionTasksRequest(): ReportCompactionTasksRequest { - return { contextId: 0, compactTask: undefined, tableStatsChange: {} }; -} - -export const ReportCompactionTasksRequest = { - fromJSON(object: any): ReportCompactionTasksRequest { - return { - contextId: isSet(object.contextId) ? Number(object.contextId) : 0, - compactTask: isSet(object.compactTask) ? CompactTask.fromJSON(object.compactTask) : undefined, - tableStatsChange: isObject(object.tableStatsChange) - ? Object.entries(object.tableStatsChange).reduce<{ [key: number]: TableStats }>((acc, [key, value]) => { - acc[Number(key)] = TableStats.fromJSON(value); - return acc; - }, {}) - : {}, - }; - }, - - toJSON(message: ReportCompactionTasksRequest): unknown { - const obj: any = {}; - message.contextId !== undefined && (obj.contextId = Math.round(message.contextId)); - message.compactTask !== undefined && - (obj.compactTask = message.compactTask ? CompactTask.toJSON(message.compactTask) : undefined); - obj.tableStatsChange = {}; - if (message.tableStatsChange) { - Object.entries(message.tableStatsChange).forEach(([k, v]) => { - obj.tableStatsChange[k] = TableStats.toJSON(v); - }); - } - return obj; - }, - - fromPartial, I>>(object: I): ReportCompactionTasksRequest { - const message = createBaseReportCompactionTasksRequest(); - message.contextId = object.contextId ?? 0; - message.compactTask = (object.compactTask !== undefined && object.compactTask !== null) - ? CompactTask.fromPartial(object.compactTask) - : undefined; - message.tableStatsChange = Object.entries(object.tableStatsChange ?? {}).reduce<{ [key: number]: TableStats }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[Number(key)] = TableStats.fromPartial(value); - } - return acc; - }, - {}, - ); - return message; - }, -}; - -function createBaseReportCompactionTasksRequest_TableStatsChangeEntry(): ReportCompactionTasksRequest_TableStatsChangeEntry { - return { key: 0, value: undefined }; -} - -export const ReportCompactionTasksRequest_TableStatsChangeEntry = { - fromJSON(object: any): ReportCompactionTasksRequest_TableStatsChangeEntry { - return { - key: isSet(object.key) ? Number(object.key) : 0, - value: isSet(object.value) ? TableStats.fromJSON(object.value) : undefined, - }; - }, - - toJSON(message: ReportCompactionTasksRequest_TableStatsChangeEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = Math.round(message.key)); - message.value !== undefined && (obj.value = message.value ? TableStats.toJSON(message.value) : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): ReportCompactionTasksRequest_TableStatsChangeEntry { - const message = createBaseReportCompactionTasksRequest_TableStatsChangeEntry(); - message.key = object.key ?? 0; - message.value = (object.value !== undefined && object.value !== null) - ? TableStats.fromPartial(object.value) - : undefined; - return message; - }, -}; - -function createBaseReportCompactionTasksResponse(): ReportCompactionTasksResponse { - return { status: undefined }; -} - -export const ReportCompactionTasksResponse = { - fromJSON(object: any): ReportCompactionTasksResponse { - return { status: isSet(object.status) ? Status.fromJSON(object.status) : undefined }; - }, - - toJSON(message: ReportCompactionTasksResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): ReportCompactionTasksResponse { - const message = createBaseReportCompactionTasksResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - return message; - }, -}; - -function createBaseHummockPinnedVersion(): HummockPinnedVersion { - return { contextId: 0, minPinnedId: 0 }; -} - -export const HummockPinnedVersion = { - fromJSON(object: any): HummockPinnedVersion { - return { - contextId: isSet(object.contextId) ? Number(object.contextId) : 0, - minPinnedId: isSet(object.minPinnedId) ? Number(object.minPinnedId) : 0, - }; - }, - - toJSON(message: HummockPinnedVersion): unknown { - const obj: any = {}; - message.contextId !== undefined && (obj.contextId = Math.round(message.contextId)); - message.minPinnedId !== undefined && (obj.minPinnedId = Math.round(message.minPinnedId)); - return obj; - }, - - fromPartial, I>>(object: I): HummockPinnedVersion { - const message = createBaseHummockPinnedVersion(); - message.contextId = object.contextId ?? 0; - message.minPinnedId = object.minPinnedId ?? 0; - return message; - }, -}; - -function createBaseHummockPinnedSnapshot(): HummockPinnedSnapshot { - return { contextId: 0, minimalPinnedSnapshot: 0 }; -} - -export const HummockPinnedSnapshot = { - fromJSON(object: any): HummockPinnedSnapshot { - return { - contextId: isSet(object.contextId) ? Number(object.contextId) : 0, - minimalPinnedSnapshot: isSet(object.minimalPinnedSnapshot) ? Number(object.minimalPinnedSnapshot) : 0, - }; - }, - - toJSON(message: HummockPinnedSnapshot): unknown { - const obj: any = {}; - message.contextId !== undefined && (obj.contextId = Math.round(message.contextId)); - message.minimalPinnedSnapshot !== undefined && - (obj.minimalPinnedSnapshot = Math.round(message.minimalPinnedSnapshot)); - return obj; - }, - - fromPartial, I>>(object: I): HummockPinnedSnapshot { - const message = createBaseHummockPinnedSnapshot(); - message.contextId = object.contextId ?? 0; - message.minimalPinnedSnapshot = object.minimalPinnedSnapshot ?? 0; - return message; - }, -}; - -function createBaseGetNewSstIdsRequest(): GetNewSstIdsRequest { - return { number: 0 }; -} - -export const GetNewSstIdsRequest = { - fromJSON(object: any): GetNewSstIdsRequest { - return { number: isSet(object.number) ? Number(object.number) : 0 }; - }, - - toJSON(message: GetNewSstIdsRequest): unknown { - const obj: any = {}; - message.number !== undefined && (obj.number = Math.round(message.number)); - return obj; - }, - - fromPartial, I>>(object: I): GetNewSstIdsRequest { - const message = createBaseGetNewSstIdsRequest(); - message.number = object.number ?? 0; - return message; - }, -}; - -function createBaseGetNewSstIdsResponse(): GetNewSstIdsResponse { - return { status: undefined, startId: 0, endId: 0 }; -} - -export const GetNewSstIdsResponse = { - fromJSON(object: any): GetNewSstIdsResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - startId: isSet(object.startId) ? Number(object.startId) : 0, - endId: isSet(object.endId) ? Number(object.endId) : 0, - }; - }, - - toJSON(message: GetNewSstIdsResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - message.startId !== undefined && (obj.startId = Math.round(message.startId)); - message.endId !== undefined && (obj.endId = Math.round(message.endId)); - return obj; - }, - - fromPartial, I>>(object: I): GetNewSstIdsResponse { - const message = createBaseGetNewSstIdsResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.startId = object.startId ?? 0; - message.endId = object.endId ?? 0; - return message; - }, -}; - -function createBaseCompactTaskProgress(): CompactTaskProgress { - return { taskId: 0, numSstsSealed: 0, numSstsUploaded: 0 }; -} - -export const CompactTaskProgress = { - fromJSON(object: any): CompactTaskProgress { - return { - taskId: isSet(object.taskId) ? Number(object.taskId) : 0, - numSstsSealed: isSet(object.numSstsSealed) ? Number(object.numSstsSealed) : 0, - numSstsUploaded: isSet(object.numSstsUploaded) ? Number(object.numSstsUploaded) : 0, - }; - }, - - toJSON(message: CompactTaskProgress): unknown { - const obj: any = {}; - message.taskId !== undefined && (obj.taskId = Math.round(message.taskId)); - message.numSstsSealed !== undefined && (obj.numSstsSealed = Math.round(message.numSstsSealed)); - message.numSstsUploaded !== undefined && (obj.numSstsUploaded = Math.round(message.numSstsUploaded)); - return obj; - }, - - fromPartial, I>>(object: I): CompactTaskProgress { - const message = createBaseCompactTaskProgress(); - message.taskId = object.taskId ?? 0; - message.numSstsSealed = object.numSstsSealed ?? 0; - message.numSstsUploaded = object.numSstsUploaded ?? 0; - return message; - }, -}; - -function createBaseCompactorWorkload(): CompactorWorkload { - return { cpu: 0 }; -} - -export const CompactorWorkload = { - fromJSON(object: any): CompactorWorkload { - return { cpu: isSet(object.cpu) ? Number(object.cpu) : 0 }; - }, - - toJSON(message: CompactorWorkload): unknown { - const obj: any = {}; - message.cpu !== undefined && (obj.cpu = Math.round(message.cpu)); - return obj; - }, - - fromPartial, I>>(object: I): CompactorWorkload { - const message = createBaseCompactorWorkload(); - message.cpu = object.cpu ?? 0; - return message; - }, -}; - -function createBaseCompactorHeartbeatRequest(): CompactorHeartbeatRequest { - return { contextId: 0, progress: [], workload: undefined }; -} - -export const CompactorHeartbeatRequest = { - fromJSON(object: any): CompactorHeartbeatRequest { - return { - contextId: isSet(object.contextId) ? Number(object.contextId) : 0, - progress: Array.isArray(object?.progress) ? object.progress.map((e: any) => CompactTaskProgress.fromJSON(e)) : [], - workload: isSet(object.workload) ? CompactorWorkload.fromJSON(object.workload) : undefined, - }; - }, - - toJSON(message: CompactorHeartbeatRequest): unknown { - const obj: any = {}; - message.contextId !== undefined && (obj.contextId = Math.round(message.contextId)); - if (message.progress) { - obj.progress = message.progress.map((e) => e ? CompactTaskProgress.toJSON(e) : undefined); - } else { - obj.progress = []; - } - message.workload !== undefined && - (obj.workload = message.workload ? CompactorWorkload.toJSON(message.workload) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): CompactorHeartbeatRequest { - const message = createBaseCompactorHeartbeatRequest(); - message.contextId = object.contextId ?? 0; - message.progress = object.progress?.map((e) => CompactTaskProgress.fromPartial(e)) || []; - message.workload = (object.workload !== undefined && object.workload !== null) - ? CompactorWorkload.fromPartial(object.workload) - : undefined; - return message; - }, -}; - -function createBaseCompactorHeartbeatResponse(): CompactorHeartbeatResponse { - return { status: undefined }; -} - -export const CompactorHeartbeatResponse = { - fromJSON(object: any): CompactorHeartbeatResponse { - return { status: isSet(object.status) ? Status.fromJSON(object.status) : undefined }; - }, - - toJSON(message: CompactorHeartbeatResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): CompactorHeartbeatResponse { - const message = createBaseCompactorHeartbeatResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - return message; - }, -}; - -function createBaseSubscribeCompactTasksRequest(): SubscribeCompactTasksRequest { - return { contextId: 0, maxConcurrentTaskNumber: 0, cpuCoreNum: 0 }; -} - -export const SubscribeCompactTasksRequest = { - fromJSON(object: any): SubscribeCompactTasksRequest { - return { - contextId: isSet(object.contextId) ? Number(object.contextId) : 0, - maxConcurrentTaskNumber: isSet(object.maxConcurrentTaskNumber) ? Number(object.maxConcurrentTaskNumber) : 0, - cpuCoreNum: isSet(object.cpuCoreNum) ? Number(object.cpuCoreNum) : 0, - }; - }, - - toJSON(message: SubscribeCompactTasksRequest): unknown { - const obj: any = {}; - message.contextId !== undefined && (obj.contextId = Math.round(message.contextId)); - message.maxConcurrentTaskNumber !== undefined && - (obj.maxConcurrentTaskNumber = Math.round(message.maxConcurrentTaskNumber)); - message.cpuCoreNum !== undefined && (obj.cpuCoreNum = Math.round(message.cpuCoreNum)); - return obj; - }, - - fromPartial, I>>(object: I): SubscribeCompactTasksRequest { - const message = createBaseSubscribeCompactTasksRequest(); - message.contextId = object.contextId ?? 0; - message.maxConcurrentTaskNumber = object.maxConcurrentTaskNumber ?? 0; - message.cpuCoreNum = object.cpuCoreNum ?? 0; - return message; - }, -}; - -function createBaseValidationTask(): ValidationTask { - return { sstInfos: [], sstIdToWorkerId: {}, epoch: 0 }; -} - -export const ValidationTask = { - fromJSON(object: any): ValidationTask { - return { - sstInfos: Array.isArray(object?.sstInfos) ? object.sstInfos.map((e: any) => SstableInfo.fromJSON(e)) : [], - sstIdToWorkerId: isObject(object.sstIdToWorkerId) - ? Object.entries(object.sstIdToWorkerId).reduce<{ [key: number]: number }>((acc, [key, value]) => { - acc[Number(key)] = Number(value); - return acc; - }, {}) - : {}, - epoch: isSet(object.epoch) ? Number(object.epoch) : 0, - }; - }, - - toJSON(message: ValidationTask): unknown { - const obj: any = {}; - if (message.sstInfos) { - obj.sstInfos = message.sstInfos.map((e) => e ? SstableInfo.toJSON(e) : undefined); - } else { - obj.sstInfos = []; - } - obj.sstIdToWorkerId = {}; - if (message.sstIdToWorkerId) { - Object.entries(message.sstIdToWorkerId).forEach(([k, v]) => { - obj.sstIdToWorkerId[k] = Math.round(v); - }); - } - message.epoch !== undefined && (obj.epoch = Math.round(message.epoch)); - return obj; - }, - - fromPartial, I>>(object: I): ValidationTask { - const message = createBaseValidationTask(); - message.sstInfos = object.sstInfos?.map((e) => SstableInfo.fromPartial(e)) || []; - message.sstIdToWorkerId = Object.entries(object.sstIdToWorkerId ?? {}).reduce<{ [key: number]: number }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[Number(key)] = Number(value); - } - return acc; - }, - {}, - ); - message.epoch = object.epoch ?? 0; - return message; - }, -}; - -function createBaseValidationTask_SstIdToWorkerIdEntry(): ValidationTask_SstIdToWorkerIdEntry { - return { key: 0, value: 0 }; -} - -export const ValidationTask_SstIdToWorkerIdEntry = { - fromJSON(object: any): ValidationTask_SstIdToWorkerIdEntry { - return { key: isSet(object.key) ? Number(object.key) : 0, value: isSet(object.value) ? Number(object.value) : 0 }; - }, - - toJSON(message: ValidationTask_SstIdToWorkerIdEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = Math.round(message.key)); - message.value !== undefined && (obj.value = Math.round(message.value)); - return obj; - }, - - fromPartial, I>>( - object: I, - ): ValidationTask_SstIdToWorkerIdEntry { - const message = createBaseValidationTask_SstIdToWorkerIdEntry(); - message.key = object.key ?? 0; - message.value = object.value ?? 0; - return message; - }, -}; - -function createBaseSubscribeCompactTasksResponse(): SubscribeCompactTasksResponse { - return { task: undefined }; -} - -export const SubscribeCompactTasksResponse = { - fromJSON(object: any): SubscribeCompactTasksResponse { - return { - task: isSet(object.compactTask) - ? { $case: "compactTask", compactTask: CompactTask.fromJSON(object.compactTask) } - : isSet(object.vacuumTask) - ? { $case: "vacuumTask", vacuumTask: VacuumTask.fromJSON(object.vacuumTask) } - : isSet(object.fullScanTask) - ? { $case: "fullScanTask", fullScanTask: FullScanTask.fromJSON(object.fullScanTask) } - : isSet(object.validationTask) - ? { $case: "validationTask", validationTask: ValidationTask.fromJSON(object.validationTask) } - : isSet(object.cancelCompactTask) - ? { $case: "cancelCompactTask", cancelCompactTask: CancelCompactTask.fromJSON(object.cancelCompactTask) } - : undefined, - }; - }, - - toJSON(message: SubscribeCompactTasksResponse): unknown { - const obj: any = {}; - message.task?.$case === "compactTask" && - (obj.compactTask = message.task?.compactTask ? CompactTask.toJSON(message.task?.compactTask) : undefined); - message.task?.$case === "vacuumTask" && - (obj.vacuumTask = message.task?.vacuumTask ? VacuumTask.toJSON(message.task?.vacuumTask) : undefined); - message.task?.$case === "fullScanTask" && - (obj.fullScanTask = message.task?.fullScanTask ? FullScanTask.toJSON(message.task?.fullScanTask) : undefined); - message.task?.$case === "validationTask" && (obj.validationTask = message.task?.validationTask - ? ValidationTask.toJSON(message.task?.validationTask) - : undefined); - message.task?.$case === "cancelCompactTask" && (obj.cancelCompactTask = message.task?.cancelCompactTask - ? CancelCompactTask.toJSON(message.task?.cancelCompactTask) - : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): SubscribeCompactTasksResponse { - const message = createBaseSubscribeCompactTasksResponse(); - if ( - object.task?.$case === "compactTask" && - object.task?.compactTask !== undefined && - object.task?.compactTask !== null - ) { - message.task = { $case: "compactTask", compactTask: CompactTask.fromPartial(object.task.compactTask) }; - } - if ( - object.task?.$case === "vacuumTask" && object.task?.vacuumTask !== undefined && object.task?.vacuumTask !== null - ) { - message.task = { $case: "vacuumTask", vacuumTask: VacuumTask.fromPartial(object.task.vacuumTask) }; - } - if ( - object.task?.$case === "fullScanTask" && - object.task?.fullScanTask !== undefined && - object.task?.fullScanTask !== null - ) { - message.task = { $case: "fullScanTask", fullScanTask: FullScanTask.fromPartial(object.task.fullScanTask) }; - } - if ( - object.task?.$case === "validationTask" && - object.task?.validationTask !== undefined && - object.task?.validationTask !== null - ) { - message.task = { - $case: "validationTask", - validationTask: ValidationTask.fromPartial(object.task.validationTask), - }; - } - if ( - object.task?.$case === "cancelCompactTask" && - object.task?.cancelCompactTask !== undefined && - object.task?.cancelCompactTask !== null - ) { - message.task = { - $case: "cancelCompactTask", - cancelCompactTask: CancelCompactTask.fromPartial(object.task.cancelCompactTask), - }; - } - return message; - }, -}; - -function createBaseVacuumTask(): VacuumTask { - return { sstableObjectIds: [] }; -} - -export const VacuumTask = { - fromJSON(object: any): VacuumTask { - return { - sstableObjectIds: Array.isArray(object?.sstableObjectIds) - ? object.sstableObjectIds.map((e: any) => Number(e)) - : [], - }; - }, - - toJSON(message: VacuumTask): unknown { - const obj: any = {}; - if (message.sstableObjectIds) { - obj.sstableObjectIds = message.sstableObjectIds.map((e) => Math.round(e)); - } else { - obj.sstableObjectIds = []; - } - return obj; - }, - - fromPartial, I>>(object: I): VacuumTask { - const message = createBaseVacuumTask(); - message.sstableObjectIds = object.sstableObjectIds?.map((e) => e) || []; - return message; - }, -}; - -function createBaseFullScanTask(): FullScanTask { - return { sstRetentionTimeSec: 0 }; -} - -export const FullScanTask = { - fromJSON(object: any): FullScanTask { - return { sstRetentionTimeSec: isSet(object.sstRetentionTimeSec) ? Number(object.sstRetentionTimeSec) : 0 }; - }, - - toJSON(message: FullScanTask): unknown { - const obj: any = {}; - message.sstRetentionTimeSec !== undefined && (obj.sstRetentionTimeSec = Math.round(message.sstRetentionTimeSec)); - return obj; - }, - - fromPartial, I>>(object: I): FullScanTask { - const message = createBaseFullScanTask(); - message.sstRetentionTimeSec = object.sstRetentionTimeSec ?? 0; - return message; - }, -}; - -function createBaseCancelCompactTask(): CancelCompactTask { - return { contextId: 0, taskId: 0 }; -} - -export const CancelCompactTask = { - fromJSON(object: any): CancelCompactTask { - return { - contextId: isSet(object.contextId) ? Number(object.contextId) : 0, - taskId: isSet(object.taskId) ? Number(object.taskId) : 0, - }; - }, - - toJSON(message: CancelCompactTask): unknown { - const obj: any = {}; - message.contextId !== undefined && (obj.contextId = Math.round(message.contextId)); - message.taskId !== undefined && (obj.taskId = Math.round(message.taskId)); - return obj; - }, - - fromPartial, I>>(object: I): CancelCompactTask { - const message = createBaseCancelCompactTask(); - message.contextId = object.contextId ?? 0; - message.taskId = object.taskId ?? 0; - return message; - }, -}; - -function createBaseReportVacuumTaskRequest(): ReportVacuumTaskRequest { - return { vacuumTask: undefined }; -} - -export const ReportVacuumTaskRequest = { - fromJSON(object: any): ReportVacuumTaskRequest { - return { vacuumTask: isSet(object.vacuumTask) ? VacuumTask.fromJSON(object.vacuumTask) : undefined }; - }, - - toJSON(message: ReportVacuumTaskRequest): unknown { - const obj: any = {}; - message.vacuumTask !== undefined && - (obj.vacuumTask = message.vacuumTask ? VacuumTask.toJSON(message.vacuumTask) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): ReportVacuumTaskRequest { - const message = createBaseReportVacuumTaskRequest(); - message.vacuumTask = (object.vacuumTask !== undefined && object.vacuumTask !== null) - ? VacuumTask.fromPartial(object.vacuumTask) - : undefined; - return message; - }, -}; - -function createBaseReportVacuumTaskResponse(): ReportVacuumTaskResponse { - return { status: undefined }; -} - -export const ReportVacuumTaskResponse = { - fromJSON(object: any): ReportVacuumTaskResponse { - return { status: isSet(object.status) ? Status.fromJSON(object.status) : undefined }; - }, - - toJSON(message: ReportVacuumTaskResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): ReportVacuumTaskResponse { - const message = createBaseReportVacuumTaskResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - return message; - }, -}; - -function createBaseTriggerManualCompactionRequest(): TriggerManualCompactionRequest { - return { compactionGroupId: 0, keyRange: undefined, tableId: 0, level: 0, sstIds: [] }; -} - -export const TriggerManualCompactionRequest = { - fromJSON(object: any): TriggerManualCompactionRequest { - return { - compactionGroupId: isSet(object.compactionGroupId) ? Number(object.compactionGroupId) : 0, - keyRange: isSet(object.keyRange) ? KeyRange.fromJSON(object.keyRange) : undefined, - tableId: isSet(object.tableId) ? Number(object.tableId) : 0, - level: isSet(object.level) ? Number(object.level) : 0, - sstIds: Array.isArray(object?.sstIds) ? object.sstIds.map((e: any) => Number(e)) : [], - }; - }, - - toJSON(message: TriggerManualCompactionRequest): unknown { - const obj: any = {}; - message.compactionGroupId !== undefined && (obj.compactionGroupId = Math.round(message.compactionGroupId)); - message.keyRange !== undefined && (obj.keyRange = message.keyRange ? KeyRange.toJSON(message.keyRange) : undefined); - message.tableId !== undefined && (obj.tableId = Math.round(message.tableId)); - message.level !== undefined && (obj.level = Math.round(message.level)); - if (message.sstIds) { - obj.sstIds = message.sstIds.map((e) => Math.round(e)); - } else { - obj.sstIds = []; - } - return obj; - }, - - fromPartial, I>>( - object: I, - ): TriggerManualCompactionRequest { - const message = createBaseTriggerManualCompactionRequest(); - message.compactionGroupId = object.compactionGroupId ?? 0; - message.keyRange = (object.keyRange !== undefined && object.keyRange !== null) - ? KeyRange.fromPartial(object.keyRange) - : undefined; - message.tableId = object.tableId ?? 0; - message.level = object.level ?? 0; - message.sstIds = object.sstIds?.map((e) => e) || []; - return message; - }, -}; - -function createBaseTriggerManualCompactionResponse(): TriggerManualCompactionResponse { - return { status: undefined }; -} - -export const TriggerManualCompactionResponse = { - fromJSON(object: any): TriggerManualCompactionResponse { - return { status: isSet(object.status) ? Status.fromJSON(object.status) : undefined }; - }, - - toJSON(message: TriggerManualCompactionResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): TriggerManualCompactionResponse { - const message = createBaseTriggerManualCompactionResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - return message; - }, -}; - -function createBaseReportFullScanTaskRequest(): ReportFullScanTaskRequest { - return { objectIds: [] }; -} - -export const ReportFullScanTaskRequest = { - fromJSON(object: any): ReportFullScanTaskRequest { - return { objectIds: Array.isArray(object?.objectIds) ? object.objectIds.map((e: any) => Number(e)) : [] }; - }, - - toJSON(message: ReportFullScanTaskRequest): unknown { - const obj: any = {}; - if (message.objectIds) { - obj.objectIds = message.objectIds.map((e) => Math.round(e)); - } else { - obj.objectIds = []; - } - return obj; - }, - - fromPartial, I>>(object: I): ReportFullScanTaskRequest { - const message = createBaseReportFullScanTaskRequest(); - message.objectIds = object.objectIds?.map((e) => e) || []; - return message; - }, -}; - -function createBaseReportFullScanTaskResponse(): ReportFullScanTaskResponse { - return { status: undefined }; -} - -export const ReportFullScanTaskResponse = { - fromJSON(object: any): ReportFullScanTaskResponse { - return { status: isSet(object.status) ? Status.fromJSON(object.status) : undefined }; - }, - - toJSON(message: ReportFullScanTaskResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): ReportFullScanTaskResponse { - const message = createBaseReportFullScanTaskResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - return message; - }, -}; - -function createBaseTriggerFullGCRequest(): TriggerFullGCRequest { - return { sstRetentionTimeSec: 0 }; -} - -export const TriggerFullGCRequest = { - fromJSON(object: any): TriggerFullGCRequest { - return { sstRetentionTimeSec: isSet(object.sstRetentionTimeSec) ? Number(object.sstRetentionTimeSec) : 0 }; - }, - - toJSON(message: TriggerFullGCRequest): unknown { - const obj: any = {}; - message.sstRetentionTimeSec !== undefined && (obj.sstRetentionTimeSec = Math.round(message.sstRetentionTimeSec)); - return obj; - }, - - fromPartial, I>>(object: I): TriggerFullGCRequest { - const message = createBaseTriggerFullGCRequest(); - message.sstRetentionTimeSec = object.sstRetentionTimeSec ?? 0; - return message; - }, -}; - -function createBaseTriggerFullGCResponse(): TriggerFullGCResponse { - return { status: undefined }; -} - -export const TriggerFullGCResponse = { - fromJSON(object: any): TriggerFullGCResponse { - return { status: isSet(object.status) ? Status.fromJSON(object.status) : undefined }; - }, - - toJSON(message: TriggerFullGCResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): TriggerFullGCResponse { - const message = createBaseTriggerFullGCResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - return message; - }, -}; - -function createBaseListVersionDeltasRequest(): ListVersionDeltasRequest { - return { startId: 0, numLimit: 0, committedEpochLimit: 0 }; -} - -export const ListVersionDeltasRequest = { - fromJSON(object: any): ListVersionDeltasRequest { - return { - startId: isSet(object.startId) ? Number(object.startId) : 0, - numLimit: isSet(object.numLimit) ? Number(object.numLimit) : 0, - committedEpochLimit: isSet(object.committedEpochLimit) ? Number(object.committedEpochLimit) : 0, - }; - }, - - toJSON(message: ListVersionDeltasRequest): unknown { - const obj: any = {}; - message.startId !== undefined && (obj.startId = Math.round(message.startId)); - message.numLimit !== undefined && (obj.numLimit = Math.round(message.numLimit)); - message.committedEpochLimit !== undefined && (obj.committedEpochLimit = Math.round(message.committedEpochLimit)); - return obj; - }, - - fromPartial, I>>(object: I): ListVersionDeltasRequest { - const message = createBaseListVersionDeltasRequest(); - message.startId = object.startId ?? 0; - message.numLimit = object.numLimit ?? 0; - message.committedEpochLimit = object.committedEpochLimit ?? 0; - return message; - }, -}; - -function createBaseListVersionDeltasResponse(): ListVersionDeltasResponse { - return { versionDeltas: undefined }; -} - -export const ListVersionDeltasResponse = { - fromJSON(object: any): ListVersionDeltasResponse { - return { - versionDeltas: isSet(object.versionDeltas) ? HummockVersionDeltas.fromJSON(object.versionDeltas) : undefined, - }; - }, - - toJSON(message: ListVersionDeltasResponse): unknown { - const obj: any = {}; - message.versionDeltas !== undefined && - (obj.versionDeltas = message.versionDeltas ? HummockVersionDeltas.toJSON(message.versionDeltas) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): ListVersionDeltasResponse { - const message = createBaseListVersionDeltasResponse(); - message.versionDeltas = (object.versionDeltas !== undefined && object.versionDeltas !== null) - ? HummockVersionDeltas.fromPartial(object.versionDeltas) - : undefined; - return message; - }, -}; - -function createBasePinnedVersionsSummary(): PinnedVersionsSummary { - return { pinnedVersions: [], workers: {} }; -} - -export const PinnedVersionsSummary = { - fromJSON(object: any): PinnedVersionsSummary { - return { - pinnedVersions: Array.isArray(object?.pinnedVersions) - ? object.pinnedVersions.map((e: any) => HummockPinnedVersion.fromJSON(e)) - : [], - workers: isObject(object.workers) - ? Object.entries(object.workers).reduce<{ [key: number]: WorkerNode }>((acc, [key, value]) => { - acc[Number(key)] = WorkerNode.fromJSON(value); - return acc; - }, {}) - : {}, - }; - }, - - toJSON(message: PinnedVersionsSummary): unknown { - const obj: any = {}; - if (message.pinnedVersions) { - obj.pinnedVersions = message.pinnedVersions.map((e) => e ? HummockPinnedVersion.toJSON(e) : undefined); - } else { - obj.pinnedVersions = []; - } - obj.workers = {}; - if (message.workers) { - Object.entries(message.workers).forEach(([k, v]) => { - obj.workers[k] = WorkerNode.toJSON(v); - }); - } - return obj; - }, - - fromPartial, I>>(object: I): PinnedVersionsSummary { - const message = createBasePinnedVersionsSummary(); - message.pinnedVersions = object.pinnedVersions?.map((e) => HummockPinnedVersion.fromPartial(e)) || []; - message.workers = Object.entries(object.workers ?? {}).reduce<{ [key: number]: WorkerNode }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[Number(key)] = WorkerNode.fromPartial(value); - } - return acc; - }, - {}, - ); - return message; - }, -}; - -function createBasePinnedVersionsSummary_WorkersEntry(): PinnedVersionsSummary_WorkersEntry { - return { key: 0, value: undefined }; -} - -export const PinnedVersionsSummary_WorkersEntry = { - fromJSON(object: any): PinnedVersionsSummary_WorkersEntry { - return { - key: isSet(object.key) ? Number(object.key) : 0, - value: isSet(object.value) ? WorkerNode.fromJSON(object.value) : undefined, - }; - }, - - toJSON(message: PinnedVersionsSummary_WorkersEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = Math.round(message.key)); - message.value !== undefined && (obj.value = message.value ? WorkerNode.toJSON(message.value) : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): PinnedVersionsSummary_WorkersEntry { - const message = createBasePinnedVersionsSummary_WorkersEntry(); - message.key = object.key ?? 0; - message.value = (object.value !== undefined && object.value !== null) - ? WorkerNode.fromPartial(object.value) - : undefined; - return message; - }, -}; - -function createBasePinnedSnapshotsSummary(): PinnedSnapshotsSummary { - return { pinnedSnapshots: [], workers: {} }; -} - -export const PinnedSnapshotsSummary = { - fromJSON(object: any): PinnedSnapshotsSummary { - return { - pinnedSnapshots: Array.isArray(object?.pinnedSnapshots) - ? object.pinnedSnapshots.map((e: any) => HummockPinnedSnapshot.fromJSON(e)) - : [], - workers: isObject(object.workers) - ? Object.entries(object.workers).reduce<{ [key: number]: WorkerNode }>((acc, [key, value]) => { - acc[Number(key)] = WorkerNode.fromJSON(value); - return acc; - }, {}) - : {}, - }; - }, - - toJSON(message: PinnedSnapshotsSummary): unknown { - const obj: any = {}; - if (message.pinnedSnapshots) { - obj.pinnedSnapshots = message.pinnedSnapshots.map((e) => e ? HummockPinnedSnapshot.toJSON(e) : undefined); - } else { - obj.pinnedSnapshots = []; - } - obj.workers = {}; - if (message.workers) { - Object.entries(message.workers).forEach(([k, v]) => { - obj.workers[k] = WorkerNode.toJSON(v); - }); - } - return obj; - }, - - fromPartial, I>>(object: I): PinnedSnapshotsSummary { - const message = createBasePinnedSnapshotsSummary(); - message.pinnedSnapshots = object.pinnedSnapshots?.map((e) => HummockPinnedSnapshot.fromPartial(e)) || []; - message.workers = Object.entries(object.workers ?? {}).reduce<{ [key: number]: WorkerNode }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[Number(key)] = WorkerNode.fromPartial(value); - } - return acc; - }, - {}, - ); - return message; - }, -}; - -function createBasePinnedSnapshotsSummary_WorkersEntry(): PinnedSnapshotsSummary_WorkersEntry { - return { key: 0, value: undefined }; -} - -export const PinnedSnapshotsSummary_WorkersEntry = { - fromJSON(object: any): PinnedSnapshotsSummary_WorkersEntry { - return { - key: isSet(object.key) ? Number(object.key) : 0, - value: isSet(object.value) ? WorkerNode.fromJSON(object.value) : undefined, - }; - }, - - toJSON(message: PinnedSnapshotsSummary_WorkersEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = Math.round(message.key)); - message.value !== undefined && (obj.value = message.value ? WorkerNode.toJSON(message.value) : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): PinnedSnapshotsSummary_WorkersEntry { - const message = createBasePinnedSnapshotsSummary_WorkersEntry(); - message.key = object.key ?? 0; - message.value = (object.value !== undefined && object.value !== null) - ? WorkerNode.fromPartial(object.value) - : undefined; - return message; - }, -}; - -function createBaseRiseCtlGetPinnedVersionsSummaryRequest(): RiseCtlGetPinnedVersionsSummaryRequest { - return {}; -} - -export const RiseCtlGetPinnedVersionsSummaryRequest = { - fromJSON(_: any): RiseCtlGetPinnedVersionsSummaryRequest { - return {}; - }, - - toJSON(_: RiseCtlGetPinnedVersionsSummaryRequest): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>( - _: I, - ): RiseCtlGetPinnedVersionsSummaryRequest { - const message = createBaseRiseCtlGetPinnedVersionsSummaryRequest(); - return message; - }, -}; - -function createBaseRiseCtlGetPinnedVersionsSummaryResponse(): RiseCtlGetPinnedVersionsSummaryResponse { - return { summary: undefined }; -} - -export const RiseCtlGetPinnedVersionsSummaryResponse = { - fromJSON(object: any): RiseCtlGetPinnedVersionsSummaryResponse { - return { summary: isSet(object.summary) ? PinnedVersionsSummary.fromJSON(object.summary) : undefined }; - }, - - toJSON(message: RiseCtlGetPinnedVersionsSummaryResponse): unknown { - const obj: any = {}; - message.summary !== undefined && - (obj.summary = message.summary ? PinnedVersionsSummary.toJSON(message.summary) : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): RiseCtlGetPinnedVersionsSummaryResponse { - const message = createBaseRiseCtlGetPinnedVersionsSummaryResponse(); - message.summary = (object.summary !== undefined && object.summary !== null) - ? PinnedVersionsSummary.fromPartial(object.summary) - : undefined; - return message; - }, -}; - -function createBaseRiseCtlGetPinnedSnapshotsSummaryRequest(): RiseCtlGetPinnedSnapshotsSummaryRequest { - return {}; -} - -export const RiseCtlGetPinnedSnapshotsSummaryRequest = { - fromJSON(_: any): RiseCtlGetPinnedSnapshotsSummaryRequest { - return {}; - }, - - toJSON(_: RiseCtlGetPinnedSnapshotsSummaryRequest): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>( - _: I, - ): RiseCtlGetPinnedSnapshotsSummaryRequest { - const message = createBaseRiseCtlGetPinnedSnapshotsSummaryRequest(); - return message; - }, -}; - -function createBaseRiseCtlGetPinnedSnapshotsSummaryResponse(): RiseCtlGetPinnedSnapshotsSummaryResponse { - return { summary: undefined }; -} - -export const RiseCtlGetPinnedSnapshotsSummaryResponse = { - fromJSON(object: any): RiseCtlGetPinnedSnapshotsSummaryResponse { - return { summary: isSet(object.summary) ? PinnedSnapshotsSummary.fromJSON(object.summary) : undefined }; - }, - - toJSON(message: RiseCtlGetPinnedSnapshotsSummaryResponse): unknown { - const obj: any = {}; - message.summary !== undefined && - (obj.summary = message.summary ? PinnedSnapshotsSummary.toJSON(message.summary) : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): RiseCtlGetPinnedSnapshotsSummaryResponse { - const message = createBaseRiseCtlGetPinnedSnapshotsSummaryResponse(); - message.summary = (object.summary !== undefined && object.summary !== null) - ? PinnedSnapshotsSummary.fromPartial(object.summary) - : undefined; - return message; - }, -}; - -function createBaseInitMetadataForReplayRequest(): InitMetadataForReplayRequest { - return { tables: [], compactionGroups: [] }; -} - -export const InitMetadataForReplayRequest = { - fromJSON(object: any): InitMetadataForReplayRequest { - return { - tables: Array.isArray(object?.tables) ? object.tables.map((e: any) => Table.fromJSON(e)) : [], - compactionGroups: Array.isArray(object?.compactionGroups) - ? object.compactionGroups.map((e: any) => CompactionGroupInfo.fromJSON(e)) - : [], - }; - }, - - toJSON(message: InitMetadataForReplayRequest): unknown { - const obj: any = {}; - if (message.tables) { - obj.tables = message.tables.map((e) => e ? Table.toJSON(e) : undefined); - } else { - obj.tables = []; - } - if (message.compactionGroups) { - obj.compactionGroups = message.compactionGroups.map((e) => e ? CompactionGroupInfo.toJSON(e) : undefined); - } else { - obj.compactionGroups = []; - } - return obj; - }, - - fromPartial, I>>(object: I): InitMetadataForReplayRequest { - const message = createBaseInitMetadataForReplayRequest(); - message.tables = object.tables?.map((e) => Table.fromPartial(e)) || []; - message.compactionGroups = object.compactionGroups?.map((e) => CompactionGroupInfo.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseInitMetadataForReplayResponse(): InitMetadataForReplayResponse { - return {}; -} - -export const InitMetadataForReplayResponse = { - fromJSON(_: any): InitMetadataForReplayResponse { - return {}; - }, - - toJSON(_: InitMetadataForReplayResponse): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): InitMetadataForReplayResponse { - const message = createBaseInitMetadataForReplayResponse(); - return message; - }, -}; - -function createBaseReplayVersionDeltaRequest(): ReplayVersionDeltaRequest { - return { versionDelta: undefined }; -} - -export const ReplayVersionDeltaRequest = { - fromJSON(object: any): ReplayVersionDeltaRequest { - return { versionDelta: isSet(object.versionDelta) ? HummockVersionDelta.fromJSON(object.versionDelta) : undefined }; - }, - - toJSON(message: ReplayVersionDeltaRequest): unknown { - const obj: any = {}; - message.versionDelta !== undefined && - (obj.versionDelta = message.versionDelta ? HummockVersionDelta.toJSON(message.versionDelta) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): ReplayVersionDeltaRequest { - const message = createBaseReplayVersionDeltaRequest(); - message.versionDelta = (object.versionDelta !== undefined && object.versionDelta !== null) - ? HummockVersionDelta.fromPartial(object.versionDelta) - : undefined; - return message; - }, -}; - -function createBaseReplayVersionDeltaResponse(): ReplayVersionDeltaResponse { - return { version: undefined, modifiedCompactionGroups: [] }; -} - -export const ReplayVersionDeltaResponse = { - fromJSON(object: any): ReplayVersionDeltaResponse { - return { - version: isSet(object.version) ? HummockVersion.fromJSON(object.version) : undefined, - modifiedCompactionGroups: Array.isArray(object?.modifiedCompactionGroups) - ? object.modifiedCompactionGroups.map((e: any) => Number(e)) - : [], - }; - }, - - toJSON(message: ReplayVersionDeltaResponse): unknown { - const obj: any = {}; - message.version !== undefined && - (obj.version = message.version ? HummockVersion.toJSON(message.version) : undefined); - if (message.modifiedCompactionGroups) { - obj.modifiedCompactionGroups = message.modifiedCompactionGroups.map((e) => Math.round(e)); - } else { - obj.modifiedCompactionGroups = []; - } - return obj; - }, - - fromPartial, I>>(object: I): ReplayVersionDeltaResponse { - const message = createBaseReplayVersionDeltaResponse(); - message.version = (object.version !== undefined && object.version !== null) - ? HummockVersion.fromPartial(object.version) - : undefined; - message.modifiedCompactionGroups = object.modifiedCompactionGroups?.map((e) => e) || []; - return message; - }, -}; - -function createBaseTriggerCompactionDeterministicRequest(): TriggerCompactionDeterministicRequest { - return { versionId: 0, compactionGroups: [] }; -} - -export const TriggerCompactionDeterministicRequest = { - fromJSON(object: any): TriggerCompactionDeterministicRequest { - return { - versionId: isSet(object.versionId) ? Number(object.versionId) : 0, - compactionGroups: Array.isArray(object?.compactionGroups) - ? object.compactionGroups.map((e: any) => Number(e)) - : [], - }; - }, - - toJSON(message: TriggerCompactionDeterministicRequest): unknown { - const obj: any = {}; - message.versionId !== undefined && (obj.versionId = Math.round(message.versionId)); - if (message.compactionGroups) { - obj.compactionGroups = message.compactionGroups.map((e) => Math.round(e)); - } else { - obj.compactionGroups = []; - } - return obj; - }, - - fromPartial, I>>( - object: I, - ): TriggerCompactionDeterministicRequest { - const message = createBaseTriggerCompactionDeterministicRequest(); - message.versionId = object.versionId ?? 0; - message.compactionGroups = object.compactionGroups?.map((e) => e) || []; - return message; - }, -}; - -function createBaseTriggerCompactionDeterministicResponse(): TriggerCompactionDeterministicResponse { - return {}; -} - -export const TriggerCompactionDeterministicResponse = { - fromJSON(_: any): TriggerCompactionDeterministicResponse { - return {}; - }, - - toJSON(_: TriggerCompactionDeterministicResponse): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>( - _: I, - ): TriggerCompactionDeterministicResponse { - const message = createBaseTriggerCompactionDeterministicResponse(); - return message; - }, -}; - -function createBaseDisableCommitEpochRequest(): DisableCommitEpochRequest { - return {}; -} - -export const DisableCommitEpochRequest = { - fromJSON(_: any): DisableCommitEpochRequest { - return {}; - }, - - toJSON(_: DisableCommitEpochRequest): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): DisableCommitEpochRequest { - const message = createBaseDisableCommitEpochRequest(); - return message; - }, -}; - -function createBaseDisableCommitEpochResponse(): DisableCommitEpochResponse { - return { currentVersion: undefined }; -} - -export const DisableCommitEpochResponse = { - fromJSON(object: any): DisableCommitEpochResponse { - return { - currentVersion: isSet(object.currentVersion) ? HummockVersion.fromJSON(object.currentVersion) : undefined, - }; - }, - - toJSON(message: DisableCommitEpochResponse): unknown { - const obj: any = {}; - message.currentVersion !== undefined && - (obj.currentVersion = message.currentVersion ? HummockVersion.toJSON(message.currentVersion) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): DisableCommitEpochResponse { - const message = createBaseDisableCommitEpochResponse(); - message.currentVersion = (object.currentVersion !== undefined && object.currentVersion !== null) - ? HummockVersion.fromPartial(object.currentVersion) - : undefined; - return message; - }, -}; - -function createBaseRiseCtlListCompactionGroupRequest(): RiseCtlListCompactionGroupRequest { - return {}; -} - -export const RiseCtlListCompactionGroupRequest = { - fromJSON(_: any): RiseCtlListCompactionGroupRequest { - return {}; - }, - - toJSON(_: RiseCtlListCompactionGroupRequest): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>( - _: I, - ): RiseCtlListCompactionGroupRequest { - const message = createBaseRiseCtlListCompactionGroupRequest(); - return message; - }, -}; - -function createBaseRiseCtlListCompactionGroupResponse(): RiseCtlListCompactionGroupResponse { - return { status: undefined, compactionGroups: [] }; -} - -export const RiseCtlListCompactionGroupResponse = { - fromJSON(object: any): RiseCtlListCompactionGroupResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - compactionGroups: Array.isArray(object?.compactionGroups) - ? object.compactionGroups.map((e: any) => CompactionGroupInfo.fromJSON(e)) - : [], - }; - }, - - toJSON(message: RiseCtlListCompactionGroupResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - if (message.compactionGroups) { - obj.compactionGroups = message.compactionGroups.map((e) => e ? CompactionGroupInfo.toJSON(e) : undefined); - } else { - obj.compactionGroups = []; - } - return obj; - }, - - fromPartial, I>>( - object: I, - ): RiseCtlListCompactionGroupResponse { - const message = createBaseRiseCtlListCompactionGroupResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.compactionGroups = object.compactionGroups?.map((e) => CompactionGroupInfo.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseRiseCtlUpdateCompactionConfigRequest(): RiseCtlUpdateCompactionConfigRequest { - return { compactionGroupIds: [], configs: [] }; -} - -export const RiseCtlUpdateCompactionConfigRequest = { - fromJSON(object: any): RiseCtlUpdateCompactionConfigRequest { - return { - compactionGroupIds: Array.isArray(object?.compactionGroupIds) - ? object.compactionGroupIds.map((e: any) => Number(e)) - : [], - configs: Array.isArray(object?.configs) - ? object.configs.map((e: any) => RiseCtlUpdateCompactionConfigRequest_MutableConfig.fromJSON(e)) - : [], - }; - }, - - toJSON(message: RiseCtlUpdateCompactionConfigRequest): unknown { - const obj: any = {}; - if (message.compactionGroupIds) { - obj.compactionGroupIds = message.compactionGroupIds.map((e) => Math.round(e)); - } else { - obj.compactionGroupIds = []; - } - if (message.configs) { - obj.configs = message.configs.map((e) => - e ? RiseCtlUpdateCompactionConfigRequest_MutableConfig.toJSON(e) : undefined - ); - } else { - obj.configs = []; - } - return obj; - }, - - fromPartial, I>>( - object: I, - ): RiseCtlUpdateCompactionConfigRequest { - const message = createBaseRiseCtlUpdateCompactionConfigRequest(); - message.compactionGroupIds = object.compactionGroupIds?.map((e) => e) || []; - message.configs = object.configs?.map((e) => RiseCtlUpdateCompactionConfigRequest_MutableConfig.fromPartial(e)) || - []; - return message; - }, -}; - -function createBaseRiseCtlUpdateCompactionConfigRequest_MutableConfig(): RiseCtlUpdateCompactionConfigRequest_MutableConfig { - return { mutableConfig: undefined }; -} - -export const RiseCtlUpdateCompactionConfigRequest_MutableConfig = { - fromJSON(object: any): RiseCtlUpdateCompactionConfigRequest_MutableConfig { - return { - mutableConfig: isSet(object.maxBytesForLevelBase) - ? { $case: "maxBytesForLevelBase", maxBytesForLevelBase: Number(object.maxBytesForLevelBase) } - : isSet(object.maxBytesForLevelMultiplier) - ? { $case: "maxBytesForLevelMultiplier", maxBytesForLevelMultiplier: Number(object.maxBytesForLevelMultiplier) } - : isSet(object.maxCompactionBytes) - ? { $case: "maxCompactionBytes", maxCompactionBytes: Number(object.maxCompactionBytes) } - : isSet(object.subLevelMaxCompactionBytes) - ? { $case: "subLevelMaxCompactionBytes", subLevelMaxCompactionBytes: Number(object.subLevelMaxCompactionBytes) } - : isSet(object.level0TierCompactFileNumber) - ? { - $case: "level0TierCompactFileNumber", - level0TierCompactFileNumber: Number(object.level0TierCompactFileNumber), - } - : isSet(object.targetFileSizeBase) - ? { $case: "targetFileSizeBase", targetFileSizeBase: Number(object.targetFileSizeBase) } - : isSet(object.compactionFilterMask) - ? { $case: "compactionFilterMask", compactionFilterMask: Number(object.compactionFilterMask) } - : isSet(object.maxSubCompaction) - ? { $case: "maxSubCompaction", maxSubCompaction: Number(object.maxSubCompaction) } - : isSet(object.level0StopWriteThresholdSubLevelNumber) - ? { - $case: "level0StopWriteThresholdSubLevelNumber", - level0StopWriteThresholdSubLevelNumber: Number(object.level0StopWriteThresholdSubLevelNumber), - } - : undefined, - }; - }, - - toJSON(message: RiseCtlUpdateCompactionConfigRequest_MutableConfig): unknown { - const obj: any = {}; - message.mutableConfig?.$case === "maxBytesForLevelBase" && - (obj.maxBytesForLevelBase = Math.round(message.mutableConfig?.maxBytesForLevelBase)); - message.mutableConfig?.$case === "maxBytesForLevelMultiplier" && - (obj.maxBytesForLevelMultiplier = Math.round(message.mutableConfig?.maxBytesForLevelMultiplier)); - message.mutableConfig?.$case === "maxCompactionBytes" && - (obj.maxCompactionBytes = Math.round(message.mutableConfig?.maxCompactionBytes)); - message.mutableConfig?.$case === "subLevelMaxCompactionBytes" && - (obj.subLevelMaxCompactionBytes = Math.round(message.mutableConfig?.subLevelMaxCompactionBytes)); - message.mutableConfig?.$case === "level0TierCompactFileNumber" && - (obj.level0TierCompactFileNumber = Math.round(message.mutableConfig?.level0TierCompactFileNumber)); - message.mutableConfig?.$case === "targetFileSizeBase" && - (obj.targetFileSizeBase = Math.round(message.mutableConfig?.targetFileSizeBase)); - message.mutableConfig?.$case === "compactionFilterMask" && - (obj.compactionFilterMask = Math.round(message.mutableConfig?.compactionFilterMask)); - message.mutableConfig?.$case === "maxSubCompaction" && - (obj.maxSubCompaction = Math.round(message.mutableConfig?.maxSubCompaction)); - message.mutableConfig?.$case === "level0StopWriteThresholdSubLevelNumber" && - (obj.level0StopWriteThresholdSubLevelNumber = Math.round( - message.mutableConfig?.level0StopWriteThresholdSubLevelNumber, - )); - return obj; - }, - - fromPartial, I>>( - object: I, - ): RiseCtlUpdateCompactionConfigRequest_MutableConfig { - const message = createBaseRiseCtlUpdateCompactionConfigRequest_MutableConfig(); - if ( - object.mutableConfig?.$case === "maxBytesForLevelBase" && - object.mutableConfig?.maxBytesForLevelBase !== undefined && - object.mutableConfig?.maxBytesForLevelBase !== null - ) { - message.mutableConfig = { - $case: "maxBytesForLevelBase", - maxBytesForLevelBase: object.mutableConfig.maxBytesForLevelBase, - }; - } - if ( - object.mutableConfig?.$case === "maxBytesForLevelMultiplier" && - object.mutableConfig?.maxBytesForLevelMultiplier !== undefined && - object.mutableConfig?.maxBytesForLevelMultiplier !== null - ) { - message.mutableConfig = { - $case: "maxBytesForLevelMultiplier", - maxBytesForLevelMultiplier: object.mutableConfig.maxBytesForLevelMultiplier, - }; - } - if ( - object.mutableConfig?.$case === "maxCompactionBytes" && - object.mutableConfig?.maxCompactionBytes !== undefined && - object.mutableConfig?.maxCompactionBytes !== null - ) { - message.mutableConfig = { - $case: "maxCompactionBytes", - maxCompactionBytes: object.mutableConfig.maxCompactionBytes, - }; - } - if ( - object.mutableConfig?.$case === "subLevelMaxCompactionBytes" && - object.mutableConfig?.subLevelMaxCompactionBytes !== undefined && - object.mutableConfig?.subLevelMaxCompactionBytes !== null - ) { - message.mutableConfig = { - $case: "subLevelMaxCompactionBytes", - subLevelMaxCompactionBytes: object.mutableConfig.subLevelMaxCompactionBytes, - }; - } - if ( - object.mutableConfig?.$case === "level0TierCompactFileNumber" && - object.mutableConfig?.level0TierCompactFileNumber !== undefined && - object.mutableConfig?.level0TierCompactFileNumber !== null - ) { - message.mutableConfig = { - $case: "level0TierCompactFileNumber", - level0TierCompactFileNumber: object.mutableConfig.level0TierCompactFileNumber, - }; - } - if ( - object.mutableConfig?.$case === "targetFileSizeBase" && - object.mutableConfig?.targetFileSizeBase !== undefined && - object.mutableConfig?.targetFileSizeBase !== null - ) { - message.mutableConfig = { - $case: "targetFileSizeBase", - targetFileSizeBase: object.mutableConfig.targetFileSizeBase, - }; - } - if ( - object.mutableConfig?.$case === "compactionFilterMask" && - object.mutableConfig?.compactionFilterMask !== undefined && - object.mutableConfig?.compactionFilterMask !== null - ) { - message.mutableConfig = { - $case: "compactionFilterMask", - compactionFilterMask: object.mutableConfig.compactionFilterMask, - }; - } - if ( - object.mutableConfig?.$case === "maxSubCompaction" && - object.mutableConfig?.maxSubCompaction !== undefined && - object.mutableConfig?.maxSubCompaction !== null - ) { - message.mutableConfig = { $case: "maxSubCompaction", maxSubCompaction: object.mutableConfig.maxSubCompaction }; - } - if ( - object.mutableConfig?.$case === "level0StopWriteThresholdSubLevelNumber" && - object.mutableConfig?.level0StopWriteThresholdSubLevelNumber !== undefined && - object.mutableConfig?.level0StopWriteThresholdSubLevelNumber !== null - ) { - message.mutableConfig = { - $case: "level0StopWriteThresholdSubLevelNumber", - level0StopWriteThresholdSubLevelNumber: object.mutableConfig.level0StopWriteThresholdSubLevelNumber, - }; - } - return message; - }, -}; - -function createBaseRiseCtlUpdateCompactionConfigResponse(): RiseCtlUpdateCompactionConfigResponse { - return { status: undefined }; -} - -export const RiseCtlUpdateCompactionConfigResponse = { - fromJSON(object: any): RiseCtlUpdateCompactionConfigResponse { - return { status: isSet(object.status) ? Status.fromJSON(object.status) : undefined }; - }, - - toJSON(message: RiseCtlUpdateCompactionConfigResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): RiseCtlUpdateCompactionConfigResponse { - const message = createBaseRiseCtlUpdateCompactionConfigResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - return message; - }, -}; - -function createBaseSetCompactorRuntimeConfigRequest(): SetCompactorRuntimeConfigRequest { - return { contextId: 0, config: undefined }; -} - -export const SetCompactorRuntimeConfigRequest = { - fromJSON(object: any): SetCompactorRuntimeConfigRequest { - return { - contextId: isSet(object.contextId) ? Number(object.contextId) : 0, - config: isSet(object.config) ? CompactorRuntimeConfig.fromJSON(object.config) : undefined, - }; - }, - - toJSON(message: SetCompactorRuntimeConfigRequest): unknown { - const obj: any = {}; - message.contextId !== undefined && (obj.contextId = Math.round(message.contextId)); - message.config !== undefined && - (obj.config = message.config ? CompactorRuntimeConfig.toJSON(message.config) : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): SetCompactorRuntimeConfigRequest { - const message = createBaseSetCompactorRuntimeConfigRequest(); - message.contextId = object.contextId ?? 0; - message.config = (object.config !== undefined && object.config !== null) - ? CompactorRuntimeConfig.fromPartial(object.config) - : undefined; - return message; - }, -}; - -function createBaseSetCompactorRuntimeConfigResponse(): SetCompactorRuntimeConfigResponse { - return {}; -} - -export const SetCompactorRuntimeConfigResponse = { - fromJSON(_: any): SetCompactorRuntimeConfigResponse { - return {}; - }, - - toJSON(_: SetCompactorRuntimeConfigResponse): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>( - _: I, - ): SetCompactorRuntimeConfigResponse { - const message = createBaseSetCompactorRuntimeConfigResponse(); - return message; - }, -}; - -function createBasePinVersionRequest(): PinVersionRequest { - return { contextId: 0 }; -} - -export const PinVersionRequest = { - fromJSON(object: any): PinVersionRequest { - return { contextId: isSet(object.contextId) ? Number(object.contextId) : 0 }; - }, - - toJSON(message: PinVersionRequest): unknown { - const obj: any = {}; - message.contextId !== undefined && (obj.contextId = Math.round(message.contextId)); - return obj; - }, - - fromPartial, I>>(object: I): PinVersionRequest { - const message = createBasePinVersionRequest(); - message.contextId = object.contextId ?? 0; - return message; - }, -}; - -function createBasePinVersionResponse(): PinVersionResponse { - return { pinnedVersion: undefined }; -} - -export const PinVersionResponse = { - fromJSON(object: any): PinVersionResponse { - return { pinnedVersion: isSet(object.pinnedVersion) ? HummockVersion.fromJSON(object.pinnedVersion) : undefined }; - }, - - toJSON(message: PinVersionResponse): unknown { - const obj: any = {}; - message.pinnedVersion !== undefined && - (obj.pinnedVersion = message.pinnedVersion ? HummockVersion.toJSON(message.pinnedVersion) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): PinVersionResponse { - const message = createBasePinVersionResponse(); - message.pinnedVersion = (object.pinnedVersion !== undefined && object.pinnedVersion !== null) - ? HummockVersion.fromPartial(object.pinnedVersion) - : undefined; - return message; - }, -}; - -function createBaseSplitCompactionGroupRequest(): SplitCompactionGroupRequest { - return { groupId: 0, tableIds: [] }; -} - -export const SplitCompactionGroupRequest = { - fromJSON(object: any): SplitCompactionGroupRequest { - return { - groupId: isSet(object.groupId) ? Number(object.groupId) : 0, - tableIds: Array.isArray(object?.tableIds) ? object.tableIds.map((e: any) => Number(e)) : [], - }; - }, - - toJSON(message: SplitCompactionGroupRequest): unknown { - const obj: any = {}; - message.groupId !== undefined && (obj.groupId = Math.round(message.groupId)); - if (message.tableIds) { - obj.tableIds = message.tableIds.map((e) => Math.round(e)); - } else { - obj.tableIds = []; - } - return obj; - }, - - fromPartial, I>>(object: I): SplitCompactionGroupRequest { - const message = createBaseSplitCompactionGroupRequest(); - message.groupId = object.groupId ?? 0; - message.tableIds = object.tableIds?.map((e) => e) || []; - return message; - }, -}; - -function createBaseSplitCompactionGroupResponse(): SplitCompactionGroupResponse { - return { newGroupId: 0 }; -} - -export const SplitCompactionGroupResponse = { - fromJSON(object: any): SplitCompactionGroupResponse { - return { newGroupId: isSet(object.newGroupId) ? Number(object.newGroupId) : 0 }; - }, - - toJSON(message: SplitCompactionGroupResponse): unknown { - const obj: any = {}; - message.newGroupId !== undefined && (obj.newGroupId = Math.round(message.newGroupId)); - return obj; - }, - - fromPartial, I>>(object: I): SplitCompactionGroupResponse { - const message = createBaseSplitCompactionGroupResponse(); - message.newGroupId = object.newGroupId ?? 0; - return message; - }, -}; - -function createBaseCompactionConfig(): CompactionConfig { - return { - maxBytesForLevelBase: 0, - maxLevel: 0, - maxBytesForLevelMultiplier: 0, - maxCompactionBytes: 0, - subLevelMaxCompactionBytes: 0, - level0TierCompactFileNumber: 0, - compactionMode: CompactionConfig_CompactionMode.UNSPECIFIED, - compressionAlgorithm: [], - targetFileSizeBase: 0, - compactionFilterMask: 0, - maxSubCompaction: 0, - maxSpaceReclaimBytes: 0, - splitByStateTable: false, - level0StopWriteThresholdSubLevelNumber: 0, - level0MaxCompactFileNumber: 0, - }; -} - -export const CompactionConfig = { - fromJSON(object: any): CompactionConfig { - return { - maxBytesForLevelBase: isSet(object.maxBytesForLevelBase) ? Number(object.maxBytesForLevelBase) : 0, - maxLevel: isSet(object.maxLevel) ? Number(object.maxLevel) : 0, - maxBytesForLevelMultiplier: isSet(object.maxBytesForLevelMultiplier) - ? Number(object.maxBytesForLevelMultiplier) - : 0, - maxCompactionBytes: isSet(object.maxCompactionBytes) ? Number(object.maxCompactionBytes) : 0, - subLevelMaxCompactionBytes: isSet(object.subLevelMaxCompactionBytes) - ? Number(object.subLevelMaxCompactionBytes) - : 0, - level0TierCompactFileNumber: isSet(object.level0TierCompactFileNumber) - ? Number(object.level0TierCompactFileNumber) - : 0, - compactionMode: isSet(object.compactionMode) - ? compactionConfig_CompactionModeFromJSON(object.compactionMode) - : CompactionConfig_CompactionMode.UNSPECIFIED, - compressionAlgorithm: Array.isArray(object?.compressionAlgorithm) - ? object.compressionAlgorithm.map((e: any) => String(e)) - : [], - targetFileSizeBase: isSet(object.targetFileSizeBase) ? Number(object.targetFileSizeBase) : 0, - compactionFilterMask: isSet(object.compactionFilterMask) ? Number(object.compactionFilterMask) : 0, - maxSubCompaction: isSet(object.maxSubCompaction) ? Number(object.maxSubCompaction) : 0, - maxSpaceReclaimBytes: isSet(object.maxSpaceReclaimBytes) ? Number(object.maxSpaceReclaimBytes) : 0, - splitByStateTable: isSet(object.splitByStateTable) ? Boolean(object.splitByStateTable) : false, - level0StopWriteThresholdSubLevelNumber: isSet(object.level0StopWriteThresholdSubLevelNumber) - ? Number(object.level0StopWriteThresholdSubLevelNumber) - : 0, - level0MaxCompactFileNumber: isSet(object.level0MaxCompactFileNumber) - ? Number(object.level0MaxCompactFileNumber) - : 0, - }; - }, - - toJSON(message: CompactionConfig): unknown { - const obj: any = {}; - message.maxBytesForLevelBase !== undefined && (obj.maxBytesForLevelBase = Math.round(message.maxBytesForLevelBase)); - message.maxLevel !== undefined && (obj.maxLevel = Math.round(message.maxLevel)); - message.maxBytesForLevelMultiplier !== undefined && - (obj.maxBytesForLevelMultiplier = Math.round(message.maxBytesForLevelMultiplier)); - message.maxCompactionBytes !== undefined && (obj.maxCompactionBytes = Math.round(message.maxCompactionBytes)); - message.subLevelMaxCompactionBytes !== undefined && - (obj.subLevelMaxCompactionBytes = Math.round(message.subLevelMaxCompactionBytes)); - message.level0TierCompactFileNumber !== undefined && - (obj.level0TierCompactFileNumber = Math.round(message.level0TierCompactFileNumber)); - message.compactionMode !== undefined && - (obj.compactionMode = compactionConfig_CompactionModeToJSON(message.compactionMode)); - if (message.compressionAlgorithm) { - obj.compressionAlgorithm = message.compressionAlgorithm.map((e) => e); - } else { - obj.compressionAlgorithm = []; - } - message.targetFileSizeBase !== undefined && (obj.targetFileSizeBase = Math.round(message.targetFileSizeBase)); - message.compactionFilterMask !== undefined && (obj.compactionFilterMask = Math.round(message.compactionFilterMask)); - message.maxSubCompaction !== undefined && (obj.maxSubCompaction = Math.round(message.maxSubCompaction)); - message.maxSpaceReclaimBytes !== undefined && (obj.maxSpaceReclaimBytes = Math.round(message.maxSpaceReclaimBytes)); - message.splitByStateTable !== undefined && (obj.splitByStateTable = message.splitByStateTable); - message.level0StopWriteThresholdSubLevelNumber !== undefined && - (obj.level0StopWriteThresholdSubLevelNumber = Math.round(message.level0StopWriteThresholdSubLevelNumber)); - message.level0MaxCompactFileNumber !== undefined && - (obj.level0MaxCompactFileNumber = Math.round(message.level0MaxCompactFileNumber)); - return obj; - }, - - fromPartial, I>>(object: I): CompactionConfig { - const message = createBaseCompactionConfig(); - message.maxBytesForLevelBase = object.maxBytesForLevelBase ?? 0; - message.maxLevel = object.maxLevel ?? 0; - message.maxBytesForLevelMultiplier = object.maxBytesForLevelMultiplier ?? 0; - message.maxCompactionBytes = object.maxCompactionBytes ?? 0; - message.subLevelMaxCompactionBytes = object.subLevelMaxCompactionBytes ?? 0; - message.level0TierCompactFileNumber = object.level0TierCompactFileNumber ?? 0; - message.compactionMode = object.compactionMode ?? CompactionConfig_CompactionMode.UNSPECIFIED; - message.compressionAlgorithm = object.compressionAlgorithm?.map((e) => e) || []; - message.targetFileSizeBase = object.targetFileSizeBase ?? 0; - message.compactionFilterMask = object.compactionFilterMask ?? 0; - message.maxSubCompaction = object.maxSubCompaction ?? 0; - message.maxSpaceReclaimBytes = object.maxSpaceReclaimBytes ?? 0; - message.splitByStateTable = object.splitByStateTable ?? false; - message.level0StopWriteThresholdSubLevelNumber = object.level0StopWriteThresholdSubLevelNumber ?? 0; - message.level0MaxCompactFileNumber = object.level0MaxCompactFileNumber ?? 0; - return message; - }, -}; - -function createBaseTableStats(): TableStats { - return { totalKeySize: 0, totalValueSize: 0, totalKeyCount: 0 }; -} - -export const TableStats = { - fromJSON(object: any): TableStats { - return { - totalKeySize: isSet(object.totalKeySize) ? Number(object.totalKeySize) : 0, - totalValueSize: isSet(object.totalValueSize) ? Number(object.totalValueSize) : 0, - totalKeyCount: isSet(object.totalKeyCount) ? Number(object.totalKeyCount) : 0, - }; - }, - - toJSON(message: TableStats): unknown { - const obj: any = {}; - message.totalKeySize !== undefined && (obj.totalKeySize = Math.round(message.totalKeySize)); - message.totalValueSize !== undefined && (obj.totalValueSize = Math.round(message.totalValueSize)); - message.totalKeyCount !== undefined && (obj.totalKeyCount = Math.round(message.totalKeyCount)); - return obj; - }, - - fromPartial, I>>(object: I): TableStats { - const message = createBaseTableStats(); - message.totalKeySize = object.totalKeySize ?? 0; - message.totalValueSize = object.totalValueSize ?? 0; - message.totalKeyCount = object.totalKeyCount ?? 0; - return message; - }, -}; - -function createBaseHummockVersionStats(): HummockVersionStats { - return { hummockVersionId: 0, tableStats: {} }; -} - -export const HummockVersionStats = { - fromJSON(object: any): HummockVersionStats { - return { - hummockVersionId: isSet(object.hummockVersionId) ? Number(object.hummockVersionId) : 0, - tableStats: isObject(object.tableStats) - ? Object.entries(object.tableStats).reduce<{ [key: number]: TableStats }>((acc, [key, value]) => { - acc[Number(key)] = TableStats.fromJSON(value); - return acc; - }, {}) - : {}, - }; - }, - - toJSON(message: HummockVersionStats): unknown { - const obj: any = {}; - message.hummockVersionId !== undefined && (obj.hummockVersionId = Math.round(message.hummockVersionId)); - obj.tableStats = {}; - if (message.tableStats) { - Object.entries(message.tableStats).forEach(([k, v]) => { - obj.tableStats[k] = TableStats.toJSON(v); - }); - } - return obj; - }, - - fromPartial, I>>(object: I): HummockVersionStats { - const message = createBaseHummockVersionStats(); - message.hummockVersionId = object.hummockVersionId ?? 0; - message.tableStats = Object.entries(object.tableStats ?? {}).reduce<{ [key: number]: TableStats }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[Number(key)] = TableStats.fromPartial(value); - } - return acc; - }, - {}, - ); - return message; - }, -}; - -function createBaseHummockVersionStats_TableStatsEntry(): HummockVersionStats_TableStatsEntry { - return { key: 0, value: undefined }; -} - -export const HummockVersionStats_TableStatsEntry = { - fromJSON(object: any): HummockVersionStats_TableStatsEntry { - return { - key: isSet(object.key) ? Number(object.key) : 0, - value: isSet(object.value) ? TableStats.fromJSON(object.value) : undefined, - }; - }, - - toJSON(message: HummockVersionStats_TableStatsEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = Math.round(message.key)); - message.value !== undefined && (obj.value = message.value ? TableStats.toJSON(message.value) : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): HummockVersionStats_TableStatsEntry { - const message = createBaseHummockVersionStats_TableStatsEntry(); - message.key = object.key ?? 0; - message.value = (object.value !== undefined && object.value !== null) - ? TableStats.fromPartial(object.value) - : undefined; - return message; - }, -}; - -function createBaseGetScaleCompactorRequest(): GetScaleCompactorRequest { - return {}; -} - -export const GetScaleCompactorRequest = { - fromJSON(_: any): GetScaleCompactorRequest { - return {}; - }, - - toJSON(_: GetScaleCompactorRequest): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): GetScaleCompactorRequest { - const message = createBaseGetScaleCompactorRequest(); - return message; - }, -}; - -function createBaseGetScaleCompactorResponse(): GetScaleCompactorResponse { - return { suggestCores: 0, runningCores: 0, totalCores: 0, waitingCompactionBytes: 0 }; -} - -export const GetScaleCompactorResponse = { - fromJSON(object: any): GetScaleCompactorResponse { - return { - suggestCores: isSet(object.suggestCores) ? Number(object.suggestCores) : 0, - runningCores: isSet(object.runningCores) ? Number(object.runningCores) : 0, - totalCores: isSet(object.totalCores) ? Number(object.totalCores) : 0, - waitingCompactionBytes: isSet(object.waitingCompactionBytes) ? Number(object.waitingCompactionBytes) : 0, - }; - }, - - toJSON(message: GetScaleCompactorResponse): unknown { - const obj: any = {}; - message.suggestCores !== undefined && (obj.suggestCores = Math.round(message.suggestCores)); - message.runningCores !== undefined && (obj.runningCores = Math.round(message.runningCores)); - message.totalCores !== undefined && (obj.totalCores = Math.round(message.totalCores)); - message.waitingCompactionBytes !== undefined && - (obj.waitingCompactionBytes = Math.round(message.waitingCompactionBytes)); - return obj; - }, - - fromPartial, I>>(object: I): GetScaleCompactorResponse { - const message = createBaseGetScaleCompactorResponse(); - message.suggestCores = object.suggestCores ?? 0; - message.runningCores = object.runningCores ?? 0; - message.totalCores = object.totalCores ?? 0; - message.waitingCompactionBytes = object.waitingCompactionBytes ?? 0; - return message; - }, -}; - -function createBaseWriteLimits(): WriteLimits { - return { writeLimits: {} }; -} - -export const WriteLimits = { - fromJSON(object: any): WriteLimits { - return { - writeLimits: isObject(object.writeLimits) - ? Object.entries(object.writeLimits).reduce<{ [key: number]: WriteLimits_WriteLimit }>((acc, [key, value]) => { - acc[Number(key)] = WriteLimits_WriteLimit.fromJSON(value); - return acc; - }, {}) - : {}, - }; - }, - - toJSON(message: WriteLimits): unknown { - const obj: any = {}; - obj.writeLimits = {}; - if (message.writeLimits) { - Object.entries(message.writeLimits).forEach(([k, v]) => { - obj.writeLimits[k] = WriteLimits_WriteLimit.toJSON(v); - }); - } - return obj; - }, - - fromPartial, I>>(object: I): WriteLimits { - const message = createBaseWriteLimits(); - message.writeLimits = Object.entries(object.writeLimits ?? {}).reduce<{ [key: number]: WriteLimits_WriteLimit }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[Number(key)] = WriteLimits_WriteLimit.fromPartial(value); - } - return acc; - }, - {}, - ); - return message; - }, -}; - -function createBaseWriteLimits_WriteLimit(): WriteLimits_WriteLimit { - return { tableIds: [], reason: "" }; -} - -export const WriteLimits_WriteLimit = { - fromJSON(object: any): WriteLimits_WriteLimit { - return { - tableIds: Array.isArray(object?.tableIds) ? object.tableIds.map((e: any) => Number(e)) : [], - reason: isSet(object.reason) ? String(object.reason) : "", - }; - }, - - toJSON(message: WriteLimits_WriteLimit): unknown { - const obj: any = {}; - if (message.tableIds) { - obj.tableIds = message.tableIds.map((e) => Math.round(e)); - } else { - obj.tableIds = []; - } - message.reason !== undefined && (obj.reason = message.reason); - return obj; - }, - - fromPartial, I>>(object: I): WriteLimits_WriteLimit { - const message = createBaseWriteLimits_WriteLimit(); - message.tableIds = object.tableIds?.map((e) => e) || []; - message.reason = object.reason ?? ""; - return message; - }, -}; - -function createBaseWriteLimits_WriteLimitsEntry(): WriteLimits_WriteLimitsEntry { - return { key: 0, value: undefined }; -} - -export const WriteLimits_WriteLimitsEntry = { - fromJSON(object: any): WriteLimits_WriteLimitsEntry { - return { - key: isSet(object.key) ? Number(object.key) : 0, - value: isSet(object.value) ? WriteLimits_WriteLimit.fromJSON(object.value) : undefined, - }; - }, - - toJSON(message: WriteLimits_WriteLimitsEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = Math.round(message.key)); - message.value !== undefined && - (obj.value = message.value ? WriteLimits_WriteLimit.toJSON(message.value) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): WriteLimits_WriteLimitsEntry { - const message = createBaseWriteLimits_WriteLimitsEntry(); - message.key = object.key ?? 0; - message.value = (object.value !== undefined && object.value !== null) - ? WriteLimits_WriteLimit.fromPartial(object.value) - : undefined; - return message; - }, -}; - -declare var self: any | undefined; -declare var window: any | undefined; -declare var global: any | undefined; -var globalThis: any = (() => { - if (typeof globalThis !== "undefined") { - return globalThis; - } - if (typeof self !== "undefined") { - return self; - } - if (typeof window !== "undefined") { - return window; - } - if (typeof global !== "undefined") { - return global; - } - throw "Unable to locate global object"; -})(); - -function bytesFromBase64(b64: string): Uint8Array { - if (globalThis.Buffer) { - return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); - } else { - const bin = globalThis.atob(b64); - const arr = new Uint8Array(bin.length); - for (let i = 0; i < bin.length; ++i) { - arr[i] = bin.charCodeAt(i); - } - return arr; - } -} - -function base64FromBytes(arr: Uint8Array): string { - if (globalThis.Buffer) { - return globalThis.Buffer.from(arr).toString("base64"); - } else { - const bin: string[] = []; - arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); - }); - return globalThis.btoa(bin.join("")); - } -} - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> - : T extends { $case: string } ? { [K in keyof Omit]?: DeepPartial } & { $case: T["$case"] } - : T extends {} ? { [K in keyof T]?: DeepPartial } - : Partial; - -type KeysOfUnion = T extends T ? keyof T : never; -export type Exact = P extends Builtin ? P - : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; - -function isObject(value: any): boolean { - return typeof value === "object" && value !== null; -} - -function isSet(value: any): boolean { - return value !== null && value !== undefined; -} diff --git a/dashboard/proto/gen/java_binding.ts b/dashboard/proto/gen/java_binding.ts deleted file mode 100644 index 5cc7e19adaf8..000000000000 --- a/dashboard/proto/gen/java_binding.ts +++ /dev/null @@ -1,237 +0,0 @@ -/* eslint-disable */ -import { Table } from "./catalog"; -import { HummockVersion } from "./hummock"; - -export const protobufPackage = "java_binding"; - -/** When `left` or `right` is none, it represents unbounded. */ -export interface KeyRange { - left: Uint8Array; - right: Uint8Array; - leftBound: KeyRange_Bound; - rightBound: KeyRange_Bound; -} - -export const KeyRange_Bound = { - UNSPECIFIED: "UNSPECIFIED", - UNBOUNDED: "UNBOUNDED", - INCLUDED: "INCLUDED", - EXCLUDED: "EXCLUDED", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type KeyRange_Bound = typeof KeyRange_Bound[keyof typeof KeyRange_Bound]; - -export function keyRange_BoundFromJSON(object: any): KeyRange_Bound { - switch (object) { - case 0: - case "UNSPECIFIED": - return KeyRange_Bound.UNSPECIFIED; - case 1: - case "UNBOUNDED": - return KeyRange_Bound.UNBOUNDED; - case 2: - case "INCLUDED": - return KeyRange_Bound.INCLUDED; - case 3: - case "EXCLUDED": - return KeyRange_Bound.EXCLUDED; - case -1: - case "UNRECOGNIZED": - default: - return KeyRange_Bound.UNRECOGNIZED; - } -} - -export function keyRange_BoundToJSON(object: KeyRange_Bound): string { - switch (object) { - case KeyRange_Bound.UNSPECIFIED: - return "UNSPECIFIED"; - case KeyRange_Bound.UNBOUNDED: - return "UNBOUNDED"; - case KeyRange_Bound.INCLUDED: - return "INCLUDED"; - case KeyRange_Bound.EXCLUDED: - return "EXCLUDED"; - case KeyRange_Bound.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export interface ReadPlan { - objectStoreUrl: string; - dataDir: string; - keyRange: KeyRange | undefined; - tableId: number; - epoch: number; - version: HummockVersion | undefined; - tableCatalog: Table | undefined; - vnodeIds: number[]; -} - -function createBaseKeyRange(): KeyRange { - return { - left: new Uint8Array(), - right: new Uint8Array(), - leftBound: KeyRange_Bound.UNSPECIFIED, - rightBound: KeyRange_Bound.UNSPECIFIED, - }; -} - -export const KeyRange = { - fromJSON(object: any): KeyRange { - return { - left: isSet(object.left) ? bytesFromBase64(object.left) : new Uint8Array(), - right: isSet(object.right) ? bytesFromBase64(object.right) : new Uint8Array(), - leftBound: isSet(object.leftBound) ? keyRange_BoundFromJSON(object.leftBound) : KeyRange_Bound.UNSPECIFIED, - rightBound: isSet(object.rightBound) ? keyRange_BoundFromJSON(object.rightBound) : KeyRange_Bound.UNSPECIFIED, - }; - }, - - toJSON(message: KeyRange): unknown { - const obj: any = {}; - message.left !== undefined && - (obj.left = base64FromBytes(message.left !== undefined ? message.left : new Uint8Array())); - message.right !== undefined && - (obj.right = base64FromBytes(message.right !== undefined ? message.right : new Uint8Array())); - message.leftBound !== undefined && (obj.leftBound = keyRange_BoundToJSON(message.leftBound)); - message.rightBound !== undefined && (obj.rightBound = keyRange_BoundToJSON(message.rightBound)); - return obj; - }, - - fromPartial, I>>(object: I): KeyRange { - const message = createBaseKeyRange(); - message.left = object.left ?? new Uint8Array(); - message.right = object.right ?? new Uint8Array(); - message.leftBound = object.leftBound ?? KeyRange_Bound.UNSPECIFIED; - message.rightBound = object.rightBound ?? KeyRange_Bound.UNSPECIFIED; - return message; - }, -}; - -function createBaseReadPlan(): ReadPlan { - return { - objectStoreUrl: "", - dataDir: "", - keyRange: undefined, - tableId: 0, - epoch: 0, - version: undefined, - tableCatalog: undefined, - vnodeIds: [], - }; -} - -export const ReadPlan = { - fromJSON(object: any): ReadPlan { - return { - objectStoreUrl: isSet(object.objectStoreUrl) ? String(object.objectStoreUrl) : "", - dataDir: isSet(object.dataDir) ? String(object.dataDir) : "", - keyRange: isSet(object.keyRange) ? KeyRange.fromJSON(object.keyRange) : undefined, - tableId: isSet(object.tableId) ? Number(object.tableId) : 0, - epoch: isSet(object.epoch) ? Number(object.epoch) : 0, - version: isSet(object.version) ? HummockVersion.fromJSON(object.version) : undefined, - tableCatalog: isSet(object.tableCatalog) ? Table.fromJSON(object.tableCatalog) : undefined, - vnodeIds: Array.isArray(object?.vnodeIds) ? object.vnodeIds.map((e: any) => Number(e)) : [], - }; - }, - - toJSON(message: ReadPlan): unknown { - const obj: any = {}; - message.objectStoreUrl !== undefined && (obj.objectStoreUrl = message.objectStoreUrl); - message.dataDir !== undefined && (obj.dataDir = message.dataDir); - message.keyRange !== undefined && (obj.keyRange = message.keyRange ? KeyRange.toJSON(message.keyRange) : undefined); - message.tableId !== undefined && (obj.tableId = Math.round(message.tableId)); - message.epoch !== undefined && (obj.epoch = Math.round(message.epoch)); - message.version !== undefined && - (obj.version = message.version ? HummockVersion.toJSON(message.version) : undefined); - message.tableCatalog !== undefined && - (obj.tableCatalog = message.tableCatalog ? Table.toJSON(message.tableCatalog) : undefined); - if (message.vnodeIds) { - obj.vnodeIds = message.vnodeIds.map((e) => Math.round(e)); - } else { - obj.vnodeIds = []; - } - return obj; - }, - - fromPartial, I>>(object: I): ReadPlan { - const message = createBaseReadPlan(); - message.objectStoreUrl = object.objectStoreUrl ?? ""; - message.dataDir = object.dataDir ?? ""; - message.keyRange = (object.keyRange !== undefined && object.keyRange !== null) - ? KeyRange.fromPartial(object.keyRange) - : undefined; - message.tableId = object.tableId ?? 0; - message.epoch = object.epoch ?? 0; - message.version = (object.version !== undefined && object.version !== null) - ? HummockVersion.fromPartial(object.version) - : undefined; - message.tableCatalog = (object.tableCatalog !== undefined && object.tableCatalog !== null) - ? Table.fromPartial(object.tableCatalog) - : undefined; - message.vnodeIds = object.vnodeIds?.map((e) => e) || []; - return message; - }, -}; - -declare var self: any | undefined; -declare var window: any | undefined; -declare var global: any | undefined; -var globalThis: any = (() => { - if (typeof globalThis !== "undefined") { - return globalThis; - } - if (typeof self !== "undefined") { - return self; - } - if (typeof window !== "undefined") { - return window; - } - if (typeof global !== "undefined") { - return global; - } - throw "Unable to locate global object"; -})(); - -function bytesFromBase64(b64: string): Uint8Array { - if (globalThis.Buffer) { - return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); - } else { - const bin = globalThis.atob(b64); - const arr = new Uint8Array(bin.length); - for (let i = 0; i < bin.length; ++i) { - arr[i] = bin.charCodeAt(i); - } - return arr; - } -} - -function base64FromBytes(arr: Uint8Array): string { - if (globalThis.Buffer) { - return globalThis.Buffer.from(arr).toString("base64"); - } else { - const bin: string[] = []; - arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); - }); - return globalThis.btoa(bin.join("")); - } -} - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> - : T extends { $case: string } ? { [K in keyof Omit]?: DeepPartial } & { $case: T["$case"] } - : T extends {} ? { [K in keyof T]?: DeepPartial } - : Partial; - -type KeysOfUnion = T extends T ? keyof T : never; -export type Exact = P extends Builtin ? P - : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; - -function isSet(value: any): boolean { - return value !== null && value !== undefined; -} diff --git a/dashboard/proto/gen/meta.ts b/dashboard/proto/gen/meta.ts deleted file mode 100644 index 22a8a13cc0f6..000000000000 --- a/dashboard/proto/gen/meta.ts +++ /dev/null @@ -1,2719 +0,0 @@ -/* eslint-disable */ -import { MetaBackupManifestId } from "./backup_service"; -import { Database, Function, Index, Schema, Sink, Source, Table, View } from "./catalog"; -import { - HostAddress, - ParallelUnit, - ParallelUnitMapping, - Status, - WorkerNode, - WorkerType, - workerTypeFromJSON, - workerTypeToJSON, -} from "./common"; -import { HummockSnapshot, HummockVersion, HummockVersionDeltas, WriteLimits } from "./hummock"; -import { ConnectorSplits } from "./source"; -import { Dispatcher, StreamActor, StreamEnvironment, StreamNode } from "./stream_plan"; -import { UserInfo } from "./user"; - -export const protobufPackage = "meta"; - -export const SubscribeType = { - UNSPECIFIED: "UNSPECIFIED", - FRONTEND: "FRONTEND", - HUMMOCK: "HUMMOCK", - COMPACTOR: "COMPACTOR", - COMPUTE: "COMPUTE", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type SubscribeType = typeof SubscribeType[keyof typeof SubscribeType]; - -export function subscribeTypeFromJSON(object: any): SubscribeType { - switch (object) { - case 0: - case "UNSPECIFIED": - return SubscribeType.UNSPECIFIED; - case 1: - case "FRONTEND": - return SubscribeType.FRONTEND; - case 2: - case "HUMMOCK": - return SubscribeType.HUMMOCK; - case 3: - case "COMPACTOR": - return SubscribeType.COMPACTOR; - case 4: - case "COMPUTE": - return SubscribeType.COMPUTE; - case -1: - case "UNRECOGNIZED": - default: - return SubscribeType.UNRECOGNIZED; - } -} - -export function subscribeTypeToJSON(object: SubscribeType): string { - switch (object) { - case SubscribeType.UNSPECIFIED: - return "UNSPECIFIED"; - case SubscribeType.FRONTEND: - return "FRONTEND"; - case SubscribeType.HUMMOCK: - return "HUMMOCK"; - case SubscribeType.COMPACTOR: - return "COMPACTOR"; - case SubscribeType.COMPUTE: - return "COMPUTE"; - case SubscribeType.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export interface GetTelemetryInfoRequest { -} - -export interface TelemetryInfoResponse { - trackingId?: string | undefined; -} - -export interface HeartbeatRequest { - nodeId: number; - /** Lightweight info piggybacked by heartbeat request. */ - info: HeartbeatRequest_ExtraInfo[]; -} - -export interface HeartbeatRequest_ExtraInfo { - info?: { $case: "hummockGcWatermark"; hummockGcWatermark: number }; -} - -export interface HeartbeatResponse { - status: Status | undefined; -} - -/** Fragments of a Streaming Job */ -export interface TableFragments { - tableId: number; - state: TableFragments_State; - fragments: { [key: number]: TableFragments_Fragment }; - actorStatus: { [key: number]: TableFragments_ActorStatus }; - actorSplits: { [key: number]: ConnectorSplits }; - env: StreamEnvironment | undefined; -} - -/** The state of the fragments of this table */ -export const TableFragments_State = { - UNSPECIFIED: "UNSPECIFIED", - /** INITIAL - The streaming job is initial. */ - INITIAL: "INITIAL", - /** CREATING - The streaming job is creating. */ - CREATING: "CREATING", - /** CREATED - The streaming job has been created. */ - CREATED: "CREATED", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type TableFragments_State = typeof TableFragments_State[keyof typeof TableFragments_State]; - -export function tableFragments_StateFromJSON(object: any): TableFragments_State { - switch (object) { - case 0: - case "UNSPECIFIED": - return TableFragments_State.UNSPECIFIED; - case 1: - case "INITIAL": - return TableFragments_State.INITIAL; - case 2: - case "CREATING": - return TableFragments_State.CREATING; - case 3: - case "CREATED": - return TableFragments_State.CREATED; - case -1: - case "UNRECOGNIZED": - default: - return TableFragments_State.UNRECOGNIZED; - } -} - -export function tableFragments_StateToJSON(object: TableFragments_State): string { - switch (object) { - case TableFragments_State.UNSPECIFIED: - return "UNSPECIFIED"; - case TableFragments_State.INITIAL: - return "INITIAL"; - case TableFragments_State.CREATING: - return "CREATING"; - case TableFragments_State.CREATED: - return "CREATED"; - case TableFragments_State.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -/** Runtime information of an actor */ -export interface TableFragments_ActorStatus { - /** Current on which parallel unit */ - parallelUnit: - | ParallelUnit - | undefined; - /** Current state */ - state: TableFragments_ActorStatus_ActorState; -} - -/** Current state of actor */ -export const TableFragments_ActorStatus_ActorState = { - UNSPECIFIED: "UNSPECIFIED", - /** INACTIVE - Initial state after creation */ - INACTIVE: "INACTIVE", - /** RUNNING - Running normally */ - RUNNING: "RUNNING", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type TableFragments_ActorStatus_ActorState = - typeof TableFragments_ActorStatus_ActorState[keyof typeof TableFragments_ActorStatus_ActorState]; - -export function tableFragments_ActorStatus_ActorStateFromJSON(object: any): TableFragments_ActorStatus_ActorState { - switch (object) { - case 0: - case "UNSPECIFIED": - return TableFragments_ActorStatus_ActorState.UNSPECIFIED; - case 1: - case "INACTIVE": - return TableFragments_ActorStatus_ActorState.INACTIVE; - case 2: - case "RUNNING": - return TableFragments_ActorStatus_ActorState.RUNNING; - case -1: - case "UNRECOGNIZED": - default: - return TableFragments_ActorStatus_ActorState.UNRECOGNIZED; - } -} - -export function tableFragments_ActorStatus_ActorStateToJSON(object: TableFragments_ActorStatus_ActorState): string { - switch (object) { - case TableFragments_ActorStatus_ActorState.UNSPECIFIED: - return "UNSPECIFIED"; - case TableFragments_ActorStatus_ActorState.INACTIVE: - return "INACTIVE"; - case TableFragments_ActorStatus_ActorState.RUNNING: - return "RUNNING"; - case TableFragments_ActorStatus_ActorState.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export interface TableFragments_Fragment { - fragmentId: number; - /** Bitwise-OR of FragmentTypeFlags */ - fragmentTypeMask: number; - distributionType: TableFragments_Fragment_FragmentDistributionType; - actors: StreamActor[]; - /** - * Vnode mapping (which should be set in upstream dispatcher) of the fragment. - * This field is always set to `Some`. For singleton, the parallel unit for all vnodes will be the same. - */ - vnodeMapping: ParallelUnitMapping | undefined; - stateTableIds: number[]; - /** - * Note that this can be derived backwards from the upstream actors of the Actor held by the Fragment, - * but in some scenarios (e.g. Scaling) it will lead to a lot of duplicate code, - * so we pre-generate and store it here, this member will only be initialized when creating the Fragment - * and modified when creating the mv-on-mv - */ - upstreamFragmentIds: number[]; -} - -export const TableFragments_Fragment_FragmentDistributionType = { - UNSPECIFIED: "UNSPECIFIED", - SINGLE: "SINGLE", - HASH: "HASH", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type TableFragments_Fragment_FragmentDistributionType = - typeof TableFragments_Fragment_FragmentDistributionType[ - keyof typeof TableFragments_Fragment_FragmentDistributionType - ]; - -export function tableFragments_Fragment_FragmentDistributionTypeFromJSON( - object: any, -): TableFragments_Fragment_FragmentDistributionType { - switch (object) { - case 0: - case "UNSPECIFIED": - return TableFragments_Fragment_FragmentDistributionType.UNSPECIFIED; - case 1: - case "SINGLE": - return TableFragments_Fragment_FragmentDistributionType.SINGLE; - case 2: - case "HASH": - return TableFragments_Fragment_FragmentDistributionType.HASH; - case -1: - case "UNRECOGNIZED": - default: - return TableFragments_Fragment_FragmentDistributionType.UNRECOGNIZED; - } -} - -export function tableFragments_Fragment_FragmentDistributionTypeToJSON( - object: TableFragments_Fragment_FragmentDistributionType, -): string { - switch (object) { - case TableFragments_Fragment_FragmentDistributionType.UNSPECIFIED: - return "UNSPECIFIED"; - case TableFragments_Fragment_FragmentDistributionType.SINGLE: - return "SINGLE"; - case TableFragments_Fragment_FragmentDistributionType.HASH: - return "HASH"; - case TableFragments_Fragment_FragmentDistributionType.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export interface TableFragments_FragmentsEntry { - key: number; - value: TableFragments_Fragment | undefined; -} - -export interface TableFragments_ActorStatusEntry { - key: number; - value: TableFragments_ActorStatus | undefined; -} - -export interface TableFragments_ActorSplitsEntry { - key: number; - value: ConnectorSplits | undefined; -} - -/** / Parallel unit mapping with fragment id, used for notification. */ -export interface FragmentParallelUnitMapping { - fragmentId: number; - mapping: ParallelUnitMapping | undefined; -} - -/** TODO: remove this when dashboard refactored. */ -export interface ActorLocation { - node: WorkerNode | undefined; - actors: StreamActor[]; -} - -export interface FlushRequest { - checkpoint: boolean; -} - -export interface FlushResponse { - status: Status | undefined; - snapshot: HummockSnapshot | undefined; -} - -export interface CreatingJobInfo { - databaseId: number; - schemaId: number; - name: string; -} - -export interface CancelCreatingJobsRequest { - infos: CreatingJobInfo[]; -} - -export interface CancelCreatingJobsResponse { - status: Status | undefined; -} - -export interface ListTableFragmentsRequest { - tableIds: number[]; -} - -export interface ListTableFragmentsResponse { - tableFragments: { [key: number]: ListTableFragmentsResponse_TableFragmentInfo }; -} - -export interface ListTableFragmentsResponse_ActorInfo { - id: number; - node: StreamNode | undefined; - dispatcher: Dispatcher[]; -} - -export interface ListTableFragmentsResponse_FragmentInfo { - id: number; - actors: ListTableFragmentsResponse_ActorInfo[]; -} - -export interface ListTableFragmentsResponse_TableFragmentInfo { - fragments: ListTableFragmentsResponse_FragmentInfo[]; - env: StreamEnvironment | undefined; -} - -export interface ListTableFragmentsResponse_TableFragmentsEntry { - key: number; - value: ListTableFragmentsResponse_TableFragmentInfo | undefined; -} - -export interface AddWorkerNodeRequest { - workerType: WorkerType; - host: HostAddress | undefined; - workerNodeParallelism: number; -} - -export interface AddWorkerNodeResponse { - status: Status | undefined; - node: WorkerNode | undefined; -} - -export interface ActivateWorkerNodeRequest { - host: HostAddress | undefined; -} - -export interface ActivateWorkerNodeResponse { - status: Status | undefined; -} - -export interface DeleteWorkerNodeRequest { - host: HostAddress | undefined; -} - -export interface DeleteWorkerNodeResponse { - status: Status | undefined; -} - -export interface ListAllNodesRequest { - workerType: WorkerType; - /** Whether to include nodes still starting */ - includeStartingNodes: boolean; -} - -export interface ListAllNodesResponse { - status: Status | undefined; - nodes: WorkerNode[]; -} - -/** Below for notification service. */ -export interface SubscribeRequest { - subscribeType: SubscribeType; - host: HostAddress | undefined; - workerId: number; -} - -export interface MetaSnapshot { - databases: Database[]; - schemas: Schema[]; - sources: Source[]; - sinks: Sink[]; - tables: Table[]; - indexes: Index[]; - views: View[]; - functions: Function[]; - users: UserInfo[]; - parallelUnitMappings: FragmentParallelUnitMapping[]; - nodes: WorkerNode[]; - hummockSnapshot: HummockSnapshot | undefined; - hummockVersion: HummockVersion | undefined; - metaBackupManifestId: MetaBackupManifestId | undefined; - hummockWriteLimits: WriteLimits | undefined; - version: MetaSnapshot_SnapshotVersion | undefined; -} - -export interface MetaSnapshot_SnapshotVersion { - catalogVersion: number; - parallelUnitMappingVersion: number; - workerNodeVersion: number; -} - -export interface SubscribeResponse { - status: Status | undefined; - operation: SubscribeResponse_Operation; - version: number; - info?: - | { $case: "database"; database: Database } - | { $case: "schema"; schema: Schema } - | { $case: "table"; table: Table } - | { $case: "source"; source: Source } - | { $case: "sink"; sink: Sink } - | { $case: "index"; index: Index } - | { $case: "view"; view: View } - | { $case: "function"; function: Function } - | { $case: "user"; user: UserInfo } - | { $case: "parallelUnitMapping"; parallelUnitMapping: FragmentParallelUnitMapping } - | { $case: "node"; node: WorkerNode } - | { $case: "hummockSnapshot"; hummockSnapshot: HummockSnapshot } - | { $case: "hummockVersionDeltas"; hummockVersionDeltas: HummockVersionDeltas } - | { $case: "snapshot"; snapshot: MetaSnapshot } - | { $case: "metaBackupManifestId"; metaBackupManifestId: MetaBackupManifestId } - | { $case: "systemParams"; systemParams: SystemParams } - | { $case: "hummockWriteLimits"; hummockWriteLimits: WriteLimits }; -} - -export const SubscribeResponse_Operation = { - UNSPECIFIED: "UNSPECIFIED", - ADD: "ADD", - DELETE: "DELETE", - UPDATE: "UPDATE", - SNAPSHOT: "SNAPSHOT", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type SubscribeResponse_Operation = typeof SubscribeResponse_Operation[keyof typeof SubscribeResponse_Operation]; - -export function subscribeResponse_OperationFromJSON(object: any): SubscribeResponse_Operation { - switch (object) { - case 0: - case "UNSPECIFIED": - return SubscribeResponse_Operation.UNSPECIFIED; - case 1: - case "ADD": - return SubscribeResponse_Operation.ADD; - case 2: - case "DELETE": - return SubscribeResponse_Operation.DELETE; - case 3: - case "UPDATE": - return SubscribeResponse_Operation.UPDATE; - case 4: - case "SNAPSHOT": - return SubscribeResponse_Operation.SNAPSHOT; - case -1: - case "UNRECOGNIZED": - default: - return SubscribeResponse_Operation.UNRECOGNIZED; - } -} - -export function subscribeResponse_OperationToJSON(object: SubscribeResponse_Operation): string { - switch (object) { - case SubscribeResponse_Operation.UNSPECIFIED: - return "UNSPECIFIED"; - case SubscribeResponse_Operation.ADD: - return "ADD"; - case SubscribeResponse_Operation.DELETE: - return "DELETE"; - case SubscribeResponse_Operation.UPDATE: - return "UPDATE"; - case SubscribeResponse_Operation.SNAPSHOT: - return "SNAPSHOT"; - case SubscribeResponse_Operation.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export interface PauseRequest { -} - -export interface PauseResponse { -} - -export interface ResumeRequest { -} - -export interface ResumeResponse { -} - -export interface GetClusterInfoRequest { -} - -export interface GetClusterInfoResponse { - workerNodes: WorkerNode[]; - tableFragments: TableFragments[]; - actorSplits: { [key: number]: ConnectorSplits }; - sourceInfos: { [key: number]: Source }; -} - -export interface GetClusterInfoResponse_ActorSplitsEntry { - key: number; - value: ConnectorSplits | undefined; -} - -export interface GetClusterInfoResponse_SourceInfosEntry { - key: number; - value: Source | undefined; -} - -export interface RescheduleRequest { - /** reschedule plan for each fragment */ - reschedules: { [key: number]: RescheduleRequest_Reschedule }; -} - -export interface RescheduleRequest_Reschedule { - addedParallelUnits: number[]; - removedParallelUnits: number[]; -} - -export interface RescheduleRequest_ReschedulesEntry { - key: number; - value: RescheduleRequest_Reschedule | undefined; -} - -export interface RescheduleResponse { - success: boolean; -} - -export interface MembersRequest { -} - -export interface MetaMember { - address: HostAddress | undefined; - isLeader: boolean; -} - -export interface MembersResponse { - members: MetaMember[]; -} - -/** - * The schema for persisted system parameters. - * Note on backward compatibility: - * - Do not remove deprecated fields. Mark them as deprecated both after the field definition and in `system_params/mod.rs` instead. - * - Do not rename existing fields, since each field is stored separately in the meta store with the field name as the key. - * - To modify (rename, change the type or semantic of) a field, introduce a new field suffixed by the version. - */ -export interface SystemParams { - barrierIntervalMs?: number | undefined; - checkpointFrequency?: number | undefined; - sstableSizeMb?: number | undefined; - blockSizeKb?: number | undefined; - bloomFalsePositive?: number | undefined; - stateStore?: string | undefined; - dataDirectory?: string | undefined; - backupStorageUrl?: string | undefined; - backupStorageDirectory?: string | undefined; - telemetryEnabled?: boolean | undefined; -} - -export interface GetSystemParamsRequest { -} - -export interface GetSystemParamsResponse { - params: SystemParams | undefined; -} - -export interface SetSystemParamRequest { - param: string; - /** None means set to default value. */ - value?: string | undefined; -} - -export interface SetSystemParamResponse { -} - -function createBaseGetTelemetryInfoRequest(): GetTelemetryInfoRequest { - return {}; -} - -export const GetTelemetryInfoRequest = { - fromJSON(_: any): GetTelemetryInfoRequest { - return {}; - }, - - toJSON(_: GetTelemetryInfoRequest): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): GetTelemetryInfoRequest { - const message = createBaseGetTelemetryInfoRequest(); - return message; - }, -}; - -function createBaseTelemetryInfoResponse(): TelemetryInfoResponse { - return { trackingId: undefined }; -} - -export const TelemetryInfoResponse = { - fromJSON(object: any): TelemetryInfoResponse { - return { trackingId: isSet(object.trackingId) ? String(object.trackingId) : undefined }; - }, - - toJSON(message: TelemetryInfoResponse): unknown { - const obj: any = {}; - message.trackingId !== undefined && (obj.trackingId = message.trackingId); - return obj; - }, - - fromPartial, I>>(object: I): TelemetryInfoResponse { - const message = createBaseTelemetryInfoResponse(); - message.trackingId = object.trackingId ?? undefined; - return message; - }, -}; - -function createBaseHeartbeatRequest(): HeartbeatRequest { - return { nodeId: 0, info: [] }; -} - -export const HeartbeatRequest = { - fromJSON(object: any): HeartbeatRequest { - return { - nodeId: isSet(object.nodeId) ? Number(object.nodeId) : 0, - info: Array.isArray(object?.info) ? object.info.map((e: any) => HeartbeatRequest_ExtraInfo.fromJSON(e)) : [], - }; - }, - - toJSON(message: HeartbeatRequest): unknown { - const obj: any = {}; - message.nodeId !== undefined && (obj.nodeId = Math.round(message.nodeId)); - if (message.info) { - obj.info = message.info.map((e) => e ? HeartbeatRequest_ExtraInfo.toJSON(e) : undefined); - } else { - obj.info = []; - } - return obj; - }, - - fromPartial, I>>(object: I): HeartbeatRequest { - const message = createBaseHeartbeatRequest(); - message.nodeId = object.nodeId ?? 0; - message.info = object.info?.map((e) => HeartbeatRequest_ExtraInfo.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseHeartbeatRequest_ExtraInfo(): HeartbeatRequest_ExtraInfo { - return { info: undefined }; -} - -export const HeartbeatRequest_ExtraInfo = { - fromJSON(object: any): HeartbeatRequest_ExtraInfo { - return { - info: isSet(object.hummockGcWatermark) - ? { $case: "hummockGcWatermark", hummockGcWatermark: Number(object.hummockGcWatermark) } - : undefined, - }; - }, - - toJSON(message: HeartbeatRequest_ExtraInfo): unknown { - const obj: any = {}; - message.info?.$case === "hummockGcWatermark" && - (obj.hummockGcWatermark = Math.round(message.info?.hummockGcWatermark)); - return obj; - }, - - fromPartial, I>>(object: I): HeartbeatRequest_ExtraInfo { - const message = createBaseHeartbeatRequest_ExtraInfo(); - if ( - object.info?.$case === "hummockGcWatermark" && - object.info?.hummockGcWatermark !== undefined && - object.info?.hummockGcWatermark !== null - ) { - message.info = { $case: "hummockGcWatermark", hummockGcWatermark: object.info.hummockGcWatermark }; - } - return message; - }, -}; - -function createBaseHeartbeatResponse(): HeartbeatResponse { - return { status: undefined }; -} - -export const HeartbeatResponse = { - fromJSON(object: any): HeartbeatResponse { - return { status: isSet(object.status) ? Status.fromJSON(object.status) : undefined }; - }, - - toJSON(message: HeartbeatResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): HeartbeatResponse { - const message = createBaseHeartbeatResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - return message; - }, -}; - -function createBaseTableFragments(): TableFragments { - return { - tableId: 0, - state: TableFragments_State.UNSPECIFIED, - fragments: {}, - actorStatus: {}, - actorSplits: {}, - env: undefined, - }; -} - -export const TableFragments = { - fromJSON(object: any): TableFragments { - return { - tableId: isSet(object.tableId) ? Number(object.tableId) : 0, - state: isSet(object.state) ? tableFragments_StateFromJSON(object.state) : TableFragments_State.UNSPECIFIED, - fragments: isObject(object.fragments) - ? Object.entries(object.fragments).reduce<{ [key: number]: TableFragments_Fragment }>((acc, [key, value]) => { - acc[Number(key)] = TableFragments_Fragment.fromJSON(value); - return acc; - }, {}) - : {}, - actorStatus: isObject(object.actorStatus) - ? Object.entries(object.actorStatus).reduce<{ [key: number]: TableFragments_ActorStatus }>( - (acc, [key, value]) => { - acc[Number(key)] = TableFragments_ActorStatus.fromJSON(value); - return acc; - }, - {}, - ) - : {}, - actorSplits: isObject(object.actorSplits) - ? Object.entries(object.actorSplits).reduce<{ [key: number]: ConnectorSplits }>((acc, [key, value]) => { - acc[Number(key)] = ConnectorSplits.fromJSON(value); - return acc; - }, {}) - : {}, - env: isSet(object.env) ? StreamEnvironment.fromJSON(object.env) : undefined, - }; - }, - - toJSON(message: TableFragments): unknown { - const obj: any = {}; - message.tableId !== undefined && (obj.tableId = Math.round(message.tableId)); - message.state !== undefined && (obj.state = tableFragments_StateToJSON(message.state)); - obj.fragments = {}; - if (message.fragments) { - Object.entries(message.fragments).forEach(([k, v]) => { - obj.fragments[k] = TableFragments_Fragment.toJSON(v); - }); - } - obj.actorStatus = {}; - if (message.actorStatus) { - Object.entries(message.actorStatus).forEach(([k, v]) => { - obj.actorStatus[k] = TableFragments_ActorStatus.toJSON(v); - }); - } - obj.actorSplits = {}; - if (message.actorSplits) { - Object.entries(message.actorSplits).forEach(([k, v]) => { - obj.actorSplits[k] = ConnectorSplits.toJSON(v); - }); - } - message.env !== undefined && (obj.env = message.env ? StreamEnvironment.toJSON(message.env) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): TableFragments { - const message = createBaseTableFragments(); - message.tableId = object.tableId ?? 0; - message.state = object.state ?? TableFragments_State.UNSPECIFIED; - message.fragments = Object.entries(object.fragments ?? {}).reduce<{ [key: number]: TableFragments_Fragment }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[Number(key)] = TableFragments_Fragment.fromPartial(value); - } - return acc; - }, - {}, - ); - message.actorStatus = Object.entries(object.actorStatus ?? {}).reduce< - { [key: number]: TableFragments_ActorStatus } - >((acc, [key, value]) => { - if (value !== undefined) { - acc[Number(key)] = TableFragments_ActorStatus.fromPartial(value); - } - return acc; - }, {}); - message.actorSplits = Object.entries(object.actorSplits ?? {}).reduce<{ [key: number]: ConnectorSplits }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[Number(key)] = ConnectorSplits.fromPartial(value); - } - return acc; - }, - {}, - ); - message.env = (object.env !== undefined && object.env !== null) - ? StreamEnvironment.fromPartial(object.env) - : undefined; - return message; - }, -}; - -function createBaseTableFragments_ActorStatus(): TableFragments_ActorStatus { - return { parallelUnit: undefined, state: TableFragments_ActorStatus_ActorState.UNSPECIFIED }; -} - -export const TableFragments_ActorStatus = { - fromJSON(object: any): TableFragments_ActorStatus { - return { - parallelUnit: isSet(object.parallelUnit) ? ParallelUnit.fromJSON(object.parallelUnit) : undefined, - state: isSet(object.state) - ? tableFragments_ActorStatus_ActorStateFromJSON(object.state) - : TableFragments_ActorStatus_ActorState.UNSPECIFIED, - }; - }, - - toJSON(message: TableFragments_ActorStatus): unknown { - const obj: any = {}; - message.parallelUnit !== undefined && - (obj.parallelUnit = message.parallelUnit ? ParallelUnit.toJSON(message.parallelUnit) : undefined); - message.state !== undefined && (obj.state = tableFragments_ActorStatus_ActorStateToJSON(message.state)); - return obj; - }, - - fromPartial, I>>(object: I): TableFragments_ActorStatus { - const message = createBaseTableFragments_ActorStatus(); - message.parallelUnit = (object.parallelUnit !== undefined && object.parallelUnit !== null) - ? ParallelUnit.fromPartial(object.parallelUnit) - : undefined; - message.state = object.state ?? TableFragments_ActorStatus_ActorState.UNSPECIFIED; - return message; - }, -}; - -function createBaseTableFragments_Fragment(): TableFragments_Fragment { - return { - fragmentId: 0, - fragmentTypeMask: 0, - distributionType: TableFragments_Fragment_FragmentDistributionType.UNSPECIFIED, - actors: [], - vnodeMapping: undefined, - stateTableIds: [], - upstreamFragmentIds: [], - }; -} - -export const TableFragments_Fragment = { - fromJSON(object: any): TableFragments_Fragment { - return { - fragmentId: isSet(object.fragmentId) ? Number(object.fragmentId) : 0, - fragmentTypeMask: isSet(object.fragmentTypeMask) ? Number(object.fragmentTypeMask) : 0, - distributionType: isSet(object.distributionType) - ? tableFragments_Fragment_FragmentDistributionTypeFromJSON(object.distributionType) - : TableFragments_Fragment_FragmentDistributionType.UNSPECIFIED, - actors: Array.isArray(object?.actors) ? object.actors.map((e: any) => StreamActor.fromJSON(e)) : [], - vnodeMapping: isSet(object.vnodeMapping) ? ParallelUnitMapping.fromJSON(object.vnodeMapping) : undefined, - stateTableIds: Array.isArray(object?.stateTableIds) ? object.stateTableIds.map((e: any) => Number(e)) : [], - upstreamFragmentIds: Array.isArray(object?.upstreamFragmentIds) - ? object.upstreamFragmentIds.map((e: any) => Number(e)) - : [], - }; - }, - - toJSON(message: TableFragments_Fragment): unknown { - const obj: any = {}; - message.fragmentId !== undefined && (obj.fragmentId = Math.round(message.fragmentId)); - message.fragmentTypeMask !== undefined && (obj.fragmentTypeMask = Math.round(message.fragmentTypeMask)); - message.distributionType !== undefined && - (obj.distributionType = tableFragments_Fragment_FragmentDistributionTypeToJSON(message.distributionType)); - if (message.actors) { - obj.actors = message.actors.map((e) => e ? StreamActor.toJSON(e) : undefined); - } else { - obj.actors = []; - } - message.vnodeMapping !== undefined && - (obj.vnodeMapping = message.vnodeMapping ? ParallelUnitMapping.toJSON(message.vnodeMapping) : undefined); - if (message.stateTableIds) { - obj.stateTableIds = message.stateTableIds.map((e) => Math.round(e)); - } else { - obj.stateTableIds = []; - } - if (message.upstreamFragmentIds) { - obj.upstreamFragmentIds = message.upstreamFragmentIds.map((e) => Math.round(e)); - } else { - obj.upstreamFragmentIds = []; - } - return obj; - }, - - fromPartial, I>>(object: I): TableFragments_Fragment { - const message = createBaseTableFragments_Fragment(); - message.fragmentId = object.fragmentId ?? 0; - message.fragmentTypeMask = object.fragmentTypeMask ?? 0; - message.distributionType = object.distributionType ?? TableFragments_Fragment_FragmentDistributionType.UNSPECIFIED; - message.actors = object.actors?.map((e) => StreamActor.fromPartial(e)) || []; - message.vnodeMapping = (object.vnodeMapping !== undefined && object.vnodeMapping !== null) - ? ParallelUnitMapping.fromPartial(object.vnodeMapping) - : undefined; - message.stateTableIds = object.stateTableIds?.map((e) => e) || []; - message.upstreamFragmentIds = object.upstreamFragmentIds?.map((e) => e) || []; - return message; - }, -}; - -function createBaseTableFragments_FragmentsEntry(): TableFragments_FragmentsEntry { - return { key: 0, value: undefined }; -} - -export const TableFragments_FragmentsEntry = { - fromJSON(object: any): TableFragments_FragmentsEntry { - return { - key: isSet(object.key) ? Number(object.key) : 0, - value: isSet(object.value) ? TableFragments_Fragment.fromJSON(object.value) : undefined, - }; - }, - - toJSON(message: TableFragments_FragmentsEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = Math.round(message.key)); - message.value !== undefined && - (obj.value = message.value ? TableFragments_Fragment.toJSON(message.value) : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): TableFragments_FragmentsEntry { - const message = createBaseTableFragments_FragmentsEntry(); - message.key = object.key ?? 0; - message.value = (object.value !== undefined && object.value !== null) - ? TableFragments_Fragment.fromPartial(object.value) - : undefined; - return message; - }, -}; - -function createBaseTableFragments_ActorStatusEntry(): TableFragments_ActorStatusEntry { - return { key: 0, value: undefined }; -} - -export const TableFragments_ActorStatusEntry = { - fromJSON(object: any): TableFragments_ActorStatusEntry { - return { - key: isSet(object.key) ? Number(object.key) : 0, - value: isSet(object.value) ? TableFragments_ActorStatus.fromJSON(object.value) : undefined, - }; - }, - - toJSON(message: TableFragments_ActorStatusEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = Math.round(message.key)); - message.value !== undefined && - (obj.value = message.value ? TableFragments_ActorStatus.toJSON(message.value) : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): TableFragments_ActorStatusEntry { - const message = createBaseTableFragments_ActorStatusEntry(); - message.key = object.key ?? 0; - message.value = (object.value !== undefined && object.value !== null) - ? TableFragments_ActorStatus.fromPartial(object.value) - : undefined; - return message; - }, -}; - -function createBaseTableFragments_ActorSplitsEntry(): TableFragments_ActorSplitsEntry { - return { key: 0, value: undefined }; -} - -export const TableFragments_ActorSplitsEntry = { - fromJSON(object: any): TableFragments_ActorSplitsEntry { - return { - key: isSet(object.key) ? Number(object.key) : 0, - value: isSet(object.value) ? ConnectorSplits.fromJSON(object.value) : undefined, - }; - }, - - toJSON(message: TableFragments_ActorSplitsEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = Math.round(message.key)); - message.value !== undefined && (obj.value = message.value ? ConnectorSplits.toJSON(message.value) : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): TableFragments_ActorSplitsEntry { - const message = createBaseTableFragments_ActorSplitsEntry(); - message.key = object.key ?? 0; - message.value = (object.value !== undefined && object.value !== null) - ? ConnectorSplits.fromPartial(object.value) - : undefined; - return message; - }, -}; - -function createBaseFragmentParallelUnitMapping(): FragmentParallelUnitMapping { - return { fragmentId: 0, mapping: undefined }; -} - -export const FragmentParallelUnitMapping = { - fromJSON(object: any): FragmentParallelUnitMapping { - return { - fragmentId: isSet(object.fragmentId) ? Number(object.fragmentId) : 0, - mapping: isSet(object.mapping) ? ParallelUnitMapping.fromJSON(object.mapping) : undefined, - }; - }, - - toJSON(message: FragmentParallelUnitMapping): unknown { - const obj: any = {}; - message.fragmentId !== undefined && (obj.fragmentId = Math.round(message.fragmentId)); - message.mapping !== undefined && - (obj.mapping = message.mapping ? ParallelUnitMapping.toJSON(message.mapping) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): FragmentParallelUnitMapping { - const message = createBaseFragmentParallelUnitMapping(); - message.fragmentId = object.fragmentId ?? 0; - message.mapping = (object.mapping !== undefined && object.mapping !== null) - ? ParallelUnitMapping.fromPartial(object.mapping) - : undefined; - return message; - }, -}; - -function createBaseActorLocation(): ActorLocation { - return { node: undefined, actors: [] }; -} - -export const ActorLocation = { - fromJSON(object: any): ActorLocation { - return { - node: isSet(object.node) ? WorkerNode.fromJSON(object.node) : undefined, - actors: Array.isArray(object?.actors) ? object.actors.map((e: any) => StreamActor.fromJSON(e)) : [], - }; - }, - - toJSON(message: ActorLocation): unknown { - const obj: any = {}; - message.node !== undefined && (obj.node = message.node ? WorkerNode.toJSON(message.node) : undefined); - if (message.actors) { - obj.actors = message.actors.map((e) => e ? StreamActor.toJSON(e) : undefined); - } else { - obj.actors = []; - } - return obj; - }, - - fromPartial, I>>(object: I): ActorLocation { - const message = createBaseActorLocation(); - message.node = (object.node !== undefined && object.node !== null) - ? WorkerNode.fromPartial(object.node) - : undefined; - message.actors = object.actors?.map((e) => StreamActor.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseFlushRequest(): FlushRequest { - return { checkpoint: false }; -} - -export const FlushRequest = { - fromJSON(object: any): FlushRequest { - return { checkpoint: isSet(object.checkpoint) ? Boolean(object.checkpoint) : false }; - }, - - toJSON(message: FlushRequest): unknown { - const obj: any = {}; - message.checkpoint !== undefined && (obj.checkpoint = message.checkpoint); - return obj; - }, - - fromPartial, I>>(object: I): FlushRequest { - const message = createBaseFlushRequest(); - message.checkpoint = object.checkpoint ?? false; - return message; - }, -}; - -function createBaseFlushResponse(): FlushResponse { - return { status: undefined, snapshot: undefined }; -} - -export const FlushResponse = { - fromJSON(object: any): FlushResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - snapshot: isSet(object.snapshot) ? HummockSnapshot.fromJSON(object.snapshot) : undefined, - }; - }, - - toJSON(message: FlushResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - message.snapshot !== undefined && - (obj.snapshot = message.snapshot ? HummockSnapshot.toJSON(message.snapshot) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): FlushResponse { - const message = createBaseFlushResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.snapshot = (object.snapshot !== undefined && object.snapshot !== null) - ? HummockSnapshot.fromPartial(object.snapshot) - : undefined; - return message; - }, -}; - -function createBaseCreatingJobInfo(): CreatingJobInfo { - return { databaseId: 0, schemaId: 0, name: "" }; -} - -export const CreatingJobInfo = { - fromJSON(object: any): CreatingJobInfo { - return { - databaseId: isSet(object.databaseId) ? Number(object.databaseId) : 0, - schemaId: isSet(object.schemaId) ? Number(object.schemaId) : 0, - name: isSet(object.name) ? String(object.name) : "", - }; - }, - - toJSON(message: CreatingJobInfo): unknown { - const obj: any = {}; - message.databaseId !== undefined && (obj.databaseId = Math.round(message.databaseId)); - message.schemaId !== undefined && (obj.schemaId = Math.round(message.schemaId)); - message.name !== undefined && (obj.name = message.name); - return obj; - }, - - fromPartial, I>>(object: I): CreatingJobInfo { - const message = createBaseCreatingJobInfo(); - message.databaseId = object.databaseId ?? 0; - message.schemaId = object.schemaId ?? 0; - message.name = object.name ?? ""; - return message; - }, -}; - -function createBaseCancelCreatingJobsRequest(): CancelCreatingJobsRequest { - return { infos: [] }; -} - -export const CancelCreatingJobsRequest = { - fromJSON(object: any): CancelCreatingJobsRequest { - return { infos: Array.isArray(object?.infos) ? object.infos.map((e: any) => CreatingJobInfo.fromJSON(e)) : [] }; - }, - - toJSON(message: CancelCreatingJobsRequest): unknown { - const obj: any = {}; - if (message.infos) { - obj.infos = message.infos.map((e) => e ? CreatingJobInfo.toJSON(e) : undefined); - } else { - obj.infos = []; - } - return obj; - }, - - fromPartial, I>>(object: I): CancelCreatingJobsRequest { - const message = createBaseCancelCreatingJobsRequest(); - message.infos = object.infos?.map((e) => CreatingJobInfo.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseCancelCreatingJobsResponse(): CancelCreatingJobsResponse { - return { status: undefined }; -} - -export const CancelCreatingJobsResponse = { - fromJSON(object: any): CancelCreatingJobsResponse { - return { status: isSet(object.status) ? Status.fromJSON(object.status) : undefined }; - }, - - toJSON(message: CancelCreatingJobsResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): CancelCreatingJobsResponse { - const message = createBaseCancelCreatingJobsResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - return message; - }, -}; - -function createBaseListTableFragmentsRequest(): ListTableFragmentsRequest { - return { tableIds: [] }; -} - -export const ListTableFragmentsRequest = { - fromJSON(object: any): ListTableFragmentsRequest { - return { tableIds: Array.isArray(object?.tableIds) ? object.tableIds.map((e: any) => Number(e)) : [] }; - }, - - toJSON(message: ListTableFragmentsRequest): unknown { - const obj: any = {}; - if (message.tableIds) { - obj.tableIds = message.tableIds.map((e) => Math.round(e)); - } else { - obj.tableIds = []; - } - return obj; - }, - - fromPartial, I>>(object: I): ListTableFragmentsRequest { - const message = createBaseListTableFragmentsRequest(); - message.tableIds = object.tableIds?.map((e) => e) || []; - return message; - }, -}; - -function createBaseListTableFragmentsResponse(): ListTableFragmentsResponse { - return { tableFragments: {} }; -} - -export const ListTableFragmentsResponse = { - fromJSON(object: any): ListTableFragmentsResponse { - return { - tableFragments: isObject(object.tableFragments) - ? Object.entries(object.tableFragments).reduce<{ [key: number]: ListTableFragmentsResponse_TableFragmentInfo }>( - (acc, [key, value]) => { - acc[Number(key)] = ListTableFragmentsResponse_TableFragmentInfo.fromJSON(value); - return acc; - }, - {}, - ) - : {}, - }; - }, - - toJSON(message: ListTableFragmentsResponse): unknown { - const obj: any = {}; - obj.tableFragments = {}; - if (message.tableFragments) { - Object.entries(message.tableFragments).forEach(([k, v]) => { - obj.tableFragments[k] = ListTableFragmentsResponse_TableFragmentInfo.toJSON(v); - }); - } - return obj; - }, - - fromPartial, I>>(object: I): ListTableFragmentsResponse { - const message = createBaseListTableFragmentsResponse(); - message.tableFragments = Object.entries(object.tableFragments ?? {}).reduce< - { [key: number]: ListTableFragmentsResponse_TableFragmentInfo } - >((acc, [key, value]) => { - if (value !== undefined) { - acc[Number(key)] = ListTableFragmentsResponse_TableFragmentInfo.fromPartial(value); - } - return acc; - }, {}); - return message; - }, -}; - -function createBaseListTableFragmentsResponse_ActorInfo(): ListTableFragmentsResponse_ActorInfo { - return { id: 0, node: undefined, dispatcher: [] }; -} - -export const ListTableFragmentsResponse_ActorInfo = { - fromJSON(object: any): ListTableFragmentsResponse_ActorInfo { - return { - id: isSet(object.id) ? Number(object.id) : 0, - node: isSet(object.node) ? StreamNode.fromJSON(object.node) : undefined, - dispatcher: Array.isArray(object?.dispatcher) ? object.dispatcher.map((e: any) => Dispatcher.fromJSON(e)) : [], - }; - }, - - toJSON(message: ListTableFragmentsResponse_ActorInfo): unknown { - const obj: any = {}; - message.id !== undefined && (obj.id = Math.round(message.id)); - message.node !== undefined && (obj.node = message.node ? StreamNode.toJSON(message.node) : undefined); - if (message.dispatcher) { - obj.dispatcher = message.dispatcher.map((e) => e ? Dispatcher.toJSON(e) : undefined); - } else { - obj.dispatcher = []; - } - return obj; - }, - - fromPartial, I>>( - object: I, - ): ListTableFragmentsResponse_ActorInfo { - const message = createBaseListTableFragmentsResponse_ActorInfo(); - message.id = object.id ?? 0; - message.node = (object.node !== undefined && object.node !== null) - ? StreamNode.fromPartial(object.node) - : undefined; - message.dispatcher = object.dispatcher?.map((e) => Dispatcher.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseListTableFragmentsResponse_FragmentInfo(): ListTableFragmentsResponse_FragmentInfo { - return { id: 0, actors: [] }; -} - -export const ListTableFragmentsResponse_FragmentInfo = { - fromJSON(object: any): ListTableFragmentsResponse_FragmentInfo { - return { - id: isSet(object.id) ? Number(object.id) : 0, - actors: Array.isArray(object?.actors) - ? object.actors.map((e: any) => ListTableFragmentsResponse_ActorInfo.fromJSON(e)) - : [], - }; - }, - - toJSON(message: ListTableFragmentsResponse_FragmentInfo): unknown { - const obj: any = {}; - message.id !== undefined && (obj.id = Math.round(message.id)); - if (message.actors) { - obj.actors = message.actors.map((e) => e ? ListTableFragmentsResponse_ActorInfo.toJSON(e) : undefined); - } else { - obj.actors = []; - } - return obj; - }, - - fromPartial, I>>( - object: I, - ): ListTableFragmentsResponse_FragmentInfo { - const message = createBaseListTableFragmentsResponse_FragmentInfo(); - message.id = object.id ?? 0; - message.actors = object.actors?.map((e) => ListTableFragmentsResponse_ActorInfo.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseListTableFragmentsResponse_TableFragmentInfo(): ListTableFragmentsResponse_TableFragmentInfo { - return { fragments: [], env: undefined }; -} - -export const ListTableFragmentsResponse_TableFragmentInfo = { - fromJSON(object: any): ListTableFragmentsResponse_TableFragmentInfo { - return { - fragments: Array.isArray(object?.fragments) - ? object.fragments.map((e: any) => ListTableFragmentsResponse_FragmentInfo.fromJSON(e)) - : [], - env: isSet(object.env) ? StreamEnvironment.fromJSON(object.env) : undefined, - }; - }, - - toJSON(message: ListTableFragmentsResponse_TableFragmentInfo): unknown { - const obj: any = {}; - if (message.fragments) { - obj.fragments = message.fragments.map((e) => e ? ListTableFragmentsResponse_FragmentInfo.toJSON(e) : undefined); - } else { - obj.fragments = []; - } - message.env !== undefined && (obj.env = message.env ? StreamEnvironment.toJSON(message.env) : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): ListTableFragmentsResponse_TableFragmentInfo { - const message = createBaseListTableFragmentsResponse_TableFragmentInfo(); - message.fragments = object.fragments?.map((e) => ListTableFragmentsResponse_FragmentInfo.fromPartial(e)) || []; - message.env = (object.env !== undefined && object.env !== null) - ? StreamEnvironment.fromPartial(object.env) - : undefined; - return message; - }, -}; - -function createBaseListTableFragmentsResponse_TableFragmentsEntry(): ListTableFragmentsResponse_TableFragmentsEntry { - return { key: 0, value: undefined }; -} - -export const ListTableFragmentsResponse_TableFragmentsEntry = { - fromJSON(object: any): ListTableFragmentsResponse_TableFragmentsEntry { - return { - key: isSet(object.key) ? Number(object.key) : 0, - value: isSet(object.value) ? ListTableFragmentsResponse_TableFragmentInfo.fromJSON(object.value) : undefined, - }; - }, - - toJSON(message: ListTableFragmentsResponse_TableFragmentsEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = Math.round(message.key)); - message.value !== undefined && - (obj.value = message.value ? ListTableFragmentsResponse_TableFragmentInfo.toJSON(message.value) : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): ListTableFragmentsResponse_TableFragmentsEntry { - const message = createBaseListTableFragmentsResponse_TableFragmentsEntry(); - message.key = object.key ?? 0; - message.value = (object.value !== undefined && object.value !== null) - ? ListTableFragmentsResponse_TableFragmentInfo.fromPartial(object.value) - : undefined; - return message; - }, -}; - -function createBaseAddWorkerNodeRequest(): AddWorkerNodeRequest { - return { workerType: WorkerType.UNSPECIFIED, host: undefined, workerNodeParallelism: 0 }; -} - -export const AddWorkerNodeRequest = { - fromJSON(object: any): AddWorkerNodeRequest { - return { - workerType: isSet(object.workerType) ? workerTypeFromJSON(object.workerType) : WorkerType.UNSPECIFIED, - host: isSet(object.host) ? HostAddress.fromJSON(object.host) : undefined, - workerNodeParallelism: isSet(object.workerNodeParallelism) ? Number(object.workerNodeParallelism) : 0, - }; - }, - - toJSON(message: AddWorkerNodeRequest): unknown { - const obj: any = {}; - message.workerType !== undefined && (obj.workerType = workerTypeToJSON(message.workerType)); - message.host !== undefined && (obj.host = message.host ? HostAddress.toJSON(message.host) : undefined); - message.workerNodeParallelism !== undefined && - (obj.workerNodeParallelism = Math.round(message.workerNodeParallelism)); - return obj; - }, - - fromPartial, I>>(object: I): AddWorkerNodeRequest { - const message = createBaseAddWorkerNodeRequest(); - message.workerType = object.workerType ?? WorkerType.UNSPECIFIED; - message.host = (object.host !== undefined && object.host !== null) - ? HostAddress.fromPartial(object.host) - : undefined; - message.workerNodeParallelism = object.workerNodeParallelism ?? 0; - return message; - }, -}; - -function createBaseAddWorkerNodeResponse(): AddWorkerNodeResponse { - return { status: undefined, node: undefined }; -} - -export const AddWorkerNodeResponse = { - fromJSON(object: any): AddWorkerNodeResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - node: isSet(object.node) ? WorkerNode.fromJSON(object.node) : undefined, - }; - }, - - toJSON(message: AddWorkerNodeResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - message.node !== undefined && (obj.node = message.node ? WorkerNode.toJSON(message.node) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): AddWorkerNodeResponse { - const message = createBaseAddWorkerNodeResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.node = (object.node !== undefined && object.node !== null) - ? WorkerNode.fromPartial(object.node) - : undefined; - return message; - }, -}; - -function createBaseActivateWorkerNodeRequest(): ActivateWorkerNodeRequest { - return { host: undefined }; -} - -export const ActivateWorkerNodeRequest = { - fromJSON(object: any): ActivateWorkerNodeRequest { - return { host: isSet(object.host) ? HostAddress.fromJSON(object.host) : undefined }; - }, - - toJSON(message: ActivateWorkerNodeRequest): unknown { - const obj: any = {}; - message.host !== undefined && (obj.host = message.host ? HostAddress.toJSON(message.host) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): ActivateWorkerNodeRequest { - const message = createBaseActivateWorkerNodeRequest(); - message.host = (object.host !== undefined && object.host !== null) - ? HostAddress.fromPartial(object.host) - : undefined; - return message; - }, -}; - -function createBaseActivateWorkerNodeResponse(): ActivateWorkerNodeResponse { - return { status: undefined }; -} - -export const ActivateWorkerNodeResponse = { - fromJSON(object: any): ActivateWorkerNodeResponse { - return { status: isSet(object.status) ? Status.fromJSON(object.status) : undefined }; - }, - - toJSON(message: ActivateWorkerNodeResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): ActivateWorkerNodeResponse { - const message = createBaseActivateWorkerNodeResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - return message; - }, -}; - -function createBaseDeleteWorkerNodeRequest(): DeleteWorkerNodeRequest { - return { host: undefined }; -} - -export const DeleteWorkerNodeRequest = { - fromJSON(object: any): DeleteWorkerNodeRequest { - return { host: isSet(object.host) ? HostAddress.fromJSON(object.host) : undefined }; - }, - - toJSON(message: DeleteWorkerNodeRequest): unknown { - const obj: any = {}; - message.host !== undefined && (obj.host = message.host ? HostAddress.toJSON(message.host) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): DeleteWorkerNodeRequest { - const message = createBaseDeleteWorkerNodeRequest(); - message.host = (object.host !== undefined && object.host !== null) - ? HostAddress.fromPartial(object.host) - : undefined; - return message; - }, -}; - -function createBaseDeleteWorkerNodeResponse(): DeleteWorkerNodeResponse { - return { status: undefined }; -} - -export const DeleteWorkerNodeResponse = { - fromJSON(object: any): DeleteWorkerNodeResponse { - return { status: isSet(object.status) ? Status.fromJSON(object.status) : undefined }; - }, - - toJSON(message: DeleteWorkerNodeResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): DeleteWorkerNodeResponse { - const message = createBaseDeleteWorkerNodeResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - return message; - }, -}; - -function createBaseListAllNodesRequest(): ListAllNodesRequest { - return { workerType: WorkerType.UNSPECIFIED, includeStartingNodes: false }; -} - -export const ListAllNodesRequest = { - fromJSON(object: any): ListAllNodesRequest { - return { - workerType: isSet(object.workerType) ? workerTypeFromJSON(object.workerType) : WorkerType.UNSPECIFIED, - includeStartingNodes: isSet(object.includeStartingNodes) ? Boolean(object.includeStartingNodes) : false, - }; - }, - - toJSON(message: ListAllNodesRequest): unknown { - const obj: any = {}; - message.workerType !== undefined && (obj.workerType = workerTypeToJSON(message.workerType)); - message.includeStartingNodes !== undefined && (obj.includeStartingNodes = message.includeStartingNodes); - return obj; - }, - - fromPartial, I>>(object: I): ListAllNodesRequest { - const message = createBaseListAllNodesRequest(); - message.workerType = object.workerType ?? WorkerType.UNSPECIFIED; - message.includeStartingNodes = object.includeStartingNodes ?? false; - return message; - }, -}; - -function createBaseListAllNodesResponse(): ListAllNodesResponse { - return { status: undefined, nodes: [] }; -} - -export const ListAllNodesResponse = { - fromJSON(object: any): ListAllNodesResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - nodes: Array.isArray(object?.nodes) ? object.nodes.map((e: any) => WorkerNode.fromJSON(e)) : [], - }; - }, - - toJSON(message: ListAllNodesResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - if (message.nodes) { - obj.nodes = message.nodes.map((e) => e ? WorkerNode.toJSON(e) : undefined); - } else { - obj.nodes = []; - } - return obj; - }, - - fromPartial, I>>(object: I): ListAllNodesResponse { - const message = createBaseListAllNodesResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.nodes = object.nodes?.map((e) => WorkerNode.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseSubscribeRequest(): SubscribeRequest { - return { subscribeType: SubscribeType.UNSPECIFIED, host: undefined, workerId: 0 }; -} - -export const SubscribeRequest = { - fromJSON(object: any): SubscribeRequest { - return { - subscribeType: isSet(object.subscribeType) - ? subscribeTypeFromJSON(object.subscribeType) - : SubscribeType.UNSPECIFIED, - host: isSet(object.host) ? HostAddress.fromJSON(object.host) : undefined, - workerId: isSet(object.workerId) ? Number(object.workerId) : 0, - }; - }, - - toJSON(message: SubscribeRequest): unknown { - const obj: any = {}; - message.subscribeType !== undefined && (obj.subscribeType = subscribeTypeToJSON(message.subscribeType)); - message.host !== undefined && (obj.host = message.host ? HostAddress.toJSON(message.host) : undefined); - message.workerId !== undefined && (obj.workerId = Math.round(message.workerId)); - return obj; - }, - - fromPartial, I>>(object: I): SubscribeRequest { - const message = createBaseSubscribeRequest(); - message.subscribeType = object.subscribeType ?? SubscribeType.UNSPECIFIED; - message.host = (object.host !== undefined && object.host !== null) - ? HostAddress.fromPartial(object.host) - : undefined; - message.workerId = object.workerId ?? 0; - return message; - }, -}; - -function createBaseMetaSnapshot(): MetaSnapshot { - return { - databases: [], - schemas: [], - sources: [], - sinks: [], - tables: [], - indexes: [], - views: [], - functions: [], - users: [], - parallelUnitMappings: [], - nodes: [], - hummockSnapshot: undefined, - hummockVersion: undefined, - metaBackupManifestId: undefined, - hummockWriteLimits: undefined, - version: undefined, - }; -} - -export const MetaSnapshot = { - fromJSON(object: any): MetaSnapshot { - return { - databases: Array.isArray(object?.databases) ? object.databases.map((e: any) => Database.fromJSON(e)) : [], - schemas: Array.isArray(object?.schemas) ? object.schemas.map((e: any) => Schema.fromJSON(e)) : [], - sources: Array.isArray(object?.sources) ? object.sources.map((e: any) => Source.fromJSON(e)) : [], - sinks: Array.isArray(object?.sinks) ? object.sinks.map((e: any) => Sink.fromJSON(e)) : [], - tables: Array.isArray(object?.tables) ? object.tables.map((e: any) => Table.fromJSON(e)) : [], - indexes: Array.isArray(object?.indexes) ? object.indexes.map((e: any) => Index.fromJSON(e)) : [], - views: Array.isArray(object?.views) ? object.views.map((e: any) => View.fromJSON(e)) : [], - functions: Array.isArray(object?.functions) ? object.functions.map((e: any) => Function.fromJSON(e)) : [], - users: Array.isArray(object?.users) ? object.users.map((e: any) => UserInfo.fromJSON(e)) : [], - parallelUnitMappings: Array.isArray(object?.parallelUnitMappings) - ? object.parallelUnitMappings.map((e: any) => FragmentParallelUnitMapping.fromJSON(e)) - : [], - nodes: Array.isArray(object?.nodes) - ? object.nodes.map((e: any) => WorkerNode.fromJSON(e)) - : [], - hummockSnapshot: isSet(object.hummockSnapshot) ? HummockSnapshot.fromJSON(object.hummockSnapshot) : undefined, - hummockVersion: isSet(object.hummockVersion) ? HummockVersion.fromJSON(object.hummockVersion) : undefined, - metaBackupManifestId: isSet(object.metaBackupManifestId) - ? MetaBackupManifestId.fromJSON(object.metaBackupManifestId) - : undefined, - hummockWriteLimits: isSet(object.hummockWriteLimits) - ? WriteLimits.fromJSON(object.hummockWriteLimits) - : undefined, - version: isSet(object.version) ? MetaSnapshot_SnapshotVersion.fromJSON(object.version) : undefined, - }; - }, - - toJSON(message: MetaSnapshot): unknown { - const obj: any = {}; - if (message.databases) { - obj.databases = message.databases.map((e) => e ? Database.toJSON(e) : undefined); - } else { - obj.databases = []; - } - if (message.schemas) { - obj.schemas = message.schemas.map((e) => e ? Schema.toJSON(e) : undefined); - } else { - obj.schemas = []; - } - if (message.sources) { - obj.sources = message.sources.map((e) => e ? Source.toJSON(e) : undefined); - } else { - obj.sources = []; - } - if (message.sinks) { - obj.sinks = message.sinks.map((e) => e ? Sink.toJSON(e) : undefined); - } else { - obj.sinks = []; - } - if (message.tables) { - obj.tables = message.tables.map((e) => e ? Table.toJSON(e) : undefined); - } else { - obj.tables = []; - } - if (message.indexes) { - obj.indexes = message.indexes.map((e) => e ? Index.toJSON(e) : undefined); - } else { - obj.indexes = []; - } - if (message.views) { - obj.views = message.views.map((e) => e ? View.toJSON(e) : undefined); - } else { - obj.views = []; - } - if (message.functions) { - obj.functions = message.functions.map((e) => e ? Function.toJSON(e) : undefined); - } else { - obj.functions = []; - } - if (message.users) { - obj.users = message.users.map((e) => e ? UserInfo.toJSON(e) : undefined); - } else { - obj.users = []; - } - if (message.parallelUnitMappings) { - obj.parallelUnitMappings = message.parallelUnitMappings.map((e) => - e ? FragmentParallelUnitMapping.toJSON(e) : undefined - ); - } else { - obj.parallelUnitMappings = []; - } - if (message.nodes) { - obj.nodes = message.nodes.map((e) => e ? WorkerNode.toJSON(e) : undefined); - } else { - obj.nodes = []; - } - message.hummockSnapshot !== undefined && - (obj.hummockSnapshot = message.hummockSnapshot ? HummockSnapshot.toJSON(message.hummockSnapshot) : undefined); - message.hummockVersion !== undefined && - (obj.hummockVersion = message.hummockVersion ? HummockVersion.toJSON(message.hummockVersion) : undefined); - message.metaBackupManifestId !== undefined && (obj.metaBackupManifestId = message.metaBackupManifestId - ? MetaBackupManifestId.toJSON(message.metaBackupManifestId) - : undefined); - message.hummockWriteLimits !== undefined && - (obj.hummockWriteLimits = message.hummockWriteLimits - ? WriteLimits.toJSON(message.hummockWriteLimits) - : undefined); - message.version !== undefined && - (obj.version = message.version ? MetaSnapshot_SnapshotVersion.toJSON(message.version) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): MetaSnapshot { - const message = createBaseMetaSnapshot(); - message.databases = object.databases?.map((e) => Database.fromPartial(e)) || []; - message.schemas = object.schemas?.map((e) => Schema.fromPartial(e)) || []; - message.sources = object.sources?.map((e) => Source.fromPartial(e)) || []; - message.sinks = object.sinks?.map((e) => Sink.fromPartial(e)) || []; - message.tables = object.tables?.map((e) => Table.fromPartial(e)) || []; - message.indexes = object.indexes?.map((e) => Index.fromPartial(e)) || []; - message.views = object.views?.map((e) => View.fromPartial(e)) || []; - message.functions = object.functions?.map((e) => Function.fromPartial(e)) || []; - message.users = object.users?.map((e) => UserInfo.fromPartial(e)) || []; - message.parallelUnitMappings = - object.parallelUnitMappings?.map((e) => FragmentParallelUnitMapping.fromPartial(e)) || []; - message.nodes = object.nodes?.map((e) => WorkerNode.fromPartial(e)) || []; - message.hummockSnapshot = (object.hummockSnapshot !== undefined && object.hummockSnapshot !== null) - ? HummockSnapshot.fromPartial(object.hummockSnapshot) - : undefined; - message.hummockVersion = (object.hummockVersion !== undefined && object.hummockVersion !== null) - ? HummockVersion.fromPartial(object.hummockVersion) - : undefined; - message.metaBackupManifestId = (object.metaBackupManifestId !== undefined && object.metaBackupManifestId !== null) - ? MetaBackupManifestId.fromPartial(object.metaBackupManifestId) - : undefined; - message.hummockWriteLimits = (object.hummockWriteLimits !== undefined && object.hummockWriteLimits !== null) - ? WriteLimits.fromPartial(object.hummockWriteLimits) - : undefined; - message.version = (object.version !== undefined && object.version !== null) - ? MetaSnapshot_SnapshotVersion.fromPartial(object.version) - : undefined; - return message; - }, -}; - -function createBaseMetaSnapshot_SnapshotVersion(): MetaSnapshot_SnapshotVersion { - return { catalogVersion: 0, parallelUnitMappingVersion: 0, workerNodeVersion: 0 }; -} - -export const MetaSnapshot_SnapshotVersion = { - fromJSON(object: any): MetaSnapshot_SnapshotVersion { - return { - catalogVersion: isSet(object.catalogVersion) ? Number(object.catalogVersion) : 0, - parallelUnitMappingVersion: isSet(object.parallelUnitMappingVersion) - ? Number(object.parallelUnitMappingVersion) - : 0, - workerNodeVersion: isSet(object.workerNodeVersion) ? Number(object.workerNodeVersion) : 0, - }; - }, - - toJSON(message: MetaSnapshot_SnapshotVersion): unknown { - const obj: any = {}; - message.catalogVersion !== undefined && (obj.catalogVersion = Math.round(message.catalogVersion)); - message.parallelUnitMappingVersion !== undefined && - (obj.parallelUnitMappingVersion = Math.round(message.parallelUnitMappingVersion)); - message.workerNodeVersion !== undefined && (obj.workerNodeVersion = Math.round(message.workerNodeVersion)); - return obj; - }, - - fromPartial, I>>(object: I): MetaSnapshot_SnapshotVersion { - const message = createBaseMetaSnapshot_SnapshotVersion(); - message.catalogVersion = object.catalogVersion ?? 0; - message.parallelUnitMappingVersion = object.parallelUnitMappingVersion ?? 0; - message.workerNodeVersion = object.workerNodeVersion ?? 0; - return message; - }, -}; - -function createBaseSubscribeResponse(): SubscribeResponse { - return { status: undefined, operation: SubscribeResponse_Operation.UNSPECIFIED, version: 0, info: undefined }; -} - -export const SubscribeResponse = { - fromJSON(object: any): SubscribeResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - operation: isSet(object.operation) - ? subscribeResponse_OperationFromJSON(object.operation) - : SubscribeResponse_Operation.UNSPECIFIED, - version: isSet(object.version) ? Number(object.version) : 0, - info: isSet(object.database) - ? { $case: "database", database: Database.fromJSON(object.database) } - : isSet(object.schema) - ? { $case: "schema", schema: Schema.fromJSON(object.schema) } - : isSet(object.table) - ? { $case: "table", table: Table.fromJSON(object.table) } - : isSet(object.source) - ? { $case: "source", source: Source.fromJSON(object.source) } - : isSet(object.sink) - ? { $case: "sink", sink: Sink.fromJSON(object.sink) } - : isSet(object.index) - ? { $case: "index", index: Index.fromJSON(object.index) } - : isSet(object.view) - ? { $case: "view", view: View.fromJSON(object.view) } - : isSet(object.function) - ? { $case: "function", function: Function.fromJSON(object.function) } - : isSet(object.user) - ? { $case: "user", user: UserInfo.fromJSON(object.user) } - : isSet(object.parallelUnitMapping) - ? { - $case: "parallelUnitMapping", - parallelUnitMapping: FragmentParallelUnitMapping.fromJSON(object.parallelUnitMapping), - } - : isSet(object.node) - ? { $case: "node", node: WorkerNode.fromJSON(object.node) } - : isSet(object.hummockSnapshot) - ? { $case: "hummockSnapshot", hummockSnapshot: HummockSnapshot.fromJSON(object.hummockSnapshot) } - : isSet(object.hummockVersionDeltas) - ? { - $case: "hummockVersionDeltas", - hummockVersionDeltas: HummockVersionDeltas.fromJSON(object.hummockVersionDeltas), - } - : isSet(object.snapshot) - ? { $case: "snapshot", snapshot: MetaSnapshot.fromJSON(object.snapshot) } - : isSet(object.metaBackupManifestId) - ? { - $case: "metaBackupManifestId", - metaBackupManifestId: MetaBackupManifestId.fromJSON(object.metaBackupManifestId), - } - : isSet(object.systemParams) - ? { $case: "systemParams", systemParams: SystemParams.fromJSON(object.systemParams) } - : isSet(object.hummockWriteLimits) - ? { $case: "hummockWriteLimits", hummockWriteLimits: WriteLimits.fromJSON(object.hummockWriteLimits) } - : undefined, - }; - }, - - toJSON(message: SubscribeResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - message.operation !== undefined && (obj.operation = subscribeResponse_OperationToJSON(message.operation)); - message.version !== undefined && (obj.version = Math.round(message.version)); - message.info?.$case === "database" && - (obj.database = message.info?.database ? Database.toJSON(message.info?.database) : undefined); - message.info?.$case === "schema" && - (obj.schema = message.info?.schema ? Schema.toJSON(message.info?.schema) : undefined); - message.info?.$case === "table" && - (obj.table = message.info?.table ? Table.toJSON(message.info?.table) : undefined); - message.info?.$case === "source" && - (obj.source = message.info?.source ? Source.toJSON(message.info?.source) : undefined); - message.info?.$case === "sink" && (obj.sink = message.info?.sink ? Sink.toJSON(message.info?.sink) : undefined); - message.info?.$case === "index" && - (obj.index = message.info?.index ? Index.toJSON(message.info?.index) : undefined); - message.info?.$case === "view" && (obj.view = message.info?.view ? View.toJSON(message.info?.view) : undefined); - message.info?.$case === "function" && - (obj.function = message.info?.function ? Function.toJSON(message.info?.function) : undefined); - message.info?.$case === "user" && (obj.user = message.info?.user ? UserInfo.toJSON(message.info?.user) : undefined); - message.info?.$case === "parallelUnitMapping" && (obj.parallelUnitMapping = message.info?.parallelUnitMapping - ? FragmentParallelUnitMapping.toJSON(message.info?.parallelUnitMapping) - : undefined); - message.info?.$case === "node" && - (obj.node = message.info?.node ? WorkerNode.toJSON(message.info?.node) : undefined); - message.info?.$case === "hummockSnapshot" && (obj.hummockSnapshot = message.info?.hummockSnapshot - ? HummockSnapshot.toJSON(message.info?.hummockSnapshot) - : undefined); - message.info?.$case === "hummockVersionDeltas" && (obj.hummockVersionDeltas = message.info?.hummockVersionDeltas - ? HummockVersionDeltas.toJSON(message.info?.hummockVersionDeltas) - : undefined); - message.info?.$case === "snapshot" && - (obj.snapshot = message.info?.snapshot ? MetaSnapshot.toJSON(message.info?.snapshot) : undefined); - message.info?.$case === "metaBackupManifestId" && (obj.metaBackupManifestId = message.info?.metaBackupManifestId - ? MetaBackupManifestId.toJSON(message.info?.metaBackupManifestId) - : undefined); - message.info?.$case === "systemParams" && - (obj.systemParams = message.info?.systemParams ? SystemParams.toJSON(message.info?.systemParams) : undefined); - message.info?.$case === "hummockWriteLimits" && (obj.hummockWriteLimits = message.info?.hummockWriteLimits - ? WriteLimits.toJSON(message.info?.hummockWriteLimits) - : undefined); - return obj; - }, - - fromPartial, I>>(object: I): SubscribeResponse { - const message = createBaseSubscribeResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.operation = object.operation ?? SubscribeResponse_Operation.UNSPECIFIED; - message.version = object.version ?? 0; - if (object.info?.$case === "database" && object.info?.database !== undefined && object.info?.database !== null) { - message.info = { $case: "database", database: Database.fromPartial(object.info.database) }; - } - if (object.info?.$case === "schema" && object.info?.schema !== undefined && object.info?.schema !== null) { - message.info = { $case: "schema", schema: Schema.fromPartial(object.info.schema) }; - } - if (object.info?.$case === "table" && object.info?.table !== undefined && object.info?.table !== null) { - message.info = { $case: "table", table: Table.fromPartial(object.info.table) }; - } - if (object.info?.$case === "source" && object.info?.source !== undefined && object.info?.source !== null) { - message.info = { $case: "source", source: Source.fromPartial(object.info.source) }; - } - if (object.info?.$case === "sink" && object.info?.sink !== undefined && object.info?.sink !== null) { - message.info = { $case: "sink", sink: Sink.fromPartial(object.info.sink) }; - } - if (object.info?.$case === "index" && object.info?.index !== undefined && object.info?.index !== null) { - message.info = { $case: "index", index: Index.fromPartial(object.info.index) }; - } - if (object.info?.$case === "view" && object.info?.view !== undefined && object.info?.view !== null) { - message.info = { $case: "view", view: View.fromPartial(object.info.view) }; - } - if (object.info?.$case === "function" && object.info?.function !== undefined && object.info?.function !== null) { - message.info = { $case: "function", function: Function.fromPartial(object.info.function) }; - } - if (object.info?.$case === "user" && object.info?.user !== undefined && object.info?.user !== null) { - message.info = { $case: "user", user: UserInfo.fromPartial(object.info.user) }; - } - if ( - object.info?.$case === "parallelUnitMapping" && - object.info?.parallelUnitMapping !== undefined && - object.info?.parallelUnitMapping !== null - ) { - message.info = { - $case: "parallelUnitMapping", - parallelUnitMapping: FragmentParallelUnitMapping.fromPartial(object.info.parallelUnitMapping), - }; - } - if (object.info?.$case === "node" && object.info?.node !== undefined && object.info?.node !== null) { - message.info = { $case: "node", node: WorkerNode.fromPartial(object.info.node) }; - } - if ( - object.info?.$case === "hummockSnapshot" && - object.info?.hummockSnapshot !== undefined && - object.info?.hummockSnapshot !== null - ) { - message.info = { - $case: "hummockSnapshot", - hummockSnapshot: HummockSnapshot.fromPartial(object.info.hummockSnapshot), - }; - } - if ( - object.info?.$case === "hummockVersionDeltas" && - object.info?.hummockVersionDeltas !== undefined && - object.info?.hummockVersionDeltas !== null - ) { - message.info = { - $case: "hummockVersionDeltas", - hummockVersionDeltas: HummockVersionDeltas.fromPartial(object.info.hummockVersionDeltas), - }; - } - if (object.info?.$case === "snapshot" && object.info?.snapshot !== undefined && object.info?.snapshot !== null) { - message.info = { $case: "snapshot", snapshot: MetaSnapshot.fromPartial(object.info.snapshot) }; - } - if ( - object.info?.$case === "metaBackupManifestId" && - object.info?.metaBackupManifestId !== undefined && - object.info?.metaBackupManifestId !== null - ) { - message.info = { - $case: "metaBackupManifestId", - metaBackupManifestId: MetaBackupManifestId.fromPartial(object.info.metaBackupManifestId), - }; - } - if ( - object.info?.$case === "systemParams" && - object.info?.systemParams !== undefined && - object.info?.systemParams !== null - ) { - message.info = { $case: "systemParams", systemParams: SystemParams.fromPartial(object.info.systemParams) }; - } - if ( - object.info?.$case === "hummockWriteLimits" && - object.info?.hummockWriteLimits !== undefined && - object.info?.hummockWriteLimits !== null - ) { - message.info = { - $case: "hummockWriteLimits", - hummockWriteLimits: WriteLimits.fromPartial(object.info.hummockWriteLimits), - }; - } - return message; - }, -}; - -function createBasePauseRequest(): PauseRequest { - return {}; -} - -export const PauseRequest = { - fromJSON(_: any): PauseRequest { - return {}; - }, - - toJSON(_: PauseRequest): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): PauseRequest { - const message = createBasePauseRequest(); - return message; - }, -}; - -function createBasePauseResponse(): PauseResponse { - return {}; -} - -export const PauseResponse = { - fromJSON(_: any): PauseResponse { - return {}; - }, - - toJSON(_: PauseResponse): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): PauseResponse { - const message = createBasePauseResponse(); - return message; - }, -}; - -function createBaseResumeRequest(): ResumeRequest { - return {}; -} - -export const ResumeRequest = { - fromJSON(_: any): ResumeRequest { - return {}; - }, - - toJSON(_: ResumeRequest): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): ResumeRequest { - const message = createBaseResumeRequest(); - return message; - }, -}; - -function createBaseResumeResponse(): ResumeResponse { - return {}; -} - -export const ResumeResponse = { - fromJSON(_: any): ResumeResponse { - return {}; - }, - - toJSON(_: ResumeResponse): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): ResumeResponse { - const message = createBaseResumeResponse(); - return message; - }, -}; - -function createBaseGetClusterInfoRequest(): GetClusterInfoRequest { - return {}; -} - -export const GetClusterInfoRequest = { - fromJSON(_: any): GetClusterInfoRequest { - return {}; - }, - - toJSON(_: GetClusterInfoRequest): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): GetClusterInfoRequest { - const message = createBaseGetClusterInfoRequest(); - return message; - }, -}; - -function createBaseGetClusterInfoResponse(): GetClusterInfoResponse { - return { workerNodes: [], tableFragments: [], actorSplits: {}, sourceInfos: {} }; -} - -export const GetClusterInfoResponse = { - fromJSON(object: any): GetClusterInfoResponse { - return { - workerNodes: Array.isArray(object?.workerNodes) ? object.workerNodes.map((e: any) => WorkerNode.fromJSON(e)) : [], - tableFragments: Array.isArray(object?.tableFragments) - ? object.tableFragments.map((e: any) => TableFragments.fromJSON(e)) - : [], - actorSplits: isObject(object.actorSplits) - ? Object.entries(object.actorSplits).reduce<{ [key: number]: ConnectorSplits }>((acc, [key, value]) => { - acc[Number(key)] = ConnectorSplits.fromJSON(value); - return acc; - }, {}) - : {}, - sourceInfos: isObject(object.sourceInfos) - ? Object.entries(object.sourceInfos).reduce<{ [key: number]: Source }>((acc, [key, value]) => { - acc[Number(key)] = Source.fromJSON(value); - return acc; - }, {}) - : {}, - }; - }, - - toJSON(message: GetClusterInfoResponse): unknown { - const obj: any = {}; - if (message.workerNodes) { - obj.workerNodes = message.workerNodes.map((e) => e ? WorkerNode.toJSON(e) : undefined); - } else { - obj.workerNodes = []; - } - if (message.tableFragments) { - obj.tableFragments = message.tableFragments.map((e) => e ? TableFragments.toJSON(e) : undefined); - } else { - obj.tableFragments = []; - } - obj.actorSplits = {}; - if (message.actorSplits) { - Object.entries(message.actorSplits).forEach(([k, v]) => { - obj.actorSplits[k] = ConnectorSplits.toJSON(v); - }); - } - obj.sourceInfos = {}; - if (message.sourceInfos) { - Object.entries(message.sourceInfos).forEach(([k, v]) => { - obj.sourceInfos[k] = Source.toJSON(v); - }); - } - return obj; - }, - - fromPartial, I>>(object: I): GetClusterInfoResponse { - const message = createBaseGetClusterInfoResponse(); - message.workerNodes = object.workerNodes?.map((e) => WorkerNode.fromPartial(e)) || []; - message.tableFragments = object.tableFragments?.map((e) => TableFragments.fromPartial(e)) || []; - message.actorSplits = Object.entries(object.actorSplits ?? {}).reduce<{ [key: number]: ConnectorSplits }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[Number(key)] = ConnectorSplits.fromPartial(value); - } - return acc; - }, - {}, - ); - message.sourceInfos = Object.entries(object.sourceInfos ?? {}).reduce<{ [key: number]: Source }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[Number(key)] = Source.fromPartial(value); - } - return acc; - }, - {}, - ); - return message; - }, -}; - -function createBaseGetClusterInfoResponse_ActorSplitsEntry(): GetClusterInfoResponse_ActorSplitsEntry { - return { key: 0, value: undefined }; -} - -export const GetClusterInfoResponse_ActorSplitsEntry = { - fromJSON(object: any): GetClusterInfoResponse_ActorSplitsEntry { - return { - key: isSet(object.key) ? Number(object.key) : 0, - value: isSet(object.value) ? ConnectorSplits.fromJSON(object.value) : undefined, - }; - }, - - toJSON(message: GetClusterInfoResponse_ActorSplitsEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = Math.round(message.key)); - message.value !== undefined && (obj.value = message.value ? ConnectorSplits.toJSON(message.value) : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): GetClusterInfoResponse_ActorSplitsEntry { - const message = createBaseGetClusterInfoResponse_ActorSplitsEntry(); - message.key = object.key ?? 0; - message.value = (object.value !== undefined && object.value !== null) - ? ConnectorSplits.fromPartial(object.value) - : undefined; - return message; - }, -}; - -function createBaseGetClusterInfoResponse_SourceInfosEntry(): GetClusterInfoResponse_SourceInfosEntry { - return { key: 0, value: undefined }; -} - -export const GetClusterInfoResponse_SourceInfosEntry = { - fromJSON(object: any): GetClusterInfoResponse_SourceInfosEntry { - return { - key: isSet(object.key) ? Number(object.key) : 0, - value: isSet(object.value) ? Source.fromJSON(object.value) : undefined, - }; - }, - - toJSON(message: GetClusterInfoResponse_SourceInfosEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = Math.round(message.key)); - message.value !== undefined && (obj.value = message.value ? Source.toJSON(message.value) : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): GetClusterInfoResponse_SourceInfosEntry { - const message = createBaseGetClusterInfoResponse_SourceInfosEntry(); - message.key = object.key ?? 0; - message.value = (object.value !== undefined && object.value !== null) - ? Source.fromPartial(object.value) - : undefined; - return message; - }, -}; - -function createBaseRescheduleRequest(): RescheduleRequest { - return { reschedules: {} }; -} - -export const RescheduleRequest = { - fromJSON(object: any): RescheduleRequest { - return { - reschedules: isObject(object.reschedules) - ? Object.entries(object.reschedules).reduce<{ [key: number]: RescheduleRequest_Reschedule }>( - (acc, [key, value]) => { - acc[Number(key)] = RescheduleRequest_Reschedule.fromJSON(value); - return acc; - }, - {}, - ) - : {}, - }; - }, - - toJSON(message: RescheduleRequest): unknown { - const obj: any = {}; - obj.reschedules = {}; - if (message.reschedules) { - Object.entries(message.reschedules).forEach(([k, v]) => { - obj.reschedules[k] = RescheduleRequest_Reschedule.toJSON(v); - }); - } - return obj; - }, - - fromPartial, I>>(object: I): RescheduleRequest { - const message = createBaseRescheduleRequest(); - message.reschedules = Object.entries(object.reschedules ?? {}).reduce< - { [key: number]: RescheduleRequest_Reschedule } - >((acc, [key, value]) => { - if (value !== undefined) { - acc[Number(key)] = RescheduleRequest_Reschedule.fromPartial(value); - } - return acc; - }, {}); - return message; - }, -}; - -function createBaseRescheduleRequest_Reschedule(): RescheduleRequest_Reschedule { - return { addedParallelUnits: [], removedParallelUnits: [] }; -} - -export const RescheduleRequest_Reschedule = { - fromJSON(object: any): RescheduleRequest_Reschedule { - return { - addedParallelUnits: Array.isArray(object?.addedParallelUnits) - ? object.addedParallelUnits.map((e: any) => Number(e)) - : [], - removedParallelUnits: Array.isArray(object?.removedParallelUnits) - ? object.removedParallelUnits.map((e: any) => Number(e)) - : [], - }; - }, - - toJSON(message: RescheduleRequest_Reschedule): unknown { - const obj: any = {}; - if (message.addedParallelUnits) { - obj.addedParallelUnits = message.addedParallelUnits.map((e) => Math.round(e)); - } else { - obj.addedParallelUnits = []; - } - if (message.removedParallelUnits) { - obj.removedParallelUnits = message.removedParallelUnits.map((e) => Math.round(e)); - } else { - obj.removedParallelUnits = []; - } - return obj; - }, - - fromPartial, I>>(object: I): RescheduleRequest_Reschedule { - const message = createBaseRescheduleRequest_Reschedule(); - message.addedParallelUnits = object.addedParallelUnits?.map((e) => e) || []; - message.removedParallelUnits = object.removedParallelUnits?.map((e) => e) || []; - return message; - }, -}; - -function createBaseRescheduleRequest_ReschedulesEntry(): RescheduleRequest_ReschedulesEntry { - return { key: 0, value: undefined }; -} - -export const RescheduleRequest_ReschedulesEntry = { - fromJSON(object: any): RescheduleRequest_ReschedulesEntry { - return { - key: isSet(object.key) ? Number(object.key) : 0, - value: isSet(object.value) ? RescheduleRequest_Reschedule.fromJSON(object.value) : undefined, - }; - }, - - toJSON(message: RescheduleRequest_ReschedulesEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = Math.round(message.key)); - message.value !== undefined && - (obj.value = message.value ? RescheduleRequest_Reschedule.toJSON(message.value) : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): RescheduleRequest_ReschedulesEntry { - const message = createBaseRescheduleRequest_ReschedulesEntry(); - message.key = object.key ?? 0; - message.value = (object.value !== undefined && object.value !== null) - ? RescheduleRequest_Reschedule.fromPartial(object.value) - : undefined; - return message; - }, -}; - -function createBaseRescheduleResponse(): RescheduleResponse { - return { success: false }; -} - -export const RescheduleResponse = { - fromJSON(object: any): RescheduleResponse { - return { success: isSet(object.success) ? Boolean(object.success) : false }; - }, - - toJSON(message: RescheduleResponse): unknown { - const obj: any = {}; - message.success !== undefined && (obj.success = message.success); - return obj; - }, - - fromPartial, I>>(object: I): RescheduleResponse { - const message = createBaseRescheduleResponse(); - message.success = object.success ?? false; - return message; - }, -}; - -function createBaseMembersRequest(): MembersRequest { - return {}; -} - -export const MembersRequest = { - fromJSON(_: any): MembersRequest { - return {}; - }, - - toJSON(_: MembersRequest): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): MembersRequest { - const message = createBaseMembersRequest(); - return message; - }, -}; - -function createBaseMetaMember(): MetaMember { - return { address: undefined, isLeader: false }; -} - -export const MetaMember = { - fromJSON(object: any): MetaMember { - return { - address: isSet(object.address) ? HostAddress.fromJSON(object.address) : undefined, - isLeader: isSet(object.isLeader) ? Boolean(object.isLeader) : false, - }; - }, - - toJSON(message: MetaMember): unknown { - const obj: any = {}; - message.address !== undefined && (obj.address = message.address ? HostAddress.toJSON(message.address) : undefined); - message.isLeader !== undefined && (obj.isLeader = message.isLeader); - return obj; - }, - - fromPartial, I>>(object: I): MetaMember { - const message = createBaseMetaMember(); - message.address = (object.address !== undefined && object.address !== null) - ? HostAddress.fromPartial(object.address) - : undefined; - message.isLeader = object.isLeader ?? false; - return message; - }, -}; - -function createBaseMembersResponse(): MembersResponse { - return { members: [] }; -} - -export const MembersResponse = { - fromJSON(object: any): MembersResponse { - return { members: Array.isArray(object?.members) ? object.members.map((e: any) => MetaMember.fromJSON(e)) : [] }; - }, - - toJSON(message: MembersResponse): unknown { - const obj: any = {}; - if (message.members) { - obj.members = message.members.map((e) => e ? MetaMember.toJSON(e) : undefined); - } else { - obj.members = []; - } - return obj; - }, - - fromPartial, I>>(object: I): MembersResponse { - const message = createBaseMembersResponse(); - message.members = object.members?.map((e) => MetaMember.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseSystemParams(): SystemParams { - return { - barrierIntervalMs: undefined, - checkpointFrequency: undefined, - sstableSizeMb: undefined, - blockSizeKb: undefined, - bloomFalsePositive: undefined, - stateStore: undefined, - dataDirectory: undefined, - backupStorageUrl: undefined, - backupStorageDirectory: undefined, - telemetryEnabled: undefined, - }; -} - -export const SystemParams = { - fromJSON(object: any): SystemParams { - return { - barrierIntervalMs: isSet(object.barrierIntervalMs) ? Number(object.barrierIntervalMs) : undefined, - checkpointFrequency: isSet(object.checkpointFrequency) ? Number(object.checkpointFrequency) : undefined, - sstableSizeMb: isSet(object.sstableSizeMb) ? Number(object.sstableSizeMb) : undefined, - blockSizeKb: isSet(object.blockSizeKb) ? Number(object.blockSizeKb) : undefined, - bloomFalsePositive: isSet(object.bloomFalsePositive) ? Number(object.bloomFalsePositive) : undefined, - stateStore: isSet(object.stateStore) ? String(object.stateStore) : undefined, - dataDirectory: isSet(object.dataDirectory) ? String(object.dataDirectory) : undefined, - backupStorageUrl: isSet(object.backupStorageUrl) ? String(object.backupStorageUrl) : undefined, - backupStorageDirectory: isSet(object.backupStorageDirectory) ? String(object.backupStorageDirectory) : undefined, - telemetryEnabled: isSet(object.telemetryEnabled) ? Boolean(object.telemetryEnabled) : undefined, - }; - }, - - toJSON(message: SystemParams): unknown { - const obj: any = {}; - message.barrierIntervalMs !== undefined && (obj.barrierIntervalMs = Math.round(message.barrierIntervalMs)); - message.checkpointFrequency !== undefined && (obj.checkpointFrequency = Math.round(message.checkpointFrequency)); - message.sstableSizeMb !== undefined && (obj.sstableSizeMb = Math.round(message.sstableSizeMb)); - message.blockSizeKb !== undefined && (obj.blockSizeKb = Math.round(message.blockSizeKb)); - message.bloomFalsePositive !== undefined && (obj.bloomFalsePositive = message.bloomFalsePositive); - message.stateStore !== undefined && (obj.stateStore = message.stateStore); - message.dataDirectory !== undefined && (obj.dataDirectory = message.dataDirectory); - message.backupStorageUrl !== undefined && (obj.backupStorageUrl = message.backupStorageUrl); - message.backupStorageDirectory !== undefined && (obj.backupStorageDirectory = message.backupStorageDirectory); - message.telemetryEnabled !== undefined && (obj.telemetryEnabled = message.telemetryEnabled); - return obj; - }, - - fromPartial, I>>(object: I): SystemParams { - const message = createBaseSystemParams(); - message.barrierIntervalMs = object.barrierIntervalMs ?? undefined; - message.checkpointFrequency = object.checkpointFrequency ?? undefined; - message.sstableSizeMb = object.sstableSizeMb ?? undefined; - message.blockSizeKb = object.blockSizeKb ?? undefined; - message.bloomFalsePositive = object.bloomFalsePositive ?? undefined; - message.stateStore = object.stateStore ?? undefined; - message.dataDirectory = object.dataDirectory ?? undefined; - message.backupStorageUrl = object.backupStorageUrl ?? undefined; - message.backupStorageDirectory = object.backupStorageDirectory ?? undefined; - message.telemetryEnabled = object.telemetryEnabled ?? undefined; - return message; - }, -}; - -function createBaseGetSystemParamsRequest(): GetSystemParamsRequest { - return {}; -} - -export const GetSystemParamsRequest = { - fromJSON(_: any): GetSystemParamsRequest { - return {}; - }, - - toJSON(_: GetSystemParamsRequest): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): GetSystemParamsRequest { - const message = createBaseGetSystemParamsRequest(); - return message; - }, -}; - -function createBaseGetSystemParamsResponse(): GetSystemParamsResponse { - return { params: undefined }; -} - -export const GetSystemParamsResponse = { - fromJSON(object: any): GetSystemParamsResponse { - return { params: isSet(object.params) ? SystemParams.fromJSON(object.params) : undefined }; - }, - - toJSON(message: GetSystemParamsResponse): unknown { - const obj: any = {}; - message.params !== undefined && (obj.params = message.params ? SystemParams.toJSON(message.params) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): GetSystemParamsResponse { - const message = createBaseGetSystemParamsResponse(); - message.params = (object.params !== undefined && object.params !== null) - ? SystemParams.fromPartial(object.params) - : undefined; - return message; - }, -}; - -function createBaseSetSystemParamRequest(): SetSystemParamRequest { - return { param: "", value: undefined }; -} - -export const SetSystemParamRequest = { - fromJSON(object: any): SetSystemParamRequest { - return { - param: isSet(object.param) ? String(object.param) : "", - value: isSet(object.value) ? String(object.value) : undefined, - }; - }, - - toJSON(message: SetSystemParamRequest): unknown { - const obj: any = {}; - message.param !== undefined && (obj.param = message.param); - message.value !== undefined && (obj.value = message.value); - return obj; - }, - - fromPartial, I>>(object: I): SetSystemParamRequest { - const message = createBaseSetSystemParamRequest(); - message.param = object.param ?? ""; - message.value = object.value ?? undefined; - return message; - }, -}; - -function createBaseSetSystemParamResponse(): SetSystemParamResponse { - return {}; -} - -export const SetSystemParamResponse = { - fromJSON(_: any): SetSystemParamResponse { - return {}; - }, - - toJSON(_: SetSystemParamResponse): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): SetSystemParamResponse { - const message = createBaseSetSystemParamResponse(); - return message; - }, -}; - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> - : T extends { $case: string } ? { [K in keyof Omit]?: DeepPartial } & { $case: T["$case"] } - : T extends {} ? { [K in keyof T]?: DeepPartial } - : Partial; - -type KeysOfUnion = T extends T ? keyof T : never; -export type Exact = P extends Builtin ? P - : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; - -function isObject(value: any): boolean { - return typeof value === "object" && value !== null; -} - -function isSet(value: any): boolean { - return value !== null && value !== undefined; -} diff --git a/dashboard/proto/gen/monitor_service.ts b/dashboard/proto/gen/monitor_service.ts deleted file mode 100644 index 3719692cb88d..000000000000 --- a/dashboard/proto/gen/monitor_service.ts +++ /dev/null @@ -1,274 +0,0 @@ -/* eslint-disable */ - -export const protobufPackage = "monitor_service"; - -export interface StackTraceRequest { -} - -export interface StackTraceResponse { - actorTraces: { [key: number]: string }; - rpcTraces: { [key: string]: string }; -} - -export interface StackTraceResponse_ActorTracesEntry { - key: number; - value: string; -} - -export interface StackTraceResponse_RpcTracesEntry { - key: string; - value: string; -} - -export interface ProfilingRequest { - /** How long the profiling should last. */ - sleepS: number; -} - -export interface ProfilingResponse { - result: Uint8Array; -} - -function createBaseStackTraceRequest(): StackTraceRequest { - return {}; -} - -export const StackTraceRequest = { - fromJSON(_: any): StackTraceRequest { - return {}; - }, - - toJSON(_: StackTraceRequest): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): StackTraceRequest { - const message = createBaseStackTraceRequest(); - return message; - }, -}; - -function createBaseStackTraceResponse(): StackTraceResponse { - return { actorTraces: {}, rpcTraces: {} }; -} - -export const StackTraceResponse = { - fromJSON(object: any): StackTraceResponse { - return { - actorTraces: isObject(object.actorTraces) - ? Object.entries(object.actorTraces).reduce<{ [key: number]: string }>((acc, [key, value]) => { - acc[Number(key)] = String(value); - return acc; - }, {}) - : {}, - rpcTraces: isObject(object.rpcTraces) - ? Object.entries(object.rpcTraces).reduce<{ [key: string]: string }>((acc, [key, value]) => { - acc[key] = String(value); - return acc; - }, {}) - : {}, - }; - }, - - toJSON(message: StackTraceResponse): unknown { - const obj: any = {}; - obj.actorTraces = {}; - if (message.actorTraces) { - Object.entries(message.actorTraces).forEach(([k, v]) => { - obj.actorTraces[k] = v; - }); - } - obj.rpcTraces = {}; - if (message.rpcTraces) { - Object.entries(message.rpcTraces).forEach(([k, v]) => { - obj.rpcTraces[k] = v; - }); - } - return obj; - }, - - fromPartial, I>>(object: I): StackTraceResponse { - const message = createBaseStackTraceResponse(); - message.actorTraces = Object.entries(object.actorTraces ?? {}).reduce<{ [key: number]: string }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[Number(key)] = String(value); - } - return acc; - }, - {}, - ); - message.rpcTraces = Object.entries(object.rpcTraces ?? {}).reduce<{ [key: string]: string }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[key] = String(value); - } - return acc; - }, - {}, - ); - return message; - }, -}; - -function createBaseStackTraceResponse_ActorTracesEntry(): StackTraceResponse_ActorTracesEntry { - return { key: 0, value: "" }; -} - -export const StackTraceResponse_ActorTracesEntry = { - fromJSON(object: any): StackTraceResponse_ActorTracesEntry { - return { key: isSet(object.key) ? Number(object.key) : 0, value: isSet(object.value) ? String(object.value) : "" }; - }, - - toJSON(message: StackTraceResponse_ActorTracesEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = Math.round(message.key)); - message.value !== undefined && (obj.value = message.value); - return obj; - }, - - fromPartial, I>>( - object: I, - ): StackTraceResponse_ActorTracesEntry { - const message = createBaseStackTraceResponse_ActorTracesEntry(); - message.key = object.key ?? 0; - message.value = object.value ?? ""; - return message; - }, -}; - -function createBaseStackTraceResponse_RpcTracesEntry(): StackTraceResponse_RpcTracesEntry { - return { key: "", value: "" }; -} - -export const StackTraceResponse_RpcTracesEntry = { - fromJSON(object: any): StackTraceResponse_RpcTracesEntry { - return { key: isSet(object.key) ? String(object.key) : "", value: isSet(object.value) ? String(object.value) : "" }; - }, - - toJSON(message: StackTraceResponse_RpcTracesEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = message.key); - message.value !== undefined && (obj.value = message.value); - return obj; - }, - - fromPartial, I>>( - object: I, - ): StackTraceResponse_RpcTracesEntry { - const message = createBaseStackTraceResponse_RpcTracesEntry(); - message.key = object.key ?? ""; - message.value = object.value ?? ""; - return message; - }, -}; - -function createBaseProfilingRequest(): ProfilingRequest { - return { sleepS: 0 }; -} - -export const ProfilingRequest = { - fromJSON(object: any): ProfilingRequest { - return { sleepS: isSet(object.sleepS) ? Number(object.sleepS) : 0 }; - }, - - toJSON(message: ProfilingRequest): unknown { - const obj: any = {}; - message.sleepS !== undefined && (obj.sleepS = Math.round(message.sleepS)); - return obj; - }, - - fromPartial, I>>(object: I): ProfilingRequest { - const message = createBaseProfilingRequest(); - message.sleepS = object.sleepS ?? 0; - return message; - }, -}; - -function createBaseProfilingResponse(): ProfilingResponse { - return { result: new Uint8Array() }; -} - -export const ProfilingResponse = { - fromJSON(object: any): ProfilingResponse { - return { result: isSet(object.result) ? bytesFromBase64(object.result) : new Uint8Array() }; - }, - - toJSON(message: ProfilingResponse): unknown { - const obj: any = {}; - message.result !== undefined && - (obj.result = base64FromBytes(message.result !== undefined ? message.result : new Uint8Array())); - return obj; - }, - - fromPartial, I>>(object: I): ProfilingResponse { - const message = createBaseProfilingResponse(); - message.result = object.result ?? new Uint8Array(); - return message; - }, -}; - -declare var self: any | undefined; -declare var window: any | undefined; -declare var global: any | undefined; -var globalThis: any = (() => { - if (typeof globalThis !== "undefined") { - return globalThis; - } - if (typeof self !== "undefined") { - return self; - } - if (typeof window !== "undefined") { - return window; - } - if (typeof global !== "undefined") { - return global; - } - throw "Unable to locate global object"; -})(); - -function bytesFromBase64(b64: string): Uint8Array { - if (globalThis.Buffer) { - return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); - } else { - const bin = globalThis.atob(b64); - const arr = new Uint8Array(bin.length); - for (let i = 0; i < bin.length; ++i) { - arr[i] = bin.charCodeAt(i); - } - return arr; - } -} - -function base64FromBytes(arr: Uint8Array): string { - if (globalThis.Buffer) { - return globalThis.Buffer.from(arr).toString("base64"); - } else { - const bin: string[] = []; - arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); - }); - return globalThis.btoa(bin.join("")); - } -} - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> - : T extends { $case: string } ? { [K in keyof Omit]?: DeepPartial } & { $case: T["$case"] } - : T extends {} ? { [K in keyof T]?: DeepPartial } - : Partial; - -type KeysOfUnion = T extends T ? keyof T : never; -export type Exact = P extends Builtin ? P - : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; - -function isObject(value: any): boolean { - return typeof value === "object" && value !== null; -} - -function isSet(value: any): boolean { - return value !== null && value !== undefined; -} diff --git a/dashboard/proto/gen/plan_common.ts b/dashboard/proto/gen/plan_common.ts deleted file mode 100644 index 384b8d11554c..000000000000 --- a/dashboard/proto/gen/plan_common.ts +++ /dev/null @@ -1,418 +0,0 @@ -/* eslint-disable */ -import { ColumnOrder } from "./common"; -import { DataType } from "./data"; - -export const protobufPackage = "plan_common"; - -export const JoinType = { - /** - * UNSPECIFIED - Note that it comes from Calcite's JoinRelType. - * DO NOT HAVE direction for SEMI and ANTI now. - */ - UNSPECIFIED: "UNSPECIFIED", - INNER: "INNER", - LEFT_OUTER: "LEFT_OUTER", - RIGHT_OUTER: "RIGHT_OUTER", - FULL_OUTER: "FULL_OUTER", - LEFT_SEMI: "LEFT_SEMI", - LEFT_ANTI: "LEFT_ANTI", - RIGHT_SEMI: "RIGHT_SEMI", - RIGHT_ANTI: "RIGHT_ANTI", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type JoinType = typeof JoinType[keyof typeof JoinType]; - -export function joinTypeFromJSON(object: any): JoinType { - switch (object) { - case 0: - case "UNSPECIFIED": - return JoinType.UNSPECIFIED; - case 1: - case "INNER": - return JoinType.INNER; - case 2: - case "LEFT_OUTER": - return JoinType.LEFT_OUTER; - case 3: - case "RIGHT_OUTER": - return JoinType.RIGHT_OUTER; - case 4: - case "FULL_OUTER": - return JoinType.FULL_OUTER; - case 5: - case "LEFT_SEMI": - return JoinType.LEFT_SEMI; - case 6: - case "LEFT_ANTI": - return JoinType.LEFT_ANTI; - case 7: - case "RIGHT_SEMI": - return JoinType.RIGHT_SEMI; - case 8: - case "RIGHT_ANTI": - return JoinType.RIGHT_ANTI; - case -1: - case "UNRECOGNIZED": - default: - return JoinType.UNRECOGNIZED; - } -} - -export function joinTypeToJSON(object: JoinType): string { - switch (object) { - case JoinType.UNSPECIFIED: - return "UNSPECIFIED"; - case JoinType.INNER: - return "INNER"; - case JoinType.LEFT_OUTER: - return "LEFT_OUTER"; - case JoinType.RIGHT_OUTER: - return "RIGHT_OUTER"; - case JoinType.FULL_OUTER: - return "FULL_OUTER"; - case JoinType.LEFT_SEMI: - return "LEFT_SEMI"; - case JoinType.LEFT_ANTI: - return "LEFT_ANTI"; - case JoinType.RIGHT_SEMI: - return "RIGHT_SEMI"; - case JoinType.RIGHT_ANTI: - return "RIGHT_ANTI"; - case JoinType.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export const RowFormatType = { - ROW_UNSPECIFIED: "ROW_UNSPECIFIED", - JSON: "JSON", - PROTOBUF: "PROTOBUF", - DEBEZIUM_JSON: "DEBEZIUM_JSON", - AVRO: "AVRO", - MAXWELL: "MAXWELL", - CANAL_JSON: "CANAL_JSON", - CSV: "CSV", - NATIVE: "NATIVE", - DEBEZIUM_AVRO: "DEBEZIUM_AVRO", - UPSERT_JSON: "UPSERT_JSON", - UPSERT_AVRO: "UPSERT_AVRO", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type RowFormatType = typeof RowFormatType[keyof typeof RowFormatType]; - -export function rowFormatTypeFromJSON(object: any): RowFormatType { - switch (object) { - case 0: - case "ROW_UNSPECIFIED": - return RowFormatType.ROW_UNSPECIFIED; - case 1: - case "JSON": - return RowFormatType.JSON; - case 2: - case "PROTOBUF": - return RowFormatType.PROTOBUF; - case 3: - case "DEBEZIUM_JSON": - return RowFormatType.DEBEZIUM_JSON; - case 4: - case "AVRO": - return RowFormatType.AVRO; - case 5: - case "MAXWELL": - return RowFormatType.MAXWELL; - case 6: - case "CANAL_JSON": - return RowFormatType.CANAL_JSON; - case 7: - case "CSV": - return RowFormatType.CSV; - case 8: - case "NATIVE": - return RowFormatType.NATIVE; - case 9: - case "DEBEZIUM_AVRO": - return RowFormatType.DEBEZIUM_AVRO; - case 10: - case "UPSERT_JSON": - return RowFormatType.UPSERT_JSON; - case 11: - case "UPSERT_AVRO": - return RowFormatType.UPSERT_AVRO; - case -1: - case "UNRECOGNIZED": - default: - return RowFormatType.UNRECOGNIZED; - } -} - -export function rowFormatTypeToJSON(object: RowFormatType): string { - switch (object) { - case RowFormatType.ROW_UNSPECIFIED: - return "ROW_UNSPECIFIED"; - case RowFormatType.JSON: - return "JSON"; - case RowFormatType.PROTOBUF: - return "PROTOBUF"; - case RowFormatType.DEBEZIUM_JSON: - return "DEBEZIUM_JSON"; - case RowFormatType.AVRO: - return "AVRO"; - case RowFormatType.MAXWELL: - return "MAXWELL"; - case RowFormatType.CANAL_JSON: - return "CANAL_JSON"; - case RowFormatType.CSV: - return "CSV"; - case RowFormatType.NATIVE: - return "NATIVE"; - case RowFormatType.DEBEZIUM_AVRO: - return "DEBEZIUM_AVRO"; - case RowFormatType.UPSERT_JSON: - return "UPSERT_JSON"; - case RowFormatType.UPSERT_AVRO: - return "UPSERT_AVRO"; - case RowFormatType.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -/** Field is a column in the streaming or batch plan. */ -export interface Field { - dataType: DataType | undefined; - name: string; -} - -export interface ColumnDesc { - columnType: DataType | undefined; - columnId: number; - /** - * we store the column name in column desc now just for debug, but in future - * we should store it in ColumnCatalog but not here - */ - name: string; - /** For STRUCT type. */ - fieldDescs: ColumnDesc[]; - /** - * The user-defined type's name. Empty if the column type is a builtin type. - * For example, when the type is created from a protobuf schema file, - * this field will store the message name. - */ - typeName: string; -} - -export interface ColumnCatalog { - columnDesc: ColumnDesc | undefined; - isHidden: boolean; -} - -export interface StorageTableDesc { - tableId: number; - columns: ColumnDesc[]; - /** TODO: may refactor primary key representations */ - pk: ColumnOrder[]; - distKeyInPkIndices: number[]; - retentionSeconds: number; - valueIndices: number[]; - readPrefixLenHint: number; - /** - * Whether the table is versioned. If `true`, column-aware row encoding will be used - * to be compatible with schema changes. - */ - versioned: boolean; -} - -function createBaseField(): Field { - return { dataType: undefined, name: "" }; -} - -export const Field = { - fromJSON(object: any): Field { - return { - dataType: isSet(object.dataType) ? DataType.fromJSON(object.dataType) : undefined, - name: isSet(object.name) ? String(object.name) : "", - }; - }, - - toJSON(message: Field): unknown { - const obj: any = {}; - message.dataType !== undefined && (obj.dataType = message.dataType ? DataType.toJSON(message.dataType) : undefined); - message.name !== undefined && (obj.name = message.name); - return obj; - }, - - fromPartial, I>>(object: I): Field { - const message = createBaseField(); - message.dataType = (object.dataType !== undefined && object.dataType !== null) - ? DataType.fromPartial(object.dataType) - : undefined; - message.name = object.name ?? ""; - return message; - }, -}; - -function createBaseColumnDesc(): ColumnDesc { - return { columnType: undefined, columnId: 0, name: "", fieldDescs: [], typeName: "" }; -} - -export const ColumnDesc = { - fromJSON(object: any): ColumnDesc { - return { - columnType: isSet(object.columnType) ? DataType.fromJSON(object.columnType) : undefined, - columnId: isSet(object.columnId) ? Number(object.columnId) : 0, - name: isSet(object.name) ? String(object.name) : "", - fieldDescs: Array.isArray(object?.fieldDescs) ? object.fieldDescs.map((e: any) => ColumnDesc.fromJSON(e)) : [], - typeName: isSet(object.typeName) ? String(object.typeName) : "", - }; - }, - - toJSON(message: ColumnDesc): unknown { - const obj: any = {}; - message.columnType !== undefined && - (obj.columnType = message.columnType ? DataType.toJSON(message.columnType) : undefined); - message.columnId !== undefined && (obj.columnId = Math.round(message.columnId)); - message.name !== undefined && (obj.name = message.name); - if (message.fieldDescs) { - obj.fieldDescs = message.fieldDescs.map((e) => e ? ColumnDesc.toJSON(e) : undefined); - } else { - obj.fieldDescs = []; - } - message.typeName !== undefined && (obj.typeName = message.typeName); - return obj; - }, - - fromPartial, I>>(object: I): ColumnDesc { - const message = createBaseColumnDesc(); - message.columnType = (object.columnType !== undefined && object.columnType !== null) - ? DataType.fromPartial(object.columnType) - : undefined; - message.columnId = object.columnId ?? 0; - message.name = object.name ?? ""; - message.fieldDescs = object.fieldDescs?.map((e) => ColumnDesc.fromPartial(e)) || []; - message.typeName = object.typeName ?? ""; - return message; - }, -}; - -function createBaseColumnCatalog(): ColumnCatalog { - return { columnDesc: undefined, isHidden: false }; -} - -export const ColumnCatalog = { - fromJSON(object: any): ColumnCatalog { - return { - columnDesc: isSet(object.columnDesc) ? ColumnDesc.fromJSON(object.columnDesc) : undefined, - isHidden: isSet(object.isHidden) ? Boolean(object.isHidden) : false, - }; - }, - - toJSON(message: ColumnCatalog): unknown { - const obj: any = {}; - message.columnDesc !== undefined && - (obj.columnDesc = message.columnDesc ? ColumnDesc.toJSON(message.columnDesc) : undefined); - message.isHidden !== undefined && (obj.isHidden = message.isHidden); - return obj; - }, - - fromPartial, I>>(object: I): ColumnCatalog { - const message = createBaseColumnCatalog(); - message.columnDesc = (object.columnDesc !== undefined && object.columnDesc !== null) - ? ColumnDesc.fromPartial(object.columnDesc) - : undefined; - message.isHidden = object.isHidden ?? false; - return message; - }, -}; - -function createBaseStorageTableDesc(): StorageTableDesc { - return { - tableId: 0, - columns: [], - pk: [], - distKeyInPkIndices: [], - retentionSeconds: 0, - valueIndices: [], - readPrefixLenHint: 0, - versioned: false, - }; -} - -export const StorageTableDesc = { - fromJSON(object: any): StorageTableDesc { - return { - tableId: isSet(object.tableId) ? Number(object.tableId) : 0, - columns: Array.isArray(object?.columns) ? object.columns.map((e: any) => ColumnDesc.fromJSON(e)) : [], - pk: Array.isArray(object?.pk) ? object.pk.map((e: any) => ColumnOrder.fromJSON(e)) : [], - distKeyInPkIndices: Array.isArray(object?.distKeyInPkIndices) - ? object.distKeyInPkIndices.map((e: any) => Number(e)) - : [], - retentionSeconds: isSet(object.retentionSeconds) ? Number(object.retentionSeconds) : 0, - valueIndices: Array.isArray(object?.valueIndices) - ? object.valueIndices.map((e: any) => Number(e)) - : [], - readPrefixLenHint: isSet(object.readPrefixLenHint) ? Number(object.readPrefixLenHint) : 0, - versioned: isSet(object.versioned) ? Boolean(object.versioned) : false, - }; - }, - - toJSON(message: StorageTableDesc): unknown { - const obj: any = {}; - message.tableId !== undefined && (obj.tableId = Math.round(message.tableId)); - if (message.columns) { - obj.columns = message.columns.map((e) => e ? ColumnDesc.toJSON(e) : undefined); - } else { - obj.columns = []; - } - if (message.pk) { - obj.pk = message.pk.map((e) => e ? ColumnOrder.toJSON(e) : undefined); - } else { - obj.pk = []; - } - if (message.distKeyInPkIndices) { - obj.distKeyInPkIndices = message.distKeyInPkIndices.map((e) => Math.round(e)); - } else { - obj.distKeyInPkIndices = []; - } - message.retentionSeconds !== undefined && (obj.retentionSeconds = Math.round(message.retentionSeconds)); - if (message.valueIndices) { - obj.valueIndices = message.valueIndices.map((e) => Math.round(e)); - } else { - obj.valueIndices = []; - } - message.readPrefixLenHint !== undefined && (obj.readPrefixLenHint = Math.round(message.readPrefixLenHint)); - message.versioned !== undefined && (obj.versioned = message.versioned); - return obj; - }, - - fromPartial, I>>(object: I): StorageTableDesc { - const message = createBaseStorageTableDesc(); - message.tableId = object.tableId ?? 0; - message.columns = object.columns?.map((e) => ColumnDesc.fromPartial(e)) || []; - message.pk = object.pk?.map((e) => ColumnOrder.fromPartial(e)) || []; - message.distKeyInPkIndices = object.distKeyInPkIndices?.map((e) => e) || []; - message.retentionSeconds = object.retentionSeconds ?? 0; - message.valueIndices = object.valueIndices?.map((e) => e) || []; - message.readPrefixLenHint = object.readPrefixLenHint ?? 0; - message.versioned = object.versioned ?? false; - return message; - }, -}; - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> - : T extends { $case: string } ? { [K in keyof Omit]?: DeepPartial } & { $case: T["$case"] } - : T extends {} ? { [K in keyof T]?: DeepPartial } - : Partial; - -type KeysOfUnion = T extends T ? keyof T : never; -export type Exact = P extends Builtin ? P - : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; - -function isSet(value: any): boolean { - return value !== null && value !== undefined; -} diff --git a/dashboard/proto/gen/source.ts b/dashboard/proto/gen/source.ts deleted file mode 100644 index 1d45c28375e7..000000000000 --- a/dashboard/proto/gen/source.ts +++ /dev/null @@ -1,162 +0,0 @@ -/* eslint-disable */ - -export const protobufPackage = "source"; - -export interface ConnectorSplit { - splitType: string; - encodedSplit: Uint8Array; -} - -export interface ConnectorSplits { - splits: ConnectorSplit[]; -} - -export interface SourceActorInfo { - actorId: number; - splits: ConnectorSplits | undefined; -} - -function createBaseConnectorSplit(): ConnectorSplit { - return { splitType: "", encodedSplit: new Uint8Array() }; -} - -export const ConnectorSplit = { - fromJSON(object: any): ConnectorSplit { - return { - splitType: isSet(object.splitType) ? String(object.splitType) : "", - encodedSplit: isSet(object.encodedSplit) ? bytesFromBase64(object.encodedSplit) : new Uint8Array(), - }; - }, - - toJSON(message: ConnectorSplit): unknown { - const obj: any = {}; - message.splitType !== undefined && (obj.splitType = message.splitType); - message.encodedSplit !== undefined && - (obj.encodedSplit = base64FromBytes( - message.encodedSplit !== undefined ? message.encodedSplit : new Uint8Array(), - )); - return obj; - }, - - fromPartial, I>>(object: I): ConnectorSplit { - const message = createBaseConnectorSplit(); - message.splitType = object.splitType ?? ""; - message.encodedSplit = object.encodedSplit ?? new Uint8Array(); - return message; - }, -}; - -function createBaseConnectorSplits(): ConnectorSplits { - return { splits: [] }; -} - -export const ConnectorSplits = { - fromJSON(object: any): ConnectorSplits { - return { splits: Array.isArray(object?.splits) ? object.splits.map((e: any) => ConnectorSplit.fromJSON(e)) : [] }; - }, - - toJSON(message: ConnectorSplits): unknown { - const obj: any = {}; - if (message.splits) { - obj.splits = message.splits.map((e) => e ? ConnectorSplit.toJSON(e) : undefined); - } else { - obj.splits = []; - } - return obj; - }, - - fromPartial, I>>(object: I): ConnectorSplits { - const message = createBaseConnectorSplits(); - message.splits = object.splits?.map((e) => ConnectorSplit.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseSourceActorInfo(): SourceActorInfo { - return { actorId: 0, splits: undefined }; -} - -export const SourceActorInfo = { - fromJSON(object: any): SourceActorInfo { - return { - actorId: isSet(object.actorId) ? Number(object.actorId) : 0, - splits: isSet(object.splits) ? ConnectorSplits.fromJSON(object.splits) : undefined, - }; - }, - - toJSON(message: SourceActorInfo): unknown { - const obj: any = {}; - message.actorId !== undefined && (obj.actorId = Math.round(message.actorId)); - message.splits !== undefined && (obj.splits = message.splits ? ConnectorSplits.toJSON(message.splits) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): SourceActorInfo { - const message = createBaseSourceActorInfo(); - message.actorId = object.actorId ?? 0; - message.splits = (object.splits !== undefined && object.splits !== null) - ? ConnectorSplits.fromPartial(object.splits) - : undefined; - return message; - }, -}; - -declare var self: any | undefined; -declare var window: any | undefined; -declare var global: any | undefined; -var globalThis: any = (() => { - if (typeof globalThis !== "undefined") { - return globalThis; - } - if (typeof self !== "undefined") { - return self; - } - if (typeof window !== "undefined") { - return window; - } - if (typeof global !== "undefined") { - return global; - } - throw "Unable to locate global object"; -})(); - -function bytesFromBase64(b64: string): Uint8Array { - if (globalThis.Buffer) { - return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); - } else { - const bin = globalThis.atob(b64); - const arr = new Uint8Array(bin.length); - for (let i = 0; i < bin.length; ++i) { - arr[i] = bin.charCodeAt(i); - } - return arr; - } -} - -function base64FromBytes(arr: Uint8Array): string { - if (globalThis.Buffer) { - return globalThis.Buffer.from(arr).toString("base64"); - } else { - const bin: string[] = []; - arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); - }); - return globalThis.btoa(bin.join("")); - } -} - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> - : T extends { $case: string } ? { [K in keyof Omit]?: DeepPartial } & { $case: T["$case"] } - : T extends {} ? { [K in keyof T]?: DeepPartial } - : Partial; - -type KeysOfUnion = T extends T ? keyof T : never; -export type Exact = P extends Builtin ? P - : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; - -function isSet(value: any): boolean { - return value !== null && value !== undefined; -} diff --git a/dashboard/proto/gen/stream_plan.ts b/dashboard/proto/gen/stream_plan.ts deleted file mode 100644 index 6e7391de8324..000000000000 --- a/dashboard/proto/gen/stream_plan.ts +++ /dev/null @@ -1,4602 +0,0 @@ -/* eslint-disable */ -import { SinkType, sinkTypeFromJSON, sinkTypeToJSON, StreamSourceInfo, Table, WatermarkDesc } from "./catalog"; -import { Buffer, ColumnOrder } from "./common"; -import { Datum, Epoch, IntervalUnit, StreamChunk } from "./data"; -import { AggCall, ExprNode, InputRef, ProjectSetSelectItem } from "./expr"; -import { - ColumnCatalog, - ColumnDesc, - Field, - JoinType, - joinTypeFromJSON, - joinTypeToJSON, - StorageTableDesc, -} from "./plan_common"; -import { ConnectorSplits } from "./source"; - -export const protobufPackage = "stream_plan"; - -export const HandleConflictBehavior = { - NO_CHECK_UNSPECIFIED: "NO_CHECK_UNSPECIFIED", - OVERWRITE: "OVERWRITE", - IGNORE: "IGNORE", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type HandleConflictBehavior = typeof HandleConflictBehavior[keyof typeof HandleConflictBehavior]; - -export function handleConflictBehaviorFromJSON(object: any): HandleConflictBehavior { - switch (object) { - case 0: - case "NO_CHECK_UNSPECIFIED": - return HandleConflictBehavior.NO_CHECK_UNSPECIFIED; - case 1: - case "OVERWRITE": - return HandleConflictBehavior.OVERWRITE; - case 2: - case "IGNORE": - return HandleConflictBehavior.IGNORE; - case -1: - case "UNRECOGNIZED": - default: - return HandleConflictBehavior.UNRECOGNIZED; - } -} - -export function handleConflictBehaviorToJSON(object: HandleConflictBehavior): string { - switch (object) { - case HandleConflictBehavior.NO_CHECK_UNSPECIFIED: - return "NO_CHECK_UNSPECIFIED"; - case HandleConflictBehavior.OVERWRITE: - return "OVERWRITE"; - case HandleConflictBehavior.IGNORE: - return "IGNORE"; - case HandleConflictBehavior.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export const ChainType = { - CHAIN_UNSPECIFIED: "CHAIN_UNSPECIFIED", - /** CHAIN - CHAIN is corresponding to the chain executor. */ - CHAIN: "CHAIN", - /** REARRANGE - REARRANGE is corresponding to the rearranged chain executor. */ - REARRANGE: "REARRANGE", - /** BACKFILL - BACKFILL is corresponding to the backfill executor. */ - BACKFILL: "BACKFILL", - /** UPSTREAM_ONLY - UPSTREAM_ONLY is corresponding to the chain executor, but doesn't consume the snapshot. */ - UPSTREAM_ONLY: "UPSTREAM_ONLY", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type ChainType = typeof ChainType[keyof typeof ChainType]; - -export function chainTypeFromJSON(object: any): ChainType { - switch (object) { - case 0: - case "CHAIN_UNSPECIFIED": - return ChainType.CHAIN_UNSPECIFIED; - case 1: - case "CHAIN": - return ChainType.CHAIN; - case 2: - case "REARRANGE": - return ChainType.REARRANGE; - case 3: - case "BACKFILL": - return ChainType.BACKFILL; - case 4: - case "UPSTREAM_ONLY": - return ChainType.UPSTREAM_ONLY; - case -1: - case "UNRECOGNIZED": - default: - return ChainType.UNRECOGNIZED; - } -} - -export function chainTypeToJSON(object: ChainType): string { - switch (object) { - case ChainType.CHAIN_UNSPECIFIED: - return "CHAIN_UNSPECIFIED"; - case ChainType.CHAIN: - return "CHAIN"; - case ChainType.REARRANGE: - return "REARRANGE"; - case ChainType.BACKFILL: - return "BACKFILL"; - case ChainType.UPSTREAM_ONLY: - return "UPSTREAM_ONLY"; - case ChainType.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export const DispatcherType = { - UNSPECIFIED: "UNSPECIFIED", - /** HASH - Dispatch by hash key, hashed by consistent hash. */ - HASH: "HASH", - /** - * BROADCAST - Broadcast to all downstreams. - * - * Note a broadcast cannot be represented as multiple simple dispatchers, since they are - * different when we update dispatchers during scaling. - */ - BROADCAST: "BROADCAST", - /** SIMPLE - Only one downstream. */ - SIMPLE: "SIMPLE", - /** - * NO_SHUFFLE - A special kind of exchange that doesn't involve shuffle. The upstream actor will be directly - * piped into the downstream actor, if there are the same number of actors. If number of actors - * are not the same, should use hash instead. Should be only used when distribution is the same. - */ - NO_SHUFFLE: "NO_SHUFFLE", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type DispatcherType = typeof DispatcherType[keyof typeof DispatcherType]; - -export function dispatcherTypeFromJSON(object: any): DispatcherType { - switch (object) { - case 0: - case "UNSPECIFIED": - return DispatcherType.UNSPECIFIED; - case 1: - case "HASH": - return DispatcherType.HASH; - case 2: - case "BROADCAST": - return DispatcherType.BROADCAST; - case 3: - case "SIMPLE": - return DispatcherType.SIMPLE; - case 4: - case "NO_SHUFFLE": - return DispatcherType.NO_SHUFFLE; - case -1: - case "UNRECOGNIZED": - default: - return DispatcherType.UNRECOGNIZED; - } -} - -export function dispatcherTypeToJSON(object: DispatcherType): string { - switch (object) { - case DispatcherType.UNSPECIFIED: - return "UNSPECIFIED"; - case DispatcherType.HASH: - return "HASH"; - case DispatcherType.BROADCAST: - return "BROADCAST"; - case DispatcherType.SIMPLE: - return "SIMPLE"; - case DispatcherType.NO_SHUFFLE: - return "NO_SHUFFLE"; - case DispatcherType.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export const FragmentTypeFlag = { - FRAGMENT_UNSPECIFIED: "FRAGMENT_UNSPECIFIED", - SOURCE: "SOURCE", - MVIEW: "MVIEW", - SINK: "SINK", - /** NOW - TODO: Remove this and insert a `BarrierRecv` instead. */ - NOW: "NOW", - CHAIN_NODE: "CHAIN_NODE", - BARRIER_RECV: "BARRIER_RECV", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type FragmentTypeFlag = typeof FragmentTypeFlag[keyof typeof FragmentTypeFlag]; - -export function fragmentTypeFlagFromJSON(object: any): FragmentTypeFlag { - switch (object) { - case 0: - case "FRAGMENT_UNSPECIFIED": - return FragmentTypeFlag.FRAGMENT_UNSPECIFIED; - case 1: - case "SOURCE": - return FragmentTypeFlag.SOURCE; - case 2: - case "MVIEW": - return FragmentTypeFlag.MVIEW; - case 4: - case "SINK": - return FragmentTypeFlag.SINK; - case 8: - case "NOW": - return FragmentTypeFlag.NOW; - case 16: - case "CHAIN_NODE": - return FragmentTypeFlag.CHAIN_NODE; - case 32: - case "BARRIER_RECV": - return FragmentTypeFlag.BARRIER_RECV; - case -1: - case "UNRECOGNIZED": - default: - return FragmentTypeFlag.UNRECOGNIZED; - } -} - -export function fragmentTypeFlagToJSON(object: FragmentTypeFlag): string { - switch (object) { - case FragmentTypeFlag.FRAGMENT_UNSPECIFIED: - return "FRAGMENT_UNSPECIFIED"; - case FragmentTypeFlag.SOURCE: - return "SOURCE"; - case FragmentTypeFlag.MVIEW: - return "MVIEW"; - case FragmentTypeFlag.SINK: - return "SINK"; - case FragmentTypeFlag.NOW: - return "NOW"; - case FragmentTypeFlag.CHAIN_NODE: - return "CHAIN_NODE"; - case FragmentTypeFlag.BARRIER_RECV: - return "BARRIER_RECV"; - case FragmentTypeFlag.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export interface AddMutation { - /** New dispatchers for each actor. */ - actorDispatchers: { [key: number]: AddMutation_Dispatchers }; - /** - * We may embed a source change split mutation here. - * TODO: we may allow multiple mutations in a single barrier. - */ - actorSplits: { [key: number]: ConnectorSplits }; -} - -export interface AddMutation_Dispatchers { - dispatchers: Dispatcher[]; -} - -export interface AddMutation_ActorDispatchersEntry { - key: number; - value: AddMutation_Dispatchers | undefined; -} - -export interface AddMutation_ActorSplitsEntry { - key: number; - value: ConnectorSplits | undefined; -} - -export interface StopMutation { - actors: number[]; -} - -export interface UpdateMutation { - /** Dispatcher updates. */ - dispatcherUpdate: UpdateMutation_DispatcherUpdate[]; - /** Merge updates. */ - mergeUpdate: UpdateMutation_MergeUpdate[]; - /** Vnode bitmap updates for each actor. */ - actorVnodeBitmapUpdate: { [key: number]: Buffer }; - /** All actors to be dropped in this update. */ - droppedActors: number[]; - /** Source updates. */ - actorSplits: { [key: number]: ConnectorSplits }; -} - -export interface UpdateMutation_DispatcherUpdate { - /** Dispatcher can be uniquely identified by a combination of actor id and dispatcher id. */ - actorId: number; - dispatcherId: number; - /** - * The hash mapping for consistent hash. - * For dispatcher types other than HASH, this is ignored. - */ - hashMapping: - | ActorMapping - | undefined; - /** Added downstream actors. */ - addedDownstreamActorId: number[]; - /** Removed downstream actors. */ - removedDownstreamActorId: number[]; -} - -export interface UpdateMutation_MergeUpdate { - /** Merge executor can be uniquely identified by a combination of actor id and upstream fragment id. */ - actorId: number; - upstreamFragmentId: number; - /** - * - For scaling, this is always `None`. - * - For plan change, the upstream fragment will be changed to a new one, and this will be `Some`. - * In this case, all the upstream actors should be removed and replaced by the `new` ones. - */ - newUpstreamFragmentId?: - | number - | undefined; - /** Added upstream actors. */ - addedUpstreamActorId: number[]; - /** Removed upstream actors. */ - removedUpstreamActorId: number[]; -} - -export interface UpdateMutation_ActorVnodeBitmapUpdateEntry { - key: number; - value: Buffer | undefined; -} - -export interface UpdateMutation_ActorSplitsEntry { - key: number; - value: ConnectorSplits | undefined; -} - -export interface SourceChangeSplitMutation { - actorSplits: { [key: number]: ConnectorSplits }; -} - -export interface SourceChangeSplitMutation_ActorSplitsEntry { - key: number; - value: ConnectorSplits | undefined; -} - -export interface PauseMutation { -} - -export interface ResumeMutation { -} - -export interface Barrier { - epoch: Epoch | undefined; - mutation?: - | { $case: "add"; add: AddMutation } - | { $case: "stop"; stop: StopMutation } - | { $case: "update"; update: UpdateMutation } - | { $case: "splits"; splits: SourceChangeSplitMutation } - | { $case: "pause"; pause: PauseMutation } - | { $case: "resume"; resume: ResumeMutation }; - /** Used for tracing. */ - span: Uint8Array; - /** Whether this barrier do checkpoint */ - checkpoint: boolean; - /** Record the actors that the barrier has passed. Only used for debugging. */ - passedActors: number[]; -} - -export interface Watermark { - /** The reference to the watermark column in the stream's schema. */ - column: - | InputRef - | undefined; - /** The watermark value, there will be no record having a greater value in the watermark column. */ - val: Datum | undefined; -} - -export interface StreamMessage { - streamMessage?: { $case: "streamChunk"; streamChunk: StreamChunk } | { $case: "barrier"; barrier: Barrier } | { - $case: "watermark"; - watermark: Watermark; - }; -} - -/** Hash mapping for compute node. Stores mapping from virtual node to actor id. */ -export interface ActorMapping { - originalIndices: number[]; - data: number[]; -} - -export interface StreamSource { - sourceId: number; - stateTable: Table | undefined; - rowIdIndex?: number | undefined; - columns: ColumnCatalog[]; - pkColumnIds: number[]; - properties: { [key: string]: string }; - info: StreamSourceInfo | undefined; - sourceName: string; -} - -export interface StreamSource_PropertiesEntry { - key: string; - value: string; -} - -/** - * The executor only for receiving barrier from the meta service. It always resides in the leaves - * of the streaming graph. - */ -export interface BarrierRecvNode { -} - -export interface SourceNode { - /** - * The source node can contain either a stream source or nothing. So here we extract all - * information about stream source to a message, and here it will be an `Option` in Rust. - */ - sourceInner: StreamSource | undefined; -} - -export interface SinkDesc { - id: number; - name: string; - definition: string; - columns: ColumnDesc[]; - planPk: ColumnOrder[]; - downstreamPk: number[]; - distributionKey: number[]; - properties: { [key: string]: string }; - sinkType: SinkType; -} - -export interface SinkDesc_PropertiesEntry { - key: string; - value: string; -} - -export interface SinkNode { - sinkDesc: SinkDesc | undefined; -} - -export interface ProjectNode { - selectList: ExprNode[]; - /** - * this two field is expressing a list of usize pair, which means when project receives a - * watermark with `watermark_input_key[i]` column index, it should derive a new watermark - * with `watermark_output_key[i]`th expression - */ - watermarkInputKey: number[]; - watermarkOutputKey: number[]; -} - -export interface FilterNode { - searchCondition: ExprNode | undefined; -} - -/** - * A materialized view is regarded as a table. - * In addition, we also specify primary key to MV for efficient point lookup during update and deletion. - * - * The node will be used for both create mv and create index. - * - When creating mv, `pk == distribution_key == column_orders`. - * - When creating index, `column_orders` will contain both - * arrange columns and pk columns, while distribution key will be arrange columns. - */ -export interface MaterializeNode { - tableId: number; - /** Column indexes and orders of primary key. */ - columnOrders: ColumnOrder[]; - /** Used for internal table states. */ - table: - | Table - | undefined; - /** Used to handle pk conflict, open it when upstream executor is source executor. */ - handlePkConflictBehavior: HandleConflictBehavior; -} - -export interface AggCallState { - inner?: { $case: "resultValueState"; resultValueState: AggCallState_ResultValueState } | { - $case: "tableState"; - tableState: AggCallState_TableState; - } | { $case: "materializedInputState"; materializedInputState: AggCallState_MaterializedInputState }; -} - -/** use the one column of stream's result table as the AggCall's state, used for count/sum/append-only extreme. */ -export interface AggCallState_ResultValueState { -} - -/** use untransformed result as the AggCall's state, used for append-only approx count distinct. */ -export interface AggCallState_TableState { - table: Table | undefined; -} - -/** use the some column of the Upstream's materialization as the AggCall's state, used for extreme/string_agg/array_agg. */ -export interface AggCallState_MaterializedInputState { - table: - | Table - | undefined; - /** for constructing state table column mapping */ - includedUpstreamIndices: number[]; - tableValueIndices: number[]; -} - -export interface SimpleAggNode { - aggCalls: AggCall[]; - /** Only used for local simple agg, not used for global simple agg. */ - distributionKey: number[]; - aggCallStates: AggCallState[]; - resultTable: - | Table - | undefined; - /** - * Whether to optimize for append only stream. - * It is true when the input is append-only - */ - isAppendOnly: boolean; - distinctDedupTables: { [key: number]: Table }; - rowCountIndex: number; -} - -export interface SimpleAggNode_DistinctDedupTablesEntry { - key: number; - value: Table | undefined; -} - -export interface HashAggNode { - groupKey: number[]; - aggCalls: AggCall[]; - aggCallStates: AggCallState[]; - resultTable: - | Table - | undefined; - /** - * Whether to optimize for append only stream. - * It is true when the input is append-only - */ - isAppendOnly: boolean; - distinctDedupTables: { [key: number]: Table }; - rowCountIndex: number; -} - -export interface HashAggNode_DistinctDedupTablesEntry { - key: number; - value: Table | undefined; -} - -export interface TopNNode { - /** 0 means no limit as limit of 0 means this node should be optimized away */ - limit: number; - offset: number; - table: Table | undefined; - orderBy: ColumnOrder[]; - withTies: boolean; -} - -export interface GroupTopNNode { - /** 0 means no limit as limit of 0 means this node should be optimized away */ - limit: number; - offset: number; - groupKey: number[]; - table: Table | undefined; - orderBy: ColumnOrder[]; - withTies: boolean; -} - -export interface HashJoinNode { - joinType: JoinType; - leftKey: number[]; - rightKey: number[]; - condition: - | ExprNode - | undefined; - /** Used for internal table states. */ - leftTable: - | Table - | undefined; - /** Used for internal table states. */ - rightTable: - | Table - | undefined; - /** Used for internal table states. */ - leftDegreeTable: - | Table - | undefined; - /** Used for internal table states. */ - rightDegreeTable: - | Table - | undefined; - /** The output indices of current node */ - outputIndices: number[]; - /** - * Left deduped input pk indices. The pk of the left_table and - * left_degree_table is [left_join_key | left_deduped_input_pk_indices] - * and is expected to be the shortest key which starts with - * the join key and satisfies unique constrain. - */ - leftDedupedInputPkIndices: number[]; - /** - * Right deduped input pk indices. The pk of the right_table and - * right_degree_table is [right_join_key | right_deduped_input_pk_indices] - * and is expected to be the shortest key which starts with - * the join key and satisfies unique constrain. - */ - rightDedupedInputPkIndices: number[]; - nullSafe: boolean[]; - /** - * Whether to optimize for append only stream. - * It is true when the input is append-only - */ - isAppendOnly: boolean; -} - -export interface TemporalJoinNode { - joinType: JoinType; - leftKey: number[]; - rightKey: number[]; - nullSafe: boolean[]; - condition: - | ExprNode - | undefined; - /** The output indices of current node */ - outputIndices: number[]; - /** The table desc of the lookup side table. */ - tableDesc: - | StorageTableDesc - | undefined; - /** The output indices of the lookup side table */ - tableOutputIndices: number[]; -} - -export interface DynamicFilterNode { - leftKey: number; - /** Must be one of <, <=, >, >= */ - condition: - | ExprNode - | undefined; - /** Left table stores all states with predicate possibly not NULL. */ - leftTable: - | Table - | undefined; - /** Right table stores single value from RHS of predicate. */ - rightTable: Table | undefined; -} - -/** - * Delta join with two indexes. This is a pseudo plan node generated on frontend. On meta - * service, it will be rewritten into lookup joins. - */ -export interface DeltaIndexJoinNode { - joinType: JoinType; - leftKey: number[]; - rightKey: number[]; - condition: - | ExprNode - | undefined; - /** Table id of the left index. */ - leftTableId: number; - /** Table id of the right index. */ - rightTableId: number; - /** Info about the left index */ - leftInfo: - | ArrangementInfo - | undefined; - /** Info about the right index */ - rightInfo: - | ArrangementInfo - | undefined; - /** the output indices of current node */ - outputIndices: number[]; -} - -export interface HopWindowNode { - timeCol: number; - windowSlide: IntervalUnit | undefined; - windowSize: IntervalUnit | undefined; - outputIndices: number[]; - windowStartExprs: ExprNode[]; - windowEndExprs: ExprNode[]; -} - -export interface MergeNode { - upstreamActorId: number[]; - upstreamFragmentId: number; - /** - * Type of the upstream dispatcher. If there's always one upstream according to this - * type, the compute node may use the `ReceiverExecutor` as an optimization. - */ - upstreamDispatcherType: DispatcherType; - /** The schema of input columns. TODO: remove this field. */ - fields: Field[]; -} - -/** - * passed from frontend to meta, used by fragmenter to generate `MergeNode` - * and maybe `DispatcherNode` later. - */ -export interface ExchangeNode { - strategy: DispatchStrategy | undefined; -} - -/** - * ChainNode is used for mv on mv. - * ChainNode is like a "UNION" on mv snapshot and streaming. So it takes two inputs with fixed order: - * 1. MergeNode (as a placeholder) for streaming read. - * 2. BatchPlanNode for snapshot read. - */ -export interface ChainNode { - tableId: number; - /** - * The columns from the upstream table that'll be internally required by this chain node. - * - For non-backfill chain node, it's the same as the output columns. - * - For backfill chain node, there're additionally primary key columns. - */ - upstreamColumnIds: number[]; - /** - * The columns to be output by this chain node. The index is based on the internal required columns. - * - For non-backfill chain node, it's simply all the columns. - * - For backfill chain node, this strips the primary key columns if they're unnecessary. - */ - outputIndices: number[]; - /** - * Generally, the barrier needs to be rearranged during the MV creation process, so that data can - * be flushed to shared buffer periodically, instead of making the first epoch from batch query extra - * large. However, in some cases, e.g., shared state, the barrier cannot be rearranged in ChainNode. - * ChainType is used to decide which implementation for the ChainNode. - */ - chainType: ChainType; - /** The upstream materialized view info used by backfill. */ - tableDesc: StorageTableDesc | undefined; -} - -/** - * BatchPlanNode is used for mv on mv snapshot read. - * BatchPlanNode is supposed to carry a batch plan that can be optimized with the streaming plan_common. - * Currently, streaming to batch push down is not yet supported, BatchPlanNode is simply a table scan. - */ -export interface BatchPlanNode { - tableDesc: StorageTableDesc | undefined; - columnIds: number[]; -} - -export interface ArrangementInfo { - /** - * Order key of the arrangement, including order by columns and pk from the materialize - * executor. - */ - arrangeKeyOrders: ColumnOrder[]; - /** Column descs of the arrangement */ - columnDescs: ColumnDesc[]; - /** Used to build storage table by stream lookup join of delta join. */ - tableDesc: StorageTableDesc | undefined; -} - -/** - * Special node for shared state, which will only be produced in fragmenter. ArrangeNode will - * produce a special Materialize executor, which materializes data for downstream to query. - */ -export interface ArrangeNode { - /** Info about the arrangement */ - tableInfo: - | ArrangementInfo - | undefined; - /** Hash key of the materialize node, which is a subset of pk. */ - distributionKey: number[]; - /** Used for internal table states. */ - table: - | Table - | undefined; - /** Used to control whether doing sanity check, open it when upstream executor is source executor. */ - handlePkConflictBehavior: HandleConflictBehavior; -} - -/** Special node for shared state. LookupNode will join an arrangement with a stream. */ -export interface LookupNode { - /** Join key of the arrangement side */ - arrangeKey: number[]; - /** Join key of the stream side */ - streamKey: number[]; - /** Whether to join the current epoch of arrangement */ - useCurrentEpoch: boolean; - /** - * Sometimes we need to re-order the output data to meet the requirement of schema. - * By default, lookup executor will produce ``. We - * will then apply the column mapping to the combined result. - */ - columnMapping: number[]; - arrangementTableId?: - | { $case: "tableId"; tableId: number } - | { $case: "indexId"; indexId: number }; - /** Info about the arrangement */ - arrangementTableInfo: ArrangementInfo | undefined; -} - -/** WatermarkFilter needs to filter the upstream data by the water mark. */ -export interface WatermarkFilterNode { - /** The watermark descs */ - watermarkDescs: WatermarkDesc[]; - /** The tables used to persist watermarks, the key is vnode. */ - tables: Table[]; -} - -/** Acts like a merger, but on different inputs. */ -export interface UnionNode { -} - -/** Special node for shared state. Merge and align barrier from upstreams. Pipe inputs in order. */ -export interface LookupUnionNode { - order: number[]; -} - -export interface ExpandNode { - columnSubsets: ExpandNode_Subset[]; -} - -export interface ExpandNode_Subset { - columnIndices: number[]; -} - -export interface ProjectSetNode { - selectList: ProjectSetSelectItem[]; -} - -/** Sorts inputs and outputs ordered data based on watermark. */ -export interface SortNode { - /** Persists data above watermark. */ - stateTable: - | Table - | undefined; - /** Column index of watermark to perform sorting. */ - sortColumnIndex: number; -} - -/** Merges two streams from streaming and batch for data manipulation. */ -export interface DmlNode { - /** Id of the table on which DML performs. */ - tableId: number; - /** Version of the table. */ - tableVersionId: number; - /** Column descriptions of the table. */ - columnDescs: ColumnDesc[]; -} - -export interface RowIdGenNode { - rowIdIndex: number; -} - -export interface NowNode { - /** Persists emitted 'now'. */ - stateTable: Table | undefined; -} - -export interface StreamNode { - nodeBody?: - | { $case: "source"; source: SourceNode } - | { $case: "project"; project: ProjectNode } - | { $case: "filter"; filter: FilterNode } - | { $case: "materialize"; materialize: MaterializeNode } - | { $case: "localSimpleAgg"; localSimpleAgg: SimpleAggNode } - | { $case: "globalSimpleAgg"; globalSimpleAgg: SimpleAggNode } - | { $case: "hashAgg"; hashAgg: HashAggNode } - | { $case: "appendOnlyTopN"; appendOnlyTopN: TopNNode } - | { $case: "hashJoin"; hashJoin: HashJoinNode } - | { $case: "topN"; topN: TopNNode } - | { $case: "hopWindow"; hopWindow: HopWindowNode } - | { $case: "merge"; merge: MergeNode } - | { $case: "exchange"; exchange: ExchangeNode } - | { $case: "chain"; chain: ChainNode } - | { $case: "batchPlan"; batchPlan: BatchPlanNode } - | { $case: "lookup"; lookup: LookupNode } - | { $case: "arrange"; arrange: ArrangeNode } - | { $case: "lookupUnion"; lookupUnion: LookupUnionNode } - | { $case: "union"; union: UnionNode } - | { $case: "deltaIndexJoin"; deltaIndexJoin: DeltaIndexJoinNode } - | { $case: "sink"; sink: SinkNode } - | { $case: "expand"; expand: ExpandNode } - | { $case: "dynamicFilter"; dynamicFilter: DynamicFilterNode } - | { $case: "projectSet"; projectSet: ProjectSetNode } - | { $case: "groupTopN"; groupTopN: GroupTopNNode } - | { $case: "sort"; sort: SortNode } - | { $case: "watermarkFilter"; watermarkFilter: WatermarkFilterNode } - | { $case: "dml"; dml: DmlNode } - | { $case: "rowIdGen"; rowIdGen: RowIdGenNode } - | { $case: "now"; now: NowNode } - | { $case: "appendOnlyGroupTopN"; appendOnlyGroupTopN: GroupTopNNode } - | { $case: "temporalJoin"; temporalJoin: TemporalJoinNode } - | { $case: "barrierRecv"; barrierRecv: BarrierRecvNode }; - /** - * The id for the operator. This is local per mview. - * TODO: should better be a uint32. - */ - operatorId: number; - /** Child node in plan aka. upstream nodes in the streaming DAG */ - input: StreamNode[]; - streamKey: number[]; - appendOnly: boolean; - identity: string; - /** The schema of the plan node */ - fields: Field[]; -} - -/** - * The property of an edge in the fragment graph. - * This is essientially a "logical" version of `Dispatcher`. See the doc of `Dispatcher` for more details. - */ -export interface DispatchStrategy { - type: DispatcherType; - distKeyIndices: number[]; - outputIndices: number[]; -} - -/** - * A dispatcher redistribute messages. - * We encode both the type and other usage information in the proto. - */ -export interface Dispatcher { - type: DispatcherType; - /** - * Indices of the columns to be used for hashing. - * For dispatcher types other than HASH, this is ignored. - */ - distKeyIndices: number[]; - /** - * Indices of the columns to output. - * In most cases, this contains all columns in the input. But for some cases like MV on MV or - * schema change, we may only output a subset of the columns. - */ - outputIndices: number[]; - /** - * The hash mapping for consistent hash. - * For dispatcher types other than HASH, this is ignored. - */ - hashMapping: - | ActorMapping - | undefined; - /** - * Dispatcher can be uniquely identified by a combination of actor id and dispatcher id. - * This is exactly the same as its downstream fragment id. - */ - dispatcherId: number; - /** Number of downstreams decides how many endpoints a dispatcher should dispatch. */ - downstreamActorId: number[]; -} - -/** A StreamActor is a running fragment of the overall stream graph, */ -export interface StreamActor { - actorId: number; - fragmentId: number; - nodes: StreamNode | undefined; - dispatcher: Dispatcher[]; - /** - * The actors that send messages to this actor. - * Note that upstream actor ids are also stored in the proto of merge nodes. - * It is painstaking to traverse through the node tree and get upstream actor id from the root StreamNode. - * We duplicate the information here to ease the parsing logic in stream manager. - */ - upstreamActorId: number[]; - /** - * Vnodes that the executors in this actor own. - * If the fragment is a singleton, this field will not be set and leave a `None`. - */ - vnodeBitmap: - | Buffer - | undefined; - /** The SQL definition of this materialized view. Used for debugging only. */ - mviewDefinition: string; -} - -/** The environment associated with a stream plan */ -export interface StreamEnvironment { - /** The timezone associated with the streaming plan. Only applies to MV for now. */ - timezone: string; -} - -export interface StreamFragmentGraph { - /** all the fragments in the graph. */ - fragments: { [key: number]: StreamFragmentGraph_StreamFragment }; - /** edges between fragments. */ - edges: StreamFragmentGraph_StreamFragmentEdge[]; - dependentRelationIds: number[]; - tableIdsCnt: number; - env: - | StreamEnvironment - | undefined; - /** If none, default parallelism will be applied. */ - parallelism: StreamFragmentGraph_Parallelism | undefined; -} - -export interface StreamFragmentGraph_StreamFragment { - /** 0-based on frontend, and will be rewritten to global id on meta. */ - fragmentId: number; - /** root stream node in this fragment. */ - node: - | StreamNode - | undefined; - /** Bitwise-OR of FragmentTypeFlags */ - fragmentTypeMask: number; - /** - * Mark whether this fragment requires exactly one actor. - * Note: if this is `false`, the fragment may still be a singleton according to the scheduler. - * One should check `meta.Fragment.distribution_type` for the final result. - */ - requiresSingleton: boolean; - /** Number of table ids (stateful states) for this fragment. */ - tableIdsCnt: number; - /** Mark the upstream table ids of this fragment, Used for fragments with `Chain`s. */ - upstreamTableIds: number[]; -} - -export interface StreamFragmentGraph_StreamFragmentEdge { - /** Dispatch strategy for the fragment. */ - dispatchStrategy: - | DispatchStrategy - | undefined; - /** - * A unique identifier of this edge. Generally it should be exchange node's operator id. When - * rewriting fragments into delta joins or when inserting 1-to-1 exchange, there will be - * virtual links generated. - */ - linkId: number; - upstreamId: number; - downstreamId: number; -} - -export interface StreamFragmentGraph_Parallelism { - parallelism: number; -} - -export interface StreamFragmentGraph_FragmentsEntry { - key: number; - value: StreamFragmentGraph_StreamFragment | undefined; -} - -function createBaseAddMutation(): AddMutation { - return { actorDispatchers: {}, actorSplits: {} }; -} - -export const AddMutation = { - fromJSON(object: any): AddMutation { - return { - actorDispatchers: isObject(object.actorDispatchers) - ? Object.entries(object.actorDispatchers).reduce<{ [key: number]: AddMutation_Dispatchers }>( - (acc, [key, value]) => { - acc[Number(key)] = AddMutation_Dispatchers.fromJSON(value); - return acc; - }, - {}, - ) - : {}, - actorSplits: isObject(object.actorSplits) - ? Object.entries(object.actorSplits).reduce<{ [key: number]: ConnectorSplits }>((acc, [key, value]) => { - acc[Number(key)] = ConnectorSplits.fromJSON(value); - return acc; - }, {}) - : {}, - }; - }, - - toJSON(message: AddMutation): unknown { - const obj: any = {}; - obj.actorDispatchers = {}; - if (message.actorDispatchers) { - Object.entries(message.actorDispatchers).forEach(([k, v]) => { - obj.actorDispatchers[k] = AddMutation_Dispatchers.toJSON(v); - }); - } - obj.actorSplits = {}; - if (message.actorSplits) { - Object.entries(message.actorSplits).forEach(([k, v]) => { - obj.actorSplits[k] = ConnectorSplits.toJSON(v); - }); - } - return obj; - }, - - fromPartial, I>>(object: I): AddMutation { - const message = createBaseAddMutation(); - message.actorDispatchers = Object.entries(object.actorDispatchers ?? {}).reduce< - { [key: number]: AddMutation_Dispatchers } - >((acc, [key, value]) => { - if (value !== undefined) { - acc[Number(key)] = AddMutation_Dispatchers.fromPartial(value); - } - return acc; - }, {}); - message.actorSplits = Object.entries(object.actorSplits ?? {}).reduce<{ [key: number]: ConnectorSplits }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[Number(key)] = ConnectorSplits.fromPartial(value); - } - return acc; - }, - {}, - ); - return message; - }, -}; - -function createBaseAddMutation_Dispatchers(): AddMutation_Dispatchers { - return { dispatchers: [] }; -} - -export const AddMutation_Dispatchers = { - fromJSON(object: any): AddMutation_Dispatchers { - return { - dispatchers: Array.isArray(object?.dispatchers) ? object.dispatchers.map((e: any) => Dispatcher.fromJSON(e)) : [], - }; - }, - - toJSON(message: AddMutation_Dispatchers): unknown { - const obj: any = {}; - if (message.dispatchers) { - obj.dispatchers = message.dispatchers.map((e) => e ? Dispatcher.toJSON(e) : undefined); - } else { - obj.dispatchers = []; - } - return obj; - }, - - fromPartial, I>>(object: I): AddMutation_Dispatchers { - const message = createBaseAddMutation_Dispatchers(); - message.dispatchers = object.dispatchers?.map((e) => Dispatcher.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseAddMutation_ActorDispatchersEntry(): AddMutation_ActorDispatchersEntry { - return { key: 0, value: undefined }; -} - -export const AddMutation_ActorDispatchersEntry = { - fromJSON(object: any): AddMutation_ActorDispatchersEntry { - return { - key: isSet(object.key) ? Number(object.key) : 0, - value: isSet(object.value) ? AddMutation_Dispatchers.fromJSON(object.value) : undefined, - }; - }, - - toJSON(message: AddMutation_ActorDispatchersEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = Math.round(message.key)); - message.value !== undefined && - (obj.value = message.value ? AddMutation_Dispatchers.toJSON(message.value) : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): AddMutation_ActorDispatchersEntry { - const message = createBaseAddMutation_ActorDispatchersEntry(); - message.key = object.key ?? 0; - message.value = (object.value !== undefined && object.value !== null) - ? AddMutation_Dispatchers.fromPartial(object.value) - : undefined; - return message; - }, -}; - -function createBaseAddMutation_ActorSplitsEntry(): AddMutation_ActorSplitsEntry { - return { key: 0, value: undefined }; -} - -export const AddMutation_ActorSplitsEntry = { - fromJSON(object: any): AddMutation_ActorSplitsEntry { - return { - key: isSet(object.key) ? Number(object.key) : 0, - value: isSet(object.value) ? ConnectorSplits.fromJSON(object.value) : undefined, - }; - }, - - toJSON(message: AddMutation_ActorSplitsEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = Math.round(message.key)); - message.value !== undefined && (obj.value = message.value ? ConnectorSplits.toJSON(message.value) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): AddMutation_ActorSplitsEntry { - const message = createBaseAddMutation_ActorSplitsEntry(); - message.key = object.key ?? 0; - message.value = (object.value !== undefined && object.value !== null) - ? ConnectorSplits.fromPartial(object.value) - : undefined; - return message; - }, -}; - -function createBaseStopMutation(): StopMutation { - return { actors: [] }; -} - -export const StopMutation = { - fromJSON(object: any): StopMutation { - return { actors: Array.isArray(object?.actors) ? object.actors.map((e: any) => Number(e)) : [] }; - }, - - toJSON(message: StopMutation): unknown { - const obj: any = {}; - if (message.actors) { - obj.actors = message.actors.map((e) => Math.round(e)); - } else { - obj.actors = []; - } - return obj; - }, - - fromPartial, I>>(object: I): StopMutation { - const message = createBaseStopMutation(); - message.actors = object.actors?.map((e) => e) || []; - return message; - }, -}; - -function createBaseUpdateMutation(): UpdateMutation { - return { dispatcherUpdate: [], mergeUpdate: [], actorVnodeBitmapUpdate: {}, droppedActors: [], actorSplits: {} }; -} - -export const UpdateMutation = { - fromJSON(object: any): UpdateMutation { - return { - dispatcherUpdate: Array.isArray(object?.dispatcherUpdate) - ? object.dispatcherUpdate.map((e: any) => UpdateMutation_DispatcherUpdate.fromJSON(e)) - : [], - mergeUpdate: Array.isArray(object?.mergeUpdate) - ? object.mergeUpdate.map((e: any) => UpdateMutation_MergeUpdate.fromJSON(e)) - : [], - actorVnodeBitmapUpdate: isObject(object.actorVnodeBitmapUpdate) - ? Object.entries(object.actorVnodeBitmapUpdate).reduce<{ [key: number]: Buffer }>((acc, [key, value]) => { - acc[Number(key)] = Buffer.fromJSON(value); - return acc; - }, {}) - : {}, - droppedActors: Array.isArray(object?.droppedActors) - ? object.droppedActors.map((e: any) => Number(e)) - : [], - actorSplits: isObject(object.actorSplits) - ? Object.entries(object.actorSplits).reduce<{ [key: number]: ConnectorSplits }>((acc, [key, value]) => { - acc[Number(key)] = ConnectorSplits.fromJSON(value); - return acc; - }, {}) - : {}, - }; - }, - - toJSON(message: UpdateMutation): unknown { - const obj: any = {}; - if (message.dispatcherUpdate) { - obj.dispatcherUpdate = message.dispatcherUpdate.map((e) => - e ? UpdateMutation_DispatcherUpdate.toJSON(e) : undefined - ); - } else { - obj.dispatcherUpdate = []; - } - if (message.mergeUpdate) { - obj.mergeUpdate = message.mergeUpdate.map((e) => e ? UpdateMutation_MergeUpdate.toJSON(e) : undefined); - } else { - obj.mergeUpdate = []; - } - obj.actorVnodeBitmapUpdate = {}; - if (message.actorVnodeBitmapUpdate) { - Object.entries(message.actorVnodeBitmapUpdate).forEach(([k, v]) => { - obj.actorVnodeBitmapUpdate[k] = Buffer.toJSON(v); - }); - } - if (message.droppedActors) { - obj.droppedActors = message.droppedActors.map((e) => Math.round(e)); - } else { - obj.droppedActors = []; - } - obj.actorSplits = {}; - if (message.actorSplits) { - Object.entries(message.actorSplits).forEach(([k, v]) => { - obj.actorSplits[k] = ConnectorSplits.toJSON(v); - }); - } - return obj; - }, - - fromPartial, I>>(object: I): UpdateMutation { - const message = createBaseUpdateMutation(); - message.dispatcherUpdate = object.dispatcherUpdate?.map((e) => UpdateMutation_DispatcherUpdate.fromPartial(e)) || - []; - message.mergeUpdate = object.mergeUpdate?.map((e) => UpdateMutation_MergeUpdate.fromPartial(e)) || []; - message.actorVnodeBitmapUpdate = Object.entries(object.actorVnodeBitmapUpdate ?? {}).reduce< - { [key: number]: Buffer } - >((acc, [key, value]) => { - if (value !== undefined) { - acc[Number(key)] = Buffer.fromPartial(value); - } - return acc; - }, {}); - message.droppedActors = object.droppedActors?.map((e) => e) || []; - message.actorSplits = Object.entries(object.actorSplits ?? {}).reduce<{ [key: number]: ConnectorSplits }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[Number(key)] = ConnectorSplits.fromPartial(value); - } - return acc; - }, - {}, - ); - return message; - }, -}; - -function createBaseUpdateMutation_DispatcherUpdate(): UpdateMutation_DispatcherUpdate { - return { - actorId: 0, - dispatcherId: 0, - hashMapping: undefined, - addedDownstreamActorId: [], - removedDownstreamActorId: [], - }; -} - -export const UpdateMutation_DispatcherUpdate = { - fromJSON(object: any): UpdateMutation_DispatcherUpdate { - return { - actorId: isSet(object.actorId) ? Number(object.actorId) : 0, - dispatcherId: isSet(object.dispatcherId) ? Number(object.dispatcherId) : 0, - hashMapping: isSet(object.hashMapping) ? ActorMapping.fromJSON(object.hashMapping) : undefined, - addedDownstreamActorId: Array.isArray(object?.addedDownstreamActorId) - ? object.addedDownstreamActorId.map((e: any) => Number(e)) - : [], - removedDownstreamActorId: Array.isArray(object?.removedDownstreamActorId) - ? object.removedDownstreamActorId.map((e: any) => Number(e)) - : [], - }; - }, - - toJSON(message: UpdateMutation_DispatcherUpdate): unknown { - const obj: any = {}; - message.actorId !== undefined && (obj.actorId = Math.round(message.actorId)); - message.dispatcherId !== undefined && (obj.dispatcherId = Math.round(message.dispatcherId)); - message.hashMapping !== undefined && - (obj.hashMapping = message.hashMapping ? ActorMapping.toJSON(message.hashMapping) : undefined); - if (message.addedDownstreamActorId) { - obj.addedDownstreamActorId = message.addedDownstreamActorId.map((e) => Math.round(e)); - } else { - obj.addedDownstreamActorId = []; - } - if (message.removedDownstreamActorId) { - obj.removedDownstreamActorId = message.removedDownstreamActorId.map((e) => Math.round(e)); - } else { - obj.removedDownstreamActorId = []; - } - return obj; - }, - - fromPartial, I>>( - object: I, - ): UpdateMutation_DispatcherUpdate { - const message = createBaseUpdateMutation_DispatcherUpdate(); - message.actorId = object.actorId ?? 0; - message.dispatcherId = object.dispatcherId ?? 0; - message.hashMapping = (object.hashMapping !== undefined && object.hashMapping !== null) - ? ActorMapping.fromPartial(object.hashMapping) - : undefined; - message.addedDownstreamActorId = object.addedDownstreamActorId?.map((e) => e) || []; - message.removedDownstreamActorId = object.removedDownstreamActorId?.map((e) => e) || []; - return message; - }, -}; - -function createBaseUpdateMutation_MergeUpdate(): UpdateMutation_MergeUpdate { - return { - actorId: 0, - upstreamFragmentId: 0, - newUpstreamFragmentId: undefined, - addedUpstreamActorId: [], - removedUpstreamActorId: [], - }; -} - -export const UpdateMutation_MergeUpdate = { - fromJSON(object: any): UpdateMutation_MergeUpdate { - return { - actorId: isSet(object.actorId) ? Number(object.actorId) : 0, - upstreamFragmentId: isSet(object.upstreamFragmentId) ? Number(object.upstreamFragmentId) : 0, - newUpstreamFragmentId: isSet(object.newUpstreamFragmentId) ? Number(object.newUpstreamFragmentId) : undefined, - addedUpstreamActorId: Array.isArray(object?.addedUpstreamActorId) - ? object.addedUpstreamActorId.map((e: any) => Number(e)) - : [], - removedUpstreamActorId: Array.isArray(object?.removedUpstreamActorId) - ? object.removedUpstreamActorId.map((e: any) => Number(e)) - : [], - }; - }, - - toJSON(message: UpdateMutation_MergeUpdate): unknown { - const obj: any = {}; - message.actorId !== undefined && (obj.actorId = Math.round(message.actorId)); - message.upstreamFragmentId !== undefined && (obj.upstreamFragmentId = Math.round(message.upstreamFragmentId)); - message.newUpstreamFragmentId !== undefined && - (obj.newUpstreamFragmentId = Math.round(message.newUpstreamFragmentId)); - if (message.addedUpstreamActorId) { - obj.addedUpstreamActorId = message.addedUpstreamActorId.map((e) => Math.round(e)); - } else { - obj.addedUpstreamActorId = []; - } - if (message.removedUpstreamActorId) { - obj.removedUpstreamActorId = message.removedUpstreamActorId.map((e) => Math.round(e)); - } else { - obj.removedUpstreamActorId = []; - } - return obj; - }, - - fromPartial, I>>(object: I): UpdateMutation_MergeUpdate { - const message = createBaseUpdateMutation_MergeUpdate(); - message.actorId = object.actorId ?? 0; - message.upstreamFragmentId = object.upstreamFragmentId ?? 0; - message.newUpstreamFragmentId = object.newUpstreamFragmentId ?? undefined; - message.addedUpstreamActorId = object.addedUpstreamActorId?.map((e) => e) || []; - message.removedUpstreamActorId = object.removedUpstreamActorId?.map((e) => e) || []; - return message; - }, -}; - -function createBaseUpdateMutation_ActorVnodeBitmapUpdateEntry(): UpdateMutation_ActorVnodeBitmapUpdateEntry { - return { key: 0, value: undefined }; -} - -export const UpdateMutation_ActorVnodeBitmapUpdateEntry = { - fromJSON(object: any): UpdateMutation_ActorVnodeBitmapUpdateEntry { - return { - key: isSet(object.key) ? Number(object.key) : 0, - value: isSet(object.value) ? Buffer.fromJSON(object.value) : undefined, - }; - }, - - toJSON(message: UpdateMutation_ActorVnodeBitmapUpdateEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = Math.round(message.key)); - message.value !== undefined && (obj.value = message.value ? Buffer.toJSON(message.value) : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): UpdateMutation_ActorVnodeBitmapUpdateEntry { - const message = createBaseUpdateMutation_ActorVnodeBitmapUpdateEntry(); - message.key = object.key ?? 0; - message.value = (object.value !== undefined && object.value !== null) - ? Buffer.fromPartial(object.value) - : undefined; - return message; - }, -}; - -function createBaseUpdateMutation_ActorSplitsEntry(): UpdateMutation_ActorSplitsEntry { - return { key: 0, value: undefined }; -} - -export const UpdateMutation_ActorSplitsEntry = { - fromJSON(object: any): UpdateMutation_ActorSplitsEntry { - return { - key: isSet(object.key) ? Number(object.key) : 0, - value: isSet(object.value) ? ConnectorSplits.fromJSON(object.value) : undefined, - }; - }, - - toJSON(message: UpdateMutation_ActorSplitsEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = Math.round(message.key)); - message.value !== undefined && (obj.value = message.value ? ConnectorSplits.toJSON(message.value) : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): UpdateMutation_ActorSplitsEntry { - const message = createBaseUpdateMutation_ActorSplitsEntry(); - message.key = object.key ?? 0; - message.value = (object.value !== undefined && object.value !== null) - ? ConnectorSplits.fromPartial(object.value) - : undefined; - return message; - }, -}; - -function createBaseSourceChangeSplitMutation(): SourceChangeSplitMutation { - return { actorSplits: {} }; -} - -export const SourceChangeSplitMutation = { - fromJSON(object: any): SourceChangeSplitMutation { - return { - actorSplits: isObject(object.actorSplits) - ? Object.entries(object.actorSplits).reduce<{ [key: number]: ConnectorSplits }>((acc, [key, value]) => { - acc[Number(key)] = ConnectorSplits.fromJSON(value); - return acc; - }, {}) - : {}, - }; - }, - - toJSON(message: SourceChangeSplitMutation): unknown { - const obj: any = {}; - obj.actorSplits = {}; - if (message.actorSplits) { - Object.entries(message.actorSplits).forEach(([k, v]) => { - obj.actorSplits[k] = ConnectorSplits.toJSON(v); - }); - } - return obj; - }, - - fromPartial, I>>(object: I): SourceChangeSplitMutation { - const message = createBaseSourceChangeSplitMutation(); - message.actorSplits = Object.entries(object.actorSplits ?? {}).reduce<{ [key: number]: ConnectorSplits }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[Number(key)] = ConnectorSplits.fromPartial(value); - } - return acc; - }, - {}, - ); - return message; - }, -}; - -function createBaseSourceChangeSplitMutation_ActorSplitsEntry(): SourceChangeSplitMutation_ActorSplitsEntry { - return { key: 0, value: undefined }; -} - -export const SourceChangeSplitMutation_ActorSplitsEntry = { - fromJSON(object: any): SourceChangeSplitMutation_ActorSplitsEntry { - return { - key: isSet(object.key) ? Number(object.key) : 0, - value: isSet(object.value) ? ConnectorSplits.fromJSON(object.value) : undefined, - }; - }, - - toJSON(message: SourceChangeSplitMutation_ActorSplitsEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = Math.round(message.key)); - message.value !== undefined && (obj.value = message.value ? ConnectorSplits.toJSON(message.value) : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): SourceChangeSplitMutation_ActorSplitsEntry { - const message = createBaseSourceChangeSplitMutation_ActorSplitsEntry(); - message.key = object.key ?? 0; - message.value = (object.value !== undefined && object.value !== null) - ? ConnectorSplits.fromPartial(object.value) - : undefined; - return message; - }, -}; - -function createBasePauseMutation(): PauseMutation { - return {}; -} - -export const PauseMutation = { - fromJSON(_: any): PauseMutation { - return {}; - }, - - toJSON(_: PauseMutation): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): PauseMutation { - const message = createBasePauseMutation(); - return message; - }, -}; - -function createBaseResumeMutation(): ResumeMutation { - return {}; -} - -export const ResumeMutation = { - fromJSON(_: any): ResumeMutation { - return {}; - }, - - toJSON(_: ResumeMutation): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): ResumeMutation { - const message = createBaseResumeMutation(); - return message; - }, -}; - -function createBaseBarrier(): Barrier { - return { epoch: undefined, mutation: undefined, span: new Uint8Array(), checkpoint: false, passedActors: [] }; -} - -export const Barrier = { - fromJSON(object: any): Barrier { - return { - epoch: isSet(object.epoch) ? Epoch.fromJSON(object.epoch) : undefined, - mutation: isSet(object.add) - ? { $case: "add", add: AddMutation.fromJSON(object.add) } - : isSet(object.stop) - ? { $case: "stop", stop: StopMutation.fromJSON(object.stop) } - : isSet(object.update) - ? { $case: "update", update: UpdateMutation.fromJSON(object.update) } - : isSet(object.splits) - ? { $case: "splits", splits: SourceChangeSplitMutation.fromJSON(object.splits) } - : isSet(object.pause) - ? { $case: "pause", pause: PauseMutation.fromJSON(object.pause) } - : isSet(object.resume) - ? { $case: "resume", resume: ResumeMutation.fromJSON(object.resume) } - : undefined, - span: isSet(object.span) ? bytesFromBase64(object.span) : new Uint8Array(), - checkpoint: isSet(object.checkpoint) ? Boolean(object.checkpoint) : false, - passedActors: Array.isArray(object?.passedActors) - ? object.passedActors.map((e: any) => Number(e)) - : [], - }; - }, - - toJSON(message: Barrier): unknown { - const obj: any = {}; - message.epoch !== undefined && (obj.epoch = message.epoch ? Epoch.toJSON(message.epoch) : undefined); - message.mutation?.$case === "add" && - (obj.add = message.mutation?.add ? AddMutation.toJSON(message.mutation?.add) : undefined); - message.mutation?.$case === "stop" && - (obj.stop = message.mutation?.stop ? StopMutation.toJSON(message.mutation?.stop) : undefined); - message.mutation?.$case === "update" && - (obj.update = message.mutation?.update ? UpdateMutation.toJSON(message.mutation?.update) : undefined); - message.mutation?.$case === "splits" && - (obj.splits = message.mutation?.splits ? SourceChangeSplitMutation.toJSON(message.mutation?.splits) : undefined); - message.mutation?.$case === "pause" && - (obj.pause = message.mutation?.pause ? PauseMutation.toJSON(message.mutation?.pause) : undefined); - message.mutation?.$case === "resume" && - (obj.resume = message.mutation?.resume ? ResumeMutation.toJSON(message.mutation?.resume) : undefined); - message.span !== undefined && - (obj.span = base64FromBytes(message.span !== undefined ? message.span : new Uint8Array())); - message.checkpoint !== undefined && (obj.checkpoint = message.checkpoint); - if (message.passedActors) { - obj.passedActors = message.passedActors.map((e) => Math.round(e)); - } else { - obj.passedActors = []; - } - return obj; - }, - - fromPartial, I>>(object: I): Barrier { - const message = createBaseBarrier(); - message.epoch = (object.epoch !== undefined && object.epoch !== null) ? Epoch.fromPartial(object.epoch) : undefined; - if (object.mutation?.$case === "add" && object.mutation?.add !== undefined && object.mutation?.add !== null) { - message.mutation = { $case: "add", add: AddMutation.fromPartial(object.mutation.add) }; - } - if (object.mutation?.$case === "stop" && object.mutation?.stop !== undefined && object.mutation?.stop !== null) { - message.mutation = { $case: "stop", stop: StopMutation.fromPartial(object.mutation.stop) }; - } - if ( - object.mutation?.$case === "update" && object.mutation?.update !== undefined && object.mutation?.update !== null - ) { - message.mutation = { $case: "update", update: UpdateMutation.fromPartial(object.mutation.update) }; - } - if ( - object.mutation?.$case === "splits" && object.mutation?.splits !== undefined && object.mutation?.splits !== null - ) { - message.mutation = { $case: "splits", splits: SourceChangeSplitMutation.fromPartial(object.mutation.splits) }; - } - if (object.mutation?.$case === "pause" && object.mutation?.pause !== undefined && object.mutation?.pause !== null) { - message.mutation = { $case: "pause", pause: PauseMutation.fromPartial(object.mutation.pause) }; - } - if ( - object.mutation?.$case === "resume" && object.mutation?.resume !== undefined && object.mutation?.resume !== null - ) { - message.mutation = { $case: "resume", resume: ResumeMutation.fromPartial(object.mutation.resume) }; - } - message.span = object.span ?? new Uint8Array(); - message.checkpoint = object.checkpoint ?? false; - message.passedActors = object.passedActors?.map((e) => e) || []; - return message; - }, -}; - -function createBaseWatermark(): Watermark { - return { column: undefined, val: undefined }; -} - -export const Watermark = { - fromJSON(object: any): Watermark { - return { - column: isSet(object.column) ? InputRef.fromJSON(object.column) : undefined, - val: isSet(object.val) ? Datum.fromJSON(object.val) : undefined, - }; - }, - - toJSON(message: Watermark): unknown { - const obj: any = {}; - message.column !== undefined && (obj.column = message.column ? InputRef.toJSON(message.column) : undefined); - message.val !== undefined && (obj.val = message.val ? Datum.toJSON(message.val) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): Watermark { - const message = createBaseWatermark(); - message.column = (object.column !== undefined && object.column !== null) - ? InputRef.fromPartial(object.column) - : undefined; - message.val = (object.val !== undefined && object.val !== null) ? Datum.fromPartial(object.val) : undefined; - return message; - }, -}; - -function createBaseStreamMessage(): StreamMessage { - return { streamMessage: undefined }; -} - -export const StreamMessage = { - fromJSON(object: any): StreamMessage { - return { - streamMessage: isSet(object.streamChunk) - ? { $case: "streamChunk", streamChunk: StreamChunk.fromJSON(object.streamChunk) } - : isSet(object.barrier) - ? { $case: "barrier", barrier: Barrier.fromJSON(object.barrier) } - : isSet(object.watermark) - ? { $case: "watermark", watermark: Watermark.fromJSON(object.watermark) } - : undefined, - }; - }, - - toJSON(message: StreamMessage): unknown { - const obj: any = {}; - message.streamMessage?.$case === "streamChunk" && (obj.streamChunk = message.streamMessage?.streamChunk - ? StreamChunk.toJSON(message.streamMessage?.streamChunk) - : undefined); - message.streamMessage?.$case === "barrier" && - (obj.barrier = message.streamMessage?.barrier ? Barrier.toJSON(message.streamMessage?.barrier) : undefined); - message.streamMessage?.$case === "watermark" && - (obj.watermark = message.streamMessage?.watermark - ? Watermark.toJSON(message.streamMessage?.watermark) - : undefined); - return obj; - }, - - fromPartial, I>>(object: I): StreamMessage { - const message = createBaseStreamMessage(); - if ( - object.streamMessage?.$case === "streamChunk" && - object.streamMessage?.streamChunk !== undefined && - object.streamMessage?.streamChunk !== null - ) { - message.streamMessage = { - $case: "streamChunk", - streamChunk: StreamChunk.fromPartial(object.streamMessage.streamChunk), - }; - } - if ( - object.streamMessage?.$case === "barrier" && - object.streamMessage?.barrier !== undefined && - object.streamMessage?.barrier !== null - ) { - message.streamMessage = { $case: "barrier", barrier: Barrier.fromPartial(object.streamMessage.barrier) }; - } - if ( - object.streamMessage?.$case === "watermark" && - object.streamMessage?.watermark !== undefined && - object.streamMessage?.watermark !== null - ) { - message.streamMessage = { $case: "watermark", watermark: Watermark.fromPartial(object.streamMessage.watermark) }; - } - return message; - }, -}; - -function createBaseActorMapping(): ActorMapping { - return { originalIndices: [], data: [] }; -} - -export const ActorMapping = { - fromJSON(object: any): ActorMapping { - return { - originalIndices: Array.isArray(object?.originalIndices) ? object.originalIndices.map((e: any) => Number(e)) : [], - data: Array.isArray(object?.data) ? object.data.map((e: any) => Number(e)) : [], - }; - }, - - toJSON(message: ActorMapping): unknown { - const obj: any = {}; - if (message.originalIndices) { - obj.originalIndices = message.originalIndices.map((e) => Math.round(e)); - } else { - obj.originalIndices = []; - } - if (message.data) { - obj.data = message.data.map((e) => Math.round(e)); - } else { - obj.data = []; - } - return obj; - }, - - fromPartial, I>>(object: I): ActorMapping { - const message = createBaseActorMapping(); - message.originalIndices = object.originalIndices?.map((e) => e) || []; - message.data = object.data?.map((e) => e) || []; - return message; - }, -}; - -function createBaseStreamSource(): StreamSource { - return { - sourceId: 0, - stateTable: undefined, - rowIdIndex: undefined, - columns: [], - pkColumnIds: [], - properties: {}, - info: undefined, - sourceName: "", - }; -} - -export const StreamSource = { - fromJSON(object: any): StreamSource { - return { - sourceId: isSet(object.sourceId) ? Number(object.sourceId) : 0, - stateTable: isSet(object.stateTable) ? Table.fromJSON(object.stateTable) : undefined, - rowIdIndex: isSet(object.rowIdIndex) ? Number(object.rowIdIndex) : undefined, - columns: Array.isArray(object?.columns) ? object.columns.map((e: any) => ColumnCatalog.fromJSON(e)) : [], - pkColumnIds: Array.isArray(object?.pkColumnIds) ? object.pkColumnIds.map((e: any) => Number(e)) : [], - properties: isObject(object.properties) - ? Object.entries(object.properties).reduce<{ [key: string]: string }>((acc, [key, value]) => { - acc[key] = String(value); - return acc; - }, {}) - : {}, - info: isSet(object.info) ? StreamSourceInfo.fromJSON(object.info) : undefined, - sourceName: isSet(object.sourceName) ? String(object.sourceName) : "", - }; - }, - - toJSON(message: StreamSource): unknown { - const obj: any = {}; - message.sourceId !== undefined && (obj.sourceId = Math.round(message.sourceId)); - message.stateTable !== undefined && - (obj.stateTable = message.stateTable ? Table.toJSON(message.stateTable) : undefined); - message.rowIdIndex !== undefined && (obj.rowIdIndex = Math.round(message.rowIdIndex)); - if (message.columns) { - obj.columns = message.columns.map((e) => e ? ColumnCatalog.toJSON(e) : undefined); - } else { - obj.columns = []; - } - if (message.pkColumnIds) { - obj.pkColumnIds = message.pkColumnIds.map((e) => Math.round(e)); - } else { - obj.pkColumnIds = []; - } - obj.properties = {}; - if (message.properties) { - Object.entries(message.properties).forEach(([k, v]) => { - obj.properties[k] = v; - }); - } - message.info !== undefined && (obj.info = message.info ? StreamSourceInfo.toJSON(message.info) : undefined); - message.sourceName !== undefined && (obj.sourceName = message.sourceName); - return obj; - }, - - fromPartial, I>>(object: I): StreamSource { - const message = createBaseStreamSource(); - message.sourceId = object.sourceId ?? 0; - message.stateTable = (object.stateTable !== undefined && object.stateTable !== null) - ? Table.fromPartial(object.stateTable) - : undefined; - message.rowIdIndex = object.rowIdIndex ?? undefined; - message.columns = object.columns?.map((e) => ColumnCatalog.fromPartial(e)) || []; - message.pkColumnIds = object.pkColumnIds?.map((e) => e) || []; - message.properties = Object.entries(object.properties ?? {}).reduce<{ [key: string]: string }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[key] = String(value); - } - return acc; - }, - {}, - ); - message.info = (object.info !== undefined && object.info !== null) - ? StreamSourceInfo.fromPartial(object.info) - : undefined; - message.sourceName = object.sourceName ?? ""; - return message; - }, -}; - -function createBaseStreamSource_PropertiesEntry(): StreamSource_PropertiesEntry { - return { key: "", value: "" }; -} - -export const StreamSource_PropertiesEntry = { - fromJSON(object: any): StreamSource_PropertiesEntry { - return { key: isSet(object.key) ? String(object.key) : "", value: isSet(object.value) ? String(object.value) : "" }; - }, - - toJSON(message: StreamSource_PropertiesEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = message.key); - message.value !== undefined && (obj.value = message.value); - return obj; - }, - - fromPartial, I>>(object: I): StreamSource_PropertiesEntry { - const message = createBaseStreamSource_PropertiesEntry(); - message.key = object.key ?? ""; - message.value = object.value ?? ""; - return message; - }, -}; - -function createBaseBarrierRecvNode(): BarrierRecvNode { - return {}; -} - -export const BarrierRecvNode = { - fromJSON(_: any): BarrierRecvNode { - return {}; - }, - - toJSON(_: BarrierRecvNode): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): BarrierRecvNode { - const message = createBaseBarrierRecvNode(); - return message; - }, -}; - -function createBaseSourceNode(): SourceNode { - return { sourceInner: undefined }; -} - -export const SourceNode = { - fromJSON(object: any): SourceNode { - return { sourceInner: isSet(object.sourceInner) ? StreamSource.fromJSON(object.sourceInner) : undefined }; - }, - - toJSON(message: SourceNode): unknown { - const obj: any = {}; - message.sourceInner !== undefined && - (obj.sourceInner = message.sourceInner ? StreamSource.toJSON(message.sourceInner) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): SourceNode { - const message = createBaseSourceNode(); - message.sourceInner = (object.sourceInner !== undefined && object.sourceInner !== null) - ? StreamSource.fromPartial(object.sourceInner) - : undefined; - return message; - }, -}; - -function createBaseSinkDesc(): SinkDesc { - return { - id: 0, - name: "", - definition: "", - columns: [], - planPk: [], - downstreamPk: [], - distributionKey: [], - properties: {}, - sinkType: SinkType.UNSPECIFIED, - }; -} - -export const SinkDesc = { - fromJSON(object: any): SinkDesc { - return { - id: isSet(object.id) ? Number(object.id) : 0, - name: isSet(object.name) ? String(object.name) : "", - definition: isSet(object.definition) ? String(object.definition) : "", - columns: Array.isArray(object?.columns) - ? object.columns.map((e: any) => ColumnDesc.fromJSON(e)) - : [], - planPk: Array.isArray(object?.planPk) ? object.planPk.map((e: any) => ColumnOrder.fromJSON(e)) : [], - downstreamPk: Array.isArray(object?.downstreamPk) ? object.downstreamPk.map((e: any) => Number(e)) : [], - distributionKey: Array.isArray(object?.distributionKey) ? object.distributionKey.map((e: any) => Number(e)) : [], - properties: isObject(object.properties) - ? Object.entries(object.properties).reduce<{ [key: string]: string }>((acc, [key, value]) => { - acc[key] = String(value); - return acc; - }, {}) - : {}, - sinkType: isSet(object.sinkType) ? sinkTypeFromJSON(object.sinkType) : SinkType.UNSPECIFIED, - }; - }, - - toJSON(message: SinkDesc): unknown { - const obj: any = {}; - message.id !== undefined && (obj.id = Math.round(message.id)); - message.name !== undefined && (obj.name = message.name); - message.definition !== undefined && (obj.definition = message.definition); - if (message.columns) { - obj.columns = message.columns.map((e) => e ? ColumnDesc.toJSON(e) : undefined); - } else { - obj.columns = []; - } - if (message.planPk) { - obj.planPk = message.planPk.map((e) => e ? ColumnOrder.toJSON(e) : undefined); - } else { - obj.planPk = []; - } - if (message.downstreamPk) { - obj.downstreamPk = message.downstreamPk.map((e) => Math.round(e)); - } else { - obj.downstreamPk = []; - } - if (message.distributionKey) { - obj.distributionKey = message.distributionKey.map((e) => Math.round(e)); - } else { - obj.distributionKey = []; - } - obj.properties = {}; - if (message.properties) { - Object.entries(message.properties).forEach(([k, v]) => { - obj.properties[k] = v; - }); - } - message.sinkType !== undefined && (obj.sinkType = sinkTypeToJSON(message.sinkType)); - return obj; - }, - - fromPartial, I>>(object: I): SinkDesc { - const message = createBaseSinkDesc(); - message.id = object.id ?? 0; - message.name = object.name ?? ""; - message.definition = object.definition ?? ""; - message.columns = object.columns?.map((e) => ColumnDesc.fromPartial(e)) || []; - message.planPk = object.planPk?.map((e) => ColumnOrder.fromPartial(e)) || []; - message.downstreamPk = object.downstreamPk?.map((e) => e) || []; - message.distributionKey = object.distributionKey?.map((e) => e) || []; - message.properties = Object.entries(object.properties ?? {}).reduce<{ [key: string]: string }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[key] = String(value); - } - return acc; - }, - {}, - ); - message.sinkType = object.sinkType ?? SinkType.UNSPECIFIED; - return message; - }, -}; - -function createBaseSinkDesc_PropertiesEntry(): SinkDesc_PropertiesEntry { - return { key: "", value: "" }; -} - -export const SinkDesc_PropertiesEntry = { - fromJSON(object: any): SinkDesc_PropertiesEntry { - return { key: isSet(object.key) ? String(object.key) : "", value: isSet(object.value) ? String(object.value) : "" }; - }, - - toJSON(message: SinkDesc_PropertiesEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = message.key); - message.value !== undefined && (obj.value = message.value); - return obj; - }, - - fromPartial, I>>(object: I): SinkDesc_PropertiesEntry { - const message = createBaseSinkDesc_PropertiesEntry(); - message.key = object.key ?? ""; - message.value = object.value ?? ""; - return message; - }, -}; - -function createBaseSinkNode(): SinkNode { - return { sinkDesc: undefined }; -} - -export const SinkNode = { - fromJSON(object: any): SinkNode { - return { sinkDesc: isSet(object.sinkDesc) ? SinkDesc.fromJSON(object.sinkDesc) : undefined }; - }, - - toJSON(message: SinkNode): unknown { - const obj: any = {}; - message.sinkDesc !== undefined && (obj.sinkDesc = message.sinkDesc ? SinkDesc.toJSON(message.sinkDesc) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): SinkNode { - const message = createBaseSinkNode(); - message.sinkDesc = (object.sinkDesc !== undefined && object.sinkDesc !== null) - ? SinkDesc.fromPartial(object.sinkDesc) - : undefined; - return message; - }, -}; - -function createBaseProjectNode(): ProjectNode { - return { selectList: [], watermarkInputKey: [], watermarkOutputKey: [] }; -} - -export const ProjectNode = { - fromJSON(object: any): ProjectNode { - return { - selectList: Array.isArray(object?.selectList) ? object.selectList.map((e: any) => ExprNode.fromJSON(e)) : [], - watermarkInputKey: Array.isArray(object?.watermarkInputKey) - ? object.watermarkInputKey.map((e: any) => Number(e)) - : [], - watermarkOutputKey: Array.isArray(object?.watermarkOutputKey) - ? object.watermarkOutputKey.map((e: any) => Number(e)) - : [], - }; - }, - - toJSON(message: ProjectNode): unknown { - const obj: any = {}; - if (message.selectList) { - obj.selectList = message.selectList.map((e) => e ? ExprNode.toJSON(e) : undefined); - } else { - obj.selectList = []; - } - if (message.watermarkInputKey) { - obj.watermarkInputKey = message.watermarkInputKey.map((e) => Math.round(e)); - } else { - obj.watermarkInputKey = []; - } - if (message.watermarkOutputKey) { - obj.watermarkOutputKey = message.watermarkOutputKey.map((e) => Math.round(e)); - } else { - obj.watermarkOutputKey = []; - } - return obj; - }, - - fromPartial, I>>(object: I): ProjectNode { - const message = createBaseProjectNode(); - message.selectList = object.selectList?.map((e) => ExprNode.fromPartial(e)) || []; - message.watermarkInputKey = object.watermarkInputKey?.map((e) => e) || []; - message.watermarkOutputKey = object.watermarkOutputKey?.map((e) => e) || []; - return message; - }, -}; - -function createBaseFilterNode(): FilterNode { - return { searchCondition: undefined }; -} - -export const FilterNode = { - fromJSON(object: any): FilterNode { - return { searchCondition: isSet(object.searchCondition) ? ExprNode.fromJSON(object.searchCondition) : undefined }; - }, - - toJSON(message: FilterNode): unknown { - const obj: any = {}; - message.searchCondition !== undefined && - (obj.searchCondition = message.searchCondition ? ExprNode.toJSON(message.searchCondition) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): FilterNode { - const message = createBaseFilterNode(); - message.searchCondition = (object.searchCondition !== undefined && object.searchCondition !== null) - ? ExprNode.fromPartial(object.searchCondition) - : undefined; - return message; - }, -}; - -function createBaseMaterializeNode(): MaterializeNode { - return { - tableId: 0, - columnOrders: [], - table: undefined, - handlePkConflictBehavior: HandleConflictBehavior.NO_CHECK_UNSPECIFIED, - }; -} - -export const MaterializeNode = { - fromJSON(object: any): MaterializeNode { - return { - tableId: isSet(object.tableId) ? Number(object.tableId) : 0, - columnOrders: Array.isArray(object?.columnOrders) - ? object.columnOrders.map((e: any) => ColumnOrder.fromJSON(e)) - : [], - table: isSet(object.table) ? Table.fromJSON(object.table) : undefined, - handlePkConflictBehavior: isSet(object.handlePkConflictBehavior) - ? handleConflictBehaviorFromJSON(object.handlePkConflictBehavior) - : HandleConflictBehavior.NO_CHECK_UNSPECIFIED, - }; - }, - - toJSON(message: MaterializeNode): unknown { - const obj: any = {}; - message.tableId !== undefined && (obj.tableId = Math.round(message.tableId)); - if (message.columnOrders) { - obj.columnOrders = message.columnOrders.map((e) => e ? ColumnOrder.toJSON(e) : undefined); - } else { - obj.columnOrders = []; - } - message.table !== undefined && (obj.table = message.table ? Table.toJSON(message.table) : undefined); - message.handlePkConflictBehavior !== undefined && - (obj.handlePkConflictBehavior = handleConflictBehaviorToJSON(message.handlePkConflictBehavior)); - return obj; - }, - - fromPartial, I>>(object: I): MaterializeNode { - const message = createBaseMaterializeNode(); - message.tableId = object.tableId ?? 0; - message.columnOrders = object.columnOrders?.map((e) => ColumnOrder.fromPartial(e)) || []; - message.table = (object.table !== undefined && object.table !== null) ? Table.fromPartial(object.table) : undefined; - message.handlePkConflictBehavior = object.handlePkConflictBehavior ?? HandleConflictBehavior.NO_CHECK_UNSPECIFIED; - return message; - }, -}; - -function createBaseAggCallState(): AggCallState { - return { inner: undefined }; -} - -export const AggCallState = { - fromJSON(object: any): AggCallState { - return { - inner: isSet(object.resultValueState) - ? { - $case: "resultValueState", - resultValueState: AggCallState_ResultValueState.fromJSON(object.resultValueState), - } - : isSet(object.tableState) - ? { $case: "tableState", tableState: AggCallState_TableState.fromJSON(object.tableState) } - : isSet(object.materializedInputState) - ? { - $case: "materializedInputState", - materializedInputState: AggCallState_MaterializedInputState.fromJSON(object.materializedInputState), - } - : undefined, - }; - }, - - toJSON(message: AggCallState): unknown { - const obj: any = {}; - message.inner?.$case === "resultValueState" && (obj.resultValueState = message.inner?.resultValueState - ? AggCallState_ResultValueState.toJSON(message.inner?.resultValueState) - : undefined); - message.inner?.$case === "tableState" && (obj.tableState = message.inner?.tableState - ? AggCallState_TableState.toJSON(message.inner?.tableState) - : undefined); - message.inner?.$case === "materializedInputState" && - (obj.materializedInputState = message.inner?.materializedInputState - ? AggCallState_MaterializedInputState.toJSON(message.inner?.materializedInputState) - : undefined); - return obj; - }, - - fromPartial, I>>(object: I): AggCallState { - const message = createBaseAggCallState(); - if ( - object.inner?.$case === "resultValueState" && - object.inner?.resultValueState !== undefined && - object.inner?.resultValueState !== null - ) { - message.inner = { - $case: "resultValueState", - resultValueState: AggCallState_ResultValueState.fromPartial(object.inner.resultValueState), - }; - } - if ( - object.inner?.$case === "tableState" && - object.inner?.tableState !== undefined && - object.inner?.tableState !== null - ) { - message.inner = { $case: "tableState", tableState: AggCallState_TableState.fromPartial(object.inner.tableState) }; - } - if ( - object.inner?.$case === "materializedInputState" && - object.inner?.materializedInputState !== undefined && - object.inner?.materializedInputState !== null - ) { - message.inner = { - $case: "materializedInputState", - materializedInputState: AggCallState_MaterializedInputState.fromPartial(object.inner.materializedInputState), - }; - } - return message; - }, -}; - -function createBaseAggCallState_ResultValueState(): AggCallState_ResultValueState { - return {}; -} - -export const AggCallState_ResultValueState = { - fromJSON(_: any): AggCallState_ResultValueState { - return {}; - }, - - toJSON(_: AggCallState_ResultValueState): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): AggCallState_ResultValueState { - const message = createBaseAggCallState_ResultValueState(); - return message; - }, -}; - -function createBaseAggCallState_TableState(): AggCallState_TableState { - return { table: undefined }; -} - -export const AggCallState_TableState = { - fromJSON(object: any): AggCallState_TableState { - return { table: isSet(object.table) ? Table.fromJSON(object.table) : undefined }; - }, - - toJSON(message: AggCallState_TableState): unknown { - const obj: any = {}; - message.table !== undefined && (obj.table = message.table ? Table.toJSON(message.table) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): AggCallState_TableState { - const message = createBaseAggCallState_TableState(); - message.table = (object.table !== undefined && object.table !== null) ? Table.fromPartial(object.table) : undefined; - return message; - }, -}; - -function createBaseAggCallState_MaterializedInputState(): AggCallState_MaterializedInputState { - return { table: undefined, includedUpstreamIndices: [], tableValueIndices: [] }; -} - -export const AggCallState_MaterializedInputState = { - fromJSON(object: any): AggCallState_MaterializedInputState { - return { - table: isSet(object.table) ? Table.fromJSON(object.table) : undefined, - includedUpstreamIndices: Array.isArray(object?.includedUpstreamIndices) - ? object.includedUpstreamIndices.map((e: any) => Number(e)) - : [], - tableValueIndices: Array.isArray(object?.tableValueIndices) - ? object.tableValueIndices.map((e: any) => Number(e)) - : [], - }; - }, - - toJSON(message: AggCallState_MaterializedInputState): unknown { - const obj: any = {}; - message.table !== undefined && (obj.table = message.table ? Table.toJSON(message.table) : undefined); - if (message.includedUpstreamIndices) { - obj.includedUpstreamIndices = message.includedUpstreamIndices.map((e) => Math.round(e)); - } else { - obj.includedUpstreamIndices = []; - } - if (message.tableValueIndices) { - obj.tableValueIndices = message.tableValueIndices.map((e) => Math.round(e)); - } else { - obj.tableValueIndices = []; - } - return obj; - }, - - fromPartial, I>>( - object: I, - ): AggCallState_MaterializedInputState { - const message = createBaseAggCallState_MaterializedInputState(); - message.table = (object.table !== undefined && object.table !== null) ? Table.fromPartial(object.table) : undefined; - message.includedUpstreamIndices = object.includedUpstreamIndices?.map((e) => e) || []; - message.tableValueIndices = object.tableValueIndices?.map((e) => e) || []; - return message; - }, -}; - -function createBaseSimpleAggNode(): SimpleAggNode { - return { - aggCalls: [], - distributionKey: [], - aggCallStates: [], - resultTable: undefined, - isAppendOnly: false, - distinctDedupTables: {}, - rowCountIndex: 0, - }; -} - -export const SimpleAggNode = { - fromJSON(object: any): SimpleAggNode { - return { - aggCalls: Array.isArray(object?.aggCalls) ? object.aggCalls.map((e: any) => AggCall.fromJSON(e)) : [], - distributionKey: Array.isArray(object?.distributionKey) ? object.distributionKey.map((e: any) => Number(e)) : [], - aggCallStates: Array.isArray(object?.aggCallStates) - ? object.aggCallStates.map((e: any) => AggCallState.fromJSON(e)) - : [], - resultTable: isSet(object.resultTable) ? Table.fromJSON(object.resultTable) : undefined, - isAppendOnly: isSet(object.isAppendOnly) ? Boolean(object.isAppendOnly) : false, - distinctDedupTables: isObject(object.distinctDedupTables) - ? Object.entries(object.distinctDedupTables).reduce<{ [key: number]: Table }>((acc, [key, value]) => { - acc[Number(key)] = Table.fromJSON(value); - return acc; - }, {}) - : {}, - rowCountIndex: isSet(object.rowCountIndex) ? Number(object.rowCountIndex) : 0, - }; - }, - - toJSON(message: SimpleAggNode): unknown { - const obj: any = {}; - if (message.aggCalls) { - obj.aggCalls = message.aggCalls.map((e) => e ? AggCall.toJSON(e) : undefined); - } else { - obj.aggCalls = []; - } - if (message.distributionKey) { - obj.distributionKey = message.distributionKey.map((e) => Math.round(e)); - } else { - obj.distributionKey = []; - } - if (message.aggCallStates) { - obj.aggCallStates = message.aggCallStates.map((e) => e ? AggCallState.toJSON(e) : undefined); - } else { - obj.aggCallStates = []; - } - message.resultTable !== undefined && - (obj.resultTable = message.resultTable ? Table.toJSON(message.resultTable) : undefined); - message.isAppendOnly !== undefined && (obj.isAppendOnly = message.isAppendOnly); - obj.distinctDedupTables = {}; - if (message.distinctDedupTables) { - Object.entries(message.distinctDedupTables).forEach(([k, v]) => { - obj.distinctDedupTables[k] = Table.toJSON(v); - }); - } - message.rowCountIndex !== undefined && (obj.rowCountIndex = Math.round(message.rowCountIndex)); - return obj; - }, - - fromPartial, I>>(object: I): SimpleAggNode { - const message = createBaseSimpleAggNode(); - message.aggCalls = object.aggCalls?.map((e) => AggCall.fromPartial(e)) || []; - message.distributionKey = object.distributionKey?.map((e) => e) || []; - message.aggCallStates = object.aggCallStates?.map((e) => AggCallState.fromPartial(e)) || []; - message.resultTable = (object.resultTable !== undefined && object.resultTable !== null) - ? Table.fromPartial(object.resultTable) - : undefined; - message.isAppendOnly = object.isAppendOnly ?? false; - message.distinctDedupTables = Object.entries(object.distinctDedupTables ?? {}).reduce<{ [key: number]: Table }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[Number(key)] = Table.fromPartial(value); - } - return acc; - }, - {}, - ); - message.rowCountIndex = object.rowCountIndex ?? 0; - return message; - }, -}; - -function createBaseSimpleAggNode_DistinctDedupTablesEntry(): SimpleAggNode_DistinctDedupTablesEntry { - return { key: 0, value: undefined }; -} - -export const SimpleAggNode_DistinctDedupTablesEntry = { - fromJSON(object: any): SimpleAggNode_DistinctDedupTablesEntry { - return { - key: isSet(object.key) ? Number(object.key) : 0, - value: isSet(object.value) ? Table.fromJSON(object.value) : undefined, - }; - }, - - toJSON(message: SimpleAggNode_DistinctDedupTablesEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = Math.round(message.key)); - message.value !== undefined && (obj.value = message.value ? Table.toJSON(message.value) : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): SimpleAggNode_DistinctDedupTablesEntry { - const message = createBaseSimpleAggNode_DistinctDedupTablesEntry(); - message.key = object.key ?? 0; - message.value = (object.value !== undefined && object.value !== null) ? Table.fromPartial(object.value) : undefined; - return message; - }, -}; - -function createBaseHashAggNode(): HashAggNode { - return { - groupKey: [], - aggCalls: [], - aggCallStates: [], - resultTable: undefined, - isAppendOnly: false, - distinctDedupTables: {}, - rowCountIndex: 0, - }; -} - -export const HashAggNode = { - fromJSON(object: any): HashAggNode { - return { - groupKey: Array.isArray(object?.groupKey) ? object.groupKey.map((e: any) => Number(e)) : [], - aggCalls: Array.isArray(object?.aggCalls) ? object.aggCalls.map((e: any) => AggCall.fromJSON(e)) : [], - aggCallStates: Array.isArray(object?.aggCallStates) - ? object.aggCallStates.map((e: any) => AggCallState.fromJSON(e)) - : [], - resultTable: isSet(object.resultTable) ? Table.fromJSON(object.resultTable) : undefined, - isAppendOnly: isSet(object.isAppendOnly) ? Boolean(object.isAppendOnly) : false, - distinctDedupTables: isObject(object.distinctDedupTables) - ? Object.entries(object.distinctDedupTables).reduce<{ [key: number]: Table }>((acc, [key, value]) => { - acc[Number(key)] = Table.fromJSON(value); - return acc; - }, {}) - : {}, - rowCountIndex: isSet(object.rowCountIndex) ? Number(object.rowCountIndex) : 0, - }; - }, - - toJSON(message: HashAggNode): unknown { - const obj: any = {}; - if (message.groupKey) { - obj.groupKey = message.groupKey.map((e) => Math.round(e)); - } else { - obj.groupKey = []; - } - if (message.aggCalls) { - obj.aggCalls = message.aggCalls.map((e) => e ? AggCall.toJSON(e) : undefined); - } else { - obj.aggCalls = []; - } - if (message.aggCallStates) { - obj.aggCallStates = message.aggCallStates.map((e) => e ? AggCallState.toJSON(e) : undefined); - } else { - obj.aggCallStates = []; - } - message.resultTable !== undefined && - (obj.resultTable = message.resultTable ? Table.toJSON(message.resultTable) : undefined); - message.isAppendOnly !== undefined && (obj.isAppendOnly = message.isAppendOnly); - obj.distinctDedupTables = {}; - if (message.distinctDedupTables) { - Object.entries(message.distinctDedupTables).forEach(([k, v]) => { - obj.distinctDedupTables[k] = Table.toJSON(v); - }); - } - message.rowCountIndex !== undefined && (obj.rowCountIndex = Math.round(message.rowCountIndex)); - return obj; - }, - - fromPartial, I>>(object: I): HashAggNode { - const message = createBaseHashAggNode(); - message.groupKey = object.groupKey?.map((e) => e) || []; - message.aggCalls = object.aggCalls?.map((e) => AggCall.fromPartial(e)) || []; - message.aggCallStates = object.aggCallStates?.map((e) => AggCallState.fromPartial(e)) || []; - message.resultTable = (object.resultTable !== undefined && object.resultTable !== null) - ? Table.fromPartial(object.resultTable) - : undefined; - message.isAppendOnly = object.isAppendOnly ?? false; - message.distinctDedupTables = Object.entries(object.distinctDedupTables ?? {}).reduce<{ [key: number]: Table }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[Number(key)] = Table.fromPartial(value); - } - return acc; - }, - {}, - ); - message.rowCountIndex = object.rowCountIndex ?? 0; - return message; - }, -}; - -function createBaseHashAggNode_DistinctDedupTablesEntry(): HashAggNode_DistinctDedupTablesEntry { - return { key: 0, value: undefined }; -} - -export const HashAggNode_DistinctDedupTablesEntry = { - fromJSON(object: any): HashAggNode_DistinctDedupTablesEntry { - return { - key: isSet(object.key) ? Number(object.key) : 0, - value: isSet(object.value) ? Table.fromJSON(object.value) : undefined, - }; - }, - - toJSON(message: HashAggNode_DistinctDedupTablesEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = Math.round(message.key)); - message.value !== undefined && (obj.value = message.value ? Table.toJSON(message.value) : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): HashAggNode_DistinctDedupTablesEntry { - const message = createBaseHashAggNode_DistinctDedupTablesEntry(); - message.key = object.key ?? 0; - message.value = (object.value !== undefined && object.value !== null) ? Table.fromPartial(object.value) : undefined; - return message; - }, -}; - -function createBaseTopNNode(): TopNNode { - return { limit: 0, offset: 0, table: undefined, orderBy: [], withTies: false }; -} - -export const TopNNode = { - fromJSON(object: any): TopNNode { - return { - limit: isSet(object.limit) ? Number(object.limit) : 0, - offset: isSet(object.offset) ? Number(object.offset) : 0, - table: isSet(object.table) ? Table.fromJSON(object.table) : undefined, - orderBy: Array.isArray(object?.orderBy) ? object.orderBy.map((e: any) => ColumnOrder.fromJSON(e)) : [], - withTies: isSet(object.withTies) ? Boolean(object.withTies) : false, - }; - }, - - toJSON(message: TopNNode): unknown { - const obj: any = {}; - message.limit !== undefined && (obj.limit = Math.round(message.limit)); - message.offset !== undefined && (obj.offset = Math.round(message.offset)); - message.table !== undefined && (obj.table = message.table ? Table.toJSON(message.table) : undefined); - if (message.orderBy) { - obj.orderBy = message.orderBy.map((e) => e ? ColumnOrder.toJSON(e) : undefined); - } else { - obj.orderBy = []; - } - message.withTies !== undefined && (obj.withTies = message.withTies); - return obj; - }, - - fromPartial, I>>(object: I): TopNNode { - const message = createBaseTopNNode(); - message.limit = object.limit ?? 0; - message.offset = object.offset ?? 0; - message.table = (object.table !== undefined && object.table !== null) ? Table.fromPartial(object.table) : undefined; - message.orderBy = object.orderBy?.map((e) => ColumnOrder.fromPartial(e)) || []; - message.withTies = object.withTies ?? false; - return message; - }, -}; - -function createBaseGroupTopNNode(): GroupTopNNode { - return { limit: 0, offset: 0, groupKey: [], table: undefined, orderBy: [], withTies: false }; -} - -export const GroupTopNNode = { - fromJSON(object: any): GroupTopNNode { - return { - limit: isSet(object.limit) ? Number(object.limit) : 0, - offset: isSet(object.offset) ? Number(object.offset) : 0, - groupKey: Array.isArray(object?.groupKey) ? object.groupKey.map((e: any) => Number(e)) : [], - table: isSet(object.table) ? Table.fromJSON(object.table) : undefined, - orderBy: Array.isArray(object?.orderBy) ? object.orderBy.map((e: any) => ColumnOrder.fromJSON(e)) : [], - withTies: isSet(object.withTies) ? Boolean(object.withTies) : false, - }; - }, - - toJSON(message: GroupTopNNode): unknown { - const obj: any = {}; - message.limit !== undefined && (obj.limit = Math.round(message.limit)); - message.offset !== undefined && (obj.offset = Math.round(message.offset)); - if (message.groupKey) { - obj.groupKey = message.groupKey.map((e) => Math.round(e)); - } else { - obj.groupKey = []; - } - message.table !== undefined && (obj.table = message.table ? Table.toJSON(message.table) : undefined); - if (message.orderBy) { - obj.orderBy = message.orderBy.map((e) => e ? ColumnOrder.toJSON(e) : undefined); - } else { - obj.orderBy = []; - } - message.withTies !== undefined && (obj.withTies = message.withTies); - return obj; - }, - - fromPartial, I>>(object: I): GroupTopNNode { - const message = createBaseGroupTopNNode(); - message.limit = object.limit ?? 0; - message.offset = object.offset ?? 0; - message.groupKey = object.groupKey?.map((e) => e) || []; - message.table = (object.table !== undefined && object.table !== null) ? Table.fromPartial(object.table) : undefined; - message.orderBy = object.orderBy?.map((e) => ColumnOrder.fromPartial(e)) || []; - message.withTies = object.withTies ?? false; - return message; - }, -}; - -function createBaseHashJoinNode(): HashJoinNode { - return { - joinType: JoinType.UNSPECIFIED, - leftKey: [], - rightKey: [], - condition: undefined, - leftTable: undefined, - rightTable: undefined, - leftDegreeTable: undefined, - rightDegreeTable: undefined, - outputIndices: [], - leftDedupedInputPkIndices: [], - rightDedupedInputPkIndices: [], - nullSafe: [], - isAppendOnly: false, - }; -} - -export const HashJoinNode = { - fromJSON(object: any): HashJoinNode { - return { - joinType: isSet(object.joinType) ? joinTypeFromJSON(object.joinType) : JoinType.UNSPECIFIED, - leftKey: Array.isArray(object?.leftKey) ? object.leftKey.map((e: any) => Number(e)) : [], - rightKey: Array.isArray(object?.rightKey) ? object.rightKey.map((e: any) => Number(e)) : [], - condition: isSet(object.condition) ? ExprNode.fromJSON(object.condition) : undefined, - leftTable: isSet(object.leftTable) ? Table.fromJSON(object.leftTable) : undefined, - rightTable: isSet(object.rightTable) ? Table.fromJSON(object.rightTable) : undefined, - leftDegreeTable: isSet(object.leftDegreeTable) ? Table.fromJSON(object.leftDegreeTable) : undefined, - rightDegreeTable: isSet(object.rightDegreeTable) ? Table.fromJSON(object.rightDegreeTable) : undefined, - outputIndices: Array.isArray(object?.outputIndices) ? object.outputIndices.map((e: any) => Number(e)) : [], - leftDedupedInputPkIndices: Array.isArray(object?.leftDedupedInputPkIndices) - ? object.leftDedupedInputPkIndices.map((e: any) => Number(e)) - : [], - rightDedupedInputPkIndices: Array.isArray(object?.rightDedupedInputPkIndices) - ? object.rightDedupedInputPkIndices.map((e: any) => Number(e)) - : [], - nullSafe: Array.isArray(object?.nullSafe) ? object.nullSafe.map((e: any) => Boolean(e)) : [], - isAppendOnly: isSet(object.isAppendOnly) ? Boolean(object.isAppendOnly) : false, - }; - }, - - toJSON(message: HashJoinNode): unknown { - const obj: any = {}; - message.joinType !== undefined && (obj.joinType = joinTypeToJSON(message.joinType)); - if (message.leftKey) { - obj.leftKey = message.leftKey.map((e) => Math.round(e)); - } else { - obj.leftKey = []; - } - if (message.rightKey) { - obj.rightKey = message.rightKey.map((e) => Math.round(e)); - } else { - obj.rightKey = []; - } - message.condition !== undefined && - (obj.condition = message.condition ? ExprNode.toJSON(message.condition) : undefined); - message.leftTable !== undefined && - (obj.leftTable = message.leftTable ? Table.toJSON(message.leftTable) : undefined); - message.rightTable !== undefined && - (obj.rightTable = message.rightTable ? Table.toJSON(message.rightTable) : undefined); - message.leftDegreeTable !== undefined && - (obj.leftDegreeTable = message.leftDegreeTable ? Table.toJSON(message.leftDegreeTable) : undefined); - message.rightDegreeTable !== undefined && - (obj.rightDegreeTable = message.rightDegreeTable ? Table.toJSON(message.rightDegreeTable) : undefined); - if (message.outputIndices) { - obj.outputIndices = message.outputIndices.map((e) => Math.round(e)); - } else { - obj.outputIndices = []; - } - if (message.leftDedupedInputPkIndices) { - obj.leftDedupedInputPkIndices = message.leftDedupedInputPkIndices.map((e) => Math.round(e)); - } else { - obj.leftDedupedInputPkIndices = []; - } - if (message.rightDedupedInputPkIndices) { - obj.rightDedupedInputPkIndices = message.rightDedupedInputPkIndices.map((e) => Math.round(e)); - } else { - obj.rightDedupedInputPkIndices = []; - } - if (message.nullSafe) { - obj.nullSafe = message.nullSafe.map((e) => e); - } else { - obj.nullSafe = []; - } - message.isAppendOnly !== undefined && (obj.isAppendOnly = message.isAppendOnly); - return obj; - }, - - fromPartial, I>>(object: I): HashJoinNode { - const message = createBaseHashJoinNode(); - message.joinType = object.joinType ?? JoinType.UNSPECIFIED; - message.leftKey = object.leftKey?.map((e) => e) || []; - message.rightKey = object.rightKey?.map((e) => e) || []; - message.condition = (object.condition !== undefined && object.condition !== null) - ? ExprNode.fromPartial(object.condition) - : undefined; - message.leftTable = (object.leftTable !== undefined && object.leftTable !== null) - ? Table.fromPartial(object.leftTable) - : undefined; - message.rightTable = (object.rightTable !== undefined && object.rightTable !== null) - ? Table.fromPartial(object.rightTable) - : undefined; - message.leftDegreeTable = (object.leftDegreeTable !== undefined && object.leftDegreeTable !== null) - ? Table.fromPartial(object.leftDegreeTable) - : undefined; - message.rightDegreeTable = (object.rightDegreeTable !== undefined && object.rightDegreeTable !== null) - ? Table.fromPartial(object.rightDegreeTable) - : undefined; - message.outputIndices = object.outputIndices?.map((e) => e) || []; - message.leftDedupedInputPkIndices = object.leftDedupedInputPkIndices?.map((e) => e) || []; - message.rightDedupedInputPkIndices = object.rightDedupedInputPkIndices?.map((e) => e) || []; - message.nullSafe = object.nullSafe?.map((e) => e) || []; - message.isAppendOnly = object.isAppendOnly ?? false; - return message; - }, -}; - -function createBaseTemporalJoinNode(): TemporalJoinNode { - return { - joinType: JoinType.UNSPECIFIED, - leftKey: [], - rightKey: [], - nullSafe: [], - condition: undefined, - outputIndices: [], - tableDesc: undefined, - tableOutputIndices: [], - }; -} - -export const TemporalJoinNode = { - fromJSON(object: any): TemporalJoinNode { - return { - joinType: isSet(object.joinType) ? joinTypeFromJSON(object.joinType) : JoinType.UNSPECIFIED, - leftKey: Array.isArray(object?.leftKey) ? object.leftKey.map((e: any) => Number(e)) : [], - rightKey: Array.isArray(object?.rightKey) ? object.rightKey.map((e: any) => Number(e)) : [], - nullSafe: Array.isArray(object?.nullSafe) ? object.nullSafe.map((e: any) => Boolean(e)) : [], - condition: isSet(object.condition) ? ExprNode.fromJSON(object.condition) : undefined, - outputIndices: Array.isArray(object?.outputIndices) ? object.outputIndices.map((e: any) => Number(e)) : [], - tableDesc: isSet(object.tableDesc) ? StorageTableDesc.fromJSON(object.tableDesc) : undefined, - tableOutputIndices: Array.isArray(object?.tableOutputIndices) - ? object.tableOutputIndices.map((e: any) => Number(e)) - : [], - }; - }, - - toJSON(message: TemporalJoinNode): unknown { - const obj: any = {}; - message.joinType !== undefined && (obj.joinType = joinTypeToJSON(message.joinType)); - if (message.leftKey) { - obj.leftKey = message.leftKey.map((e) => Math.round(e)); - } else { - obj.leftKey = []; - } - if (message.rightKey) { - obj.rightKey = message.rightKey.map((e) => Math.round(e)); - } else { - obj.rightKey = []; - } - if (message.nullSafe) { - obj.nullSafe = message.nullSafe.map((e) => e); - } else { - obj.nullSafe = []; - } - message.condition !== undefined && - (obj.condition = message.condition ? ExprNode.toJSON(message.condition) : undefined); - if (message.outputIndices) { - obj.outputIndices = message.outputIndices.map((e) => Math.round(e)); - } else { - obj.outputIndices = []; - } - message.tableDesc !== undefined && - (obj.tableDesc = message.tableDesc ? StorageTableDesc.toJSON(message.tableDesc) : undefined); - if (message.tableOutputIndices) { - obj.tableOutputIndices = message.tableOutputIndices.map((e) => Math.round(e)); - } else { - obj.tableOutputIndices = []; - } - return obj; - }, - - fromPartial, I>>(object: I): TemporalJoinNode { - const message = createBaseTemporalJoinNode(); - message.joinType = object.joinType ?? JoinType.UNSPECIFIED; - message.leftKey = object.leftKey?.map((e) => e) || []; - message.rightKey = object.rightKey?.map((e) => e) || []; - message.nullSafe = object.nullSafe?.map((e) => e) || []; - message.condition = (object.condition !== undefined && object.condition !== null) - ? ExprNode.fromPartial(object.condition) - : undefined; - message.outputIndices = object.outputIndices?.map((e) => e) || []; - message.tableDesc = (object.tableDesc !== undefined && object.tableDesc !== null) - ? StorageTableDesc.fromPartial(object.tableDesc) - : undefined; - message.tableOutputIndices = object.tableOutputIndices?.map((e) => e) || []; - return message; - }, -}; - -function createBaseDynamicFilterNode(): DynamicFilterNode { - return { leftKey: 0, condition: undefined, leftTable: undefined, rightTable: undefined }; -} - -export const DynamicFilterNode = { - fromJSON(object: any): DynamicFilterNode { - return { - leftKey: isSet(object.leftKey) ? Number(object.leftKey) : 0, - condition: isSet(object.condition) ? ExprNode.fromJSON(object.condition) : undefined, - leftTable: isSet(object.leftTable) ? Table.fromJSON(object.leftTable) : undefined, - rightTable: isSet(object.rightTable) ? Table.fromJSON(object.rightTable) : undefined, - }; - }, - - toJSON(message: DynamicFilterNode): unknown { - const obj: any = {}; - message.leftKey !== undefined && (obj.leftKey = Math.round(message.leftKey)); - message.condition !== undefined && - (obj.condition = message.condition ? ExprNode.toJSON(message.condition) : undefined); - message.leftTable !== undefined && - (obj.leftTable = message.leftTable ? Table.toJSON(message.leftTable) : undefined); - message.rightTable !== undefined && - (obj.rightTable = message.rightTable ? Table.toJSON(message.rightTable) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): DynamicFilterNode { - const message = createBaseDynamicFilterNode(); - message.leftKey = object.leftKey ?? 0; - message.condition = (object.condition !== undefined && object.condition !== null) - ? ExprNode.fromPartial(object.condition) - : undefined; - message.leftTable = (object.leftTable !== undefined && object.leftTable !== null) - ? Table.fromPartial(object.leftTable) - : undefined; - message.rightTable = (object.rightTable !== undefined && object.rightTable !== null) - ? Table.fromPartial(object.rightTable) - : undefined; - return message; - }, -}; - -function createBaseDeltaIndexJoinNode(): DeltaIndexJoinNode { - return { - joinType: JoinType.UNSPECIFIED, - leftKey: [], - rightKey: [], - condition: undefined, - leftTableId: 0, - rightTableId: 0, - leftInfo: undefined, - rightInfo: undefined, - outputIndices: [], - }; -} - -export const DeltaIndexJoinNode = { - fromJSON(object: any): DeltaIndexJoinNode { - return { - joinType: isSet(object.joinType) ? joinTypeFromJSON(object.joinType) : JoinType.UNSPECIFIED, - leftKey: Array.isArray(object?.leftKey) ? object.leftKey.map((e: any) => Number(e)) : [], - rightKey: Array.isArray(object?.rightKey) ? object.rightKey.map((e: any) => Number(e)) : [], - condition: isSet(object.condition) ? ExprNode.fromJSON(object.condition) : undefined, - leftTableId: isSet(object.leftTableId) ? Number(object.leftTableId) : 0, - rightTableId: isSet(object.rightTableId) ? Number(object.rightTableId) : 0, - leftInfo: isSet(object.leftInfo) ? ArrangementInfo.fromJSON(object.leftInfo) : undefined, - rightInfo: isSet(object.rightInfo) ? ArrangementInfo.fromJSON(object.rightInfo) : undefined, - outputIndices: Array.isArray(object?.outputIndices) ? object.outputIndices.map((e: any) => Number(e)) : [], - }; - }, - - toJSON(message: DeltaIndexJoinNode): unknown { - const obj: any = {}; - message.joinType !== undefined && (obj.joinType = joinTypeToJSON(message.joinType)); - if (message.leftKey) { - obj.leftKey = message.leftKey.map((e) => Math.round(e)); - } else { - obj.leftKey = []; - } - if (message.rightKey) { - obj.rightKey = message.rightKey.map((e) => Math.round(e)); - } else { - obj.rightKey = []; - } - message.condition !== undefined && - (obj.condition = message.condition ? ExprNode.toJSON(message.condition) : undefined); - message.leftTableId !== undefined && (obj.leftTableId = Math.round(message.leftTableId)); - message.rightTableId !== undefined && (obj.rightTableId = Math.round(message.rightTableId)); - message.leftInfo !== undefined && - (obj.leftInfo = message.leftInfo ? ArrangementInfo.toJSON(message.leftInfo) : undefined); - message.rightInfo !== undefined && - (obj.rightInfo = message.rightInfo ? ArrangementInfo.toJSON(message.rightInfo) : undefined); - if (message.outputIndices) { - obj.outputIndices = message.outputIndices.map((e) => Math.round(e)); - } else { - obj.outputIndices = []; - } - return obj; - }, - - fromPartial, I>>(object: I): DeltaIndexJoinNode { - const message = createBaseDeltaIndexJoinNode(); - message.joinType = object.joinType ?? JoinType.UNSPECIFIED; - message.leftKey = object.leftKey?.map((e) => e) || []; - message.rightKey = object.rightKey?.map((e) => e) || []; - message.condition = (object.condition !== undefined && object.condition !== null) - ? ExprNode.fromPartial(object.condition) - : undefined; - message.leftTableId = object.leftTableId ?? 0; - message.rightTableId = object.rightTableId ?? 0; - message.leftInfo = (object.leftInfo !== undefined && object.leftInfo !== null) - ? ArrangementInfo.fromPartial(object.leftInfo) - : undefined; - message.rightInfo = (object.rightInfo !== undefined && object.rightInfo !== null) - ? ArrangementInfo.fromPartial(object.rightInfo) - : undefined; - message.outputIndices = object.outputIndices?.map((e) => e) || []; - return message; - }, -}; - -function createBaseHopWindowNode(): HopWindowNode { - return { - timeCol: 0, - windowSlide: undefined, - windowSize: undefined, - outputIndices: [], - windowStartExprs: [], - windowEndExprs: [], - }; -} - -export const HopWindowNode = { - fromJSON(object: any): HopWindowNode { - return { - timeCol: isSet(object.timeCol) ? Number(object.timeCol) : 0, - windowSlide: isSet(object.windowSlide) ? IntervalUnit.fromJSON(object.windowSlide) : undefined, - windowSize: isSet(object.windowSize) ? IntervalUnit.fromJSON(object.windowSize) : undefined, - outputIndices: Array.isArray(object?.outputIndices) ? object.outputIndices.map((e: any) => Number(e)) : [], - windowStartExprs: Array.isArray(object?.windowStartExprs) - ? object.windowStartExprs.map((e: any) => ExprNode.fromJSON(e)) - : [], - windowEndExprs: Array.isArray(object?.windowEndExprs) - ? object.windowEndExprs.map((e: any) => ExprNode.fromJSON(e)) - : [], - }; - }, - - toJSON(message: HopWindowNode): unknown { - const obj: any = {}; - message.timeCol !== undefined && (obj.timeCol = Math.round(message.timeCol)); - message.windowSlide !== undefined && - (obj.windowSlide = message.windowSlide ? IntervalUnit.toJSON(message.windowSlide) : undefined); - message.windowSize !== undefined && - (obj.windowSize = message.windowSize ? IntervalUnit.toJSON(message.windowSize) : undefined); - if (message.outputIndices) { - obj.outputIndices = message.outputIndices.map((e) => Math.round(e)); - } else { - obj.outputIndices = []; - } - if (message.windowStartExprs) { - obj.windowStartExprs = message.windowStartExprs.map((e) => e ? ExprNode.toJSON(e) : undefined); - } else { - obj.windowStartExprs = []; - } - if (message.windowEndExprs) { - obj.windowEndExprs = message.windowEndExprs.map((e) => e ? ExprNode.toJSON(e) : undefined); - } else { - obj.windowEndExprs = []; - } - return obj; - }, - - fromPartial, I>>(object: I): HopWindowNode { - const message = createBaseHopWindowNode(); - message.timeCol = object.timeCol ?? 0; - message.windowSlide = (object.windowSlide !== undefined && object.windowSlide !== null) - ? IntervalUnit.fromPartial(object.windowSlide) - : undefined; - message.windowSize = (object.windowSize !== undefined && object.windowSize !== null) - ? IntervalUnit.fromPartial(object.windowSize) - : undefined; - message.outputIndices = object.outputIndices?.map((e) => e) || []; - message.windowStartExprs = object.windowStartExprs?.map((e) => ExprNode.fromPartial(e)) || []; - message.windowEndExprs = object.windowEndExprs?.map((e) => ExprNode.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseMergeNode(): MergeNode { - return { upstreamActorId: [], upstreamFragmentId: 0, upstreamDispatcherType: DispatcherType.UNSPECIFIED, fields: [] }; -} - -export const MergeNode = { - fromJSON(object: any): MergeNode { - return { - upstreamActorId: Array.isArray(object?.upstreamActorId) ? object.upstreamActorId.map((e: any) => Number(e)) : [], - upstreamFragmentId: isSet(object.upstreamFragmentId) ? Number(object.upstreamFragmentId) : 0, - upstreamDispatcherType: isSet(object.upstreamDispatcherType) - ? dispatcherTypeFromJSON(object.upstreamDispatcherType) - : DispatcherType.UNSPECIFIED, - fields: Array.isArray(object?.fields) ? object.fields.map((e: any) => Field.fromJSON(e)) : [], - }; - }, - - toJSON(message: MergeNode): unknown { - const obj: any = {}; - if (message.upstreamActorId) { - obj.upstreamActorId = message.upstreamActorId.map((e) => Math.round(e)); - } else { - obj.upstreamActorId = []; - } - message.upstreamFragmentId !== undefined && (obj.upstreamFragmentId = Math.round(message.upstreamFragmentId)); - message.upstreamDispatcherType !== undefined && - (obj.upstreamDispatcherType = dispatcherTypeToJSON(message.upstreamDispatcherType)); - if (message.fields) { - obj.fields = message.fields.map((e) => e ? Field.toJSON(e) : undefined); - } else { - obj.fields = []; - } - return obj; - }, - - fromPartial, I>>(object: I): MergeNode { - const message = createBaseMergeNode(); - message.upstreamActorId = object.upstreamActorId?.map((e) => e) || []; - message.upstreamFragmentId = object.upstreamFragmentId ?? 0; - message.upstreamDispatcherType = object.upstreamDispatcherType ?? DispatcherType.UNSPECIFIED; - message.fields = object.fields?.map((e) => Field.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseExchangeNode(): ExchangeNode { - return { strategy: undefined }; -} - -export const ExchangeNode = { - fromJSON(object: any): ExchangeNode { - return { strategy: isSet(object.strategy) ? DispatchStrategy.fromJSON(object.strategy) : undefined }; - }, - - toJSON(message: ExchangeNode): unknown { - const obj: any = {}; - message.strategy !== undefined && - (obj.strategy = message.strategy ? DispatchStrategy.toJSON(message.strategy) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): ExchangeNode { - const message = createBaseExchangeNode(); - message.strategy = (object.strategy !== undefined && object.strategy !== null) - ? DispatchStrategy.fromPartial(object.strategy) - : undefined; - return message; - }, -}; - -function createBaseChainNode(): ChainNode { - return { - tableId: 0, - upstreamColumnIds: [], - outputIndices: [], - chainType: ChainType.CHAIN_UNSPECIFIED, - tableDesc: undefined, - }; -} - -export const ChainNode = { - fromJSON(object: any): ChainNode { - return { - tableId: isSet(object.tableId) ? Number(object.tableId) : 0, - upstreamColumnIds: Array.isArray(object?.upstreamColumnIds) - ? object.upstreamColumnIds.map((e: any) => Number(e)) - : [], - outputIndices: Array.isArray(object?.outputIndices) - ? object.outputIndices.map((e: any) => Number(e)) - : [], - chainType: isSet(object.chainType) ? chainTypeFromJSON(object.chainType) : ChainType.CHAIN_UNSPECIFIED, - tableDesc: isSet(object.tableDesc) ? StorageTableDesc.fromJSON(object.tableDesc) : undefined, - }; - }, - - toJSON(message: ChainNode): unknown { - const obj: any = {}; - message.tableId !== undefined && (obj.tableId = Math.round(message.tableId)); - if (message.upstreamColumnIds) { - obj.upstreamColumnIds = message.upstreamColumnIds.map((e) => Math.round(e)); - } else { - obj.upstreamColumnIds = []; - } - if (message.outputIndices) { - obj.outputIndices = message.outputIndices.map((e) => Math.round(e)); - } else { - obj.outputIndices = []; - } - message.chainType !== undefined && (obj.chainType = chainTypeToJSON(message.chainType)); - message.tableDesc !== undefined && - (obj.tableDesc = message.tableDesc ? StorageTableDesc.toJSON(message.tableDesc) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): ChainNode { - const message = createBaseChainNode(); - message.tableId = object.tableId ?? 0; - message.upstreamColumnIds = object.upstreamColumnIds?.map((e) => e) || []; - message.outputIndices = object.outputIndices?.map((e) => e) || []; - message.chainType = object.chainType ?? ChainType.CHAIN_UNSPECIFIED; - message.tableDesc = (object.tableDesc !== undefined && object.tableDesc !== null) - ? StorageTableDesc.fromPartial(object.tableDesc) - : undefined; - return message; - }, -}; - -function createBaseBatchPlanNode(): BatchPlanNode { - return { tableDesc: undefined, columnIds: [] }; -} - -export const BatchPlanNode = { - fromJSON(object: any): BatchPlanNode { - return { - tableDesc: isSet(object.tableDesc) ? StorageTableDesc.fromJSON(object.tableDesc) : undefined, - columnIds: Array.isArray(object?.columnIds) ? object.columnIds.map((e: any) => Number(e)) : [], - }; - }, - - toJSON(message: BatchPlanNode): unknown { - const obj: any = {}; - message.tableDesc !== undefined && - (obj.tableDesc = message.tableDesc ? StorageTableDesc.toJSON(message.tableDesc) : undefined); - if (message.columnIds) { - obj.columnIds = message.columnIds.map((e) => Math.round(e)); - } else { - obj.columnIds = []; - } - return obj; - }, - - fromPartial, I>>(object: I): BatchPlanNode { - const message = createBaseBatchPlanNode(); - message.tableDesc = (object.tableDesc !== undefined && object.tableDesc !== null) - ? StorageTableDesc.fromPartial(object.tableDesc) - : undefined; - message.columnIds = object.columnIds?.map((e) => e) || []; - return message; - }, -}; - -function createBaseArrangementInfo(): ArrangementInfo { - return { arrangeKeyOrders: [], columnDescs: [], tableDesc: undefined }; -} - -export const ArrangementInfo = { - fromJSON(object: any): ArrangementInfo { - return { - arrangeKeyOrders: Array.isArray(object?.arrangeKeyOrders) - ? object.arrangeKeyOrders.map((e: any) => ColumnOrder.fromJSON(e)) - : [], - columnDescs: Array.isArray(object?.columnDescs) - ? object.columnDescs.map((e: any) => ColumnDesc.fromJSON(e)) - : [], - tableDesc: isSet(object.tableDesc) ? StorageTableDesc.fromJSON(object.tableDesc) : undefined, - }; - }, - - toJSON(message: ArrangementInfo): unknown { - const obj: any = {}; - if (message.arrangeKeyOrders) { - obj.arrangeKeyOrders = message.arrangeKeyOrders.map((e) => e ? ColumnOrder.toJSON(e) : undefined); - } else { - obj.arrangeKeyOrders = []; - } - if (message.columnDescs) { - obj.columnDescs = message.columnDescs.map((e) => e ? ColumnDesc.toJSON(e) : undefined); - } else { - obj.columnDescs = []; - } - message.tableDesc !== undefined && - (obj.tableDesc = message.tableDesc ? StorageTableDesc.toJSON(message.tableDesc) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): ArrangementInfo { - const message = createBaseArrangementInfo(); - message.arrangeKeyOrders = object.arrangeKeyOrders?.map((e) => ColumnOrder.fromPartial(e)) || []; - message.columnDescs = object.columnDescs?.map((e) => ColumnDesc.fromPartial(e)) || []; - message.tableDesc = (object.tableDesc !== undefined && object.tableDesc !== null) - ? StorageTableDesc.fromPartial(object.tableDesc) - : undefined; - return message; - }, -}; - -function createBaseArrangeNode(): ArrangeNode { - return { - tableInfo: undefined, - distributionKey: [], - table: undefined, - handlePkConflictBehavior: HandleConflictBehavior.NO_CHECK_UNSPECIFIED, - }; -} - -export const ArrangeNode = { - fromJSON(object: any): ArrangeNode { - return { - tableInfo: isSet(object.tableInfo) ? ArrangementInfo.fromJSON(object.tableInfo) : undefined, - distributionKey: Array.isArray(object?.distributionKey) ? object.distributionKey.map((e: any) => Number(e)) : [], - table: isSet(object.table) ? Table.fromJSON(object.table) : undefined, - handlePkConflictBehavior: isSet(object.handlePkConflictBehavior) - ? handleConflictBehaviorFromJSON(object.handlePkConflictBehavior) - : HandleConflictBehavior.NO_CHECK_UNSPECIFIED, - }; - }, - - toJSON(message: ArrangeNode): unknown { - const obj: any = {}; - message.tableInfo !== undefined && - (obj.tableInfo = message.tableInfo ? ArrangementInfo.toJSON(message.tableInfo) : undefined); - if (message.distributionKey) { - obj.distributionKey = message.distributionKey.map((e) => Math.round(e)); - } else { - obj.distributionKey = []; - } - message.table !== undefined && (obj.table = message.table ? Table.toJSON(message.table) : undefined); - message.handlePkConflictBehavior !== undefined && - (obj.handlePkConflictBehavior = handleConflictBehaviorToJSON(message.handlePkConflictBehavior)); - return obj; - }, - - fromPartial, I>>(object: I): ArrangeNode { - const message = createBaseArrangeNode(); - message.tableInfo = (object.tableInfo !== undefined && object.tableInfo !== null) - ? ArrangementInfo.fromPartial(object.tableInfo) - : undefined; - message.distributionKey = object.distributionKey?.map((e) => e) || []; - message.table = (object.table !== undefined && object.table !== null) ? Table.fromPartial(object.table) : undefined; - message.handlePkConflictBehavior = object.handlePkConflictBehavior ?? HandleConflictBehavior.NO_CHECK_UNSPECIFIED; - return message; - }, -}; - -function createBaseLookupNode(): LookupNode { - return { - arrangeKey: [], - streamKey: [], - useCurrentEpoch: false, - columnMapping: [], - arrangementTableId: undefined, - arrangementTableInfo: undefined, - }; -} - -export const LookupNode = { - fromJSON(object: any): LookupNode { - return { - arrangeKey: Array.isArray(object?.arrangeKey) ? object.arrangeKey.map((e: any) => Number(e)) : [], - streamKey: Array.isArray(object?.streamKey) ? object.streamKey.map((e: any) => Number(e)) : [], - useCurrentEpoch: isSet(object.useCurrentEpoch) ? Boolean(object.useCurrentEpoch) : false, - columnMapping: Array.isArray(object?.columnMapping) ? object.columnMapping.map((e: any) => Number(e)) : [], - arrangementTableId: isSet(object.tableId) - ? { $case: "tableId", tableId: Number(object.tableId) } - : isSet(object.indexId) - ? { $case: "indexId", indexId: Number(object.indexId) } - : undefined, - arrangementTableInfo: isSet(object.arrangementTableInfo) - ? ArrangementInfo.fromJSON(object.arrangementTableInfo) - : undefined, - }; - }, - - toJSON(message: LookupNode): unknown { - const obj: any = {}; - if (message.arrangeKey) { - obj.arrangeKey = message.arrangeKey.map((e) => Math.round(e)); - } else { - obj.arrangeKey = []; - } - if (message.streamKey) { - obj.streamKey = message.streamKey.map((e) => Math.round(e)); - } else { - obj.streamKey = []; - } - message.useCurrentEpoch !== undefined && (obj.useCurrentEpoch = message.useCurrentEpoch); - if (message.columnMapping) { - obj.columnMapping = message.columnMapping.map((e) => Math.round(e)); - } else { - obj.columnMapping = []; - } - message.arrangementTableId?.$case === "tableId" && (obj.tableId = Math.round(message.arrangementTableId?.tableId)); - message.arrangementTableId?.$case === "indexId" && (obj.indexId = Math.round(message.arrangementTableId?.indexId)); - message.arrangementTableInfo !== undefined && (obj.arrangementTableInfo = message.arrangementTableInfo - ? ArrangementInfo.toJSON(message.arrangementTableInfo) - : undefined); - return obj; - }, - - fromPartial, I>>(object: I): LookupNode { - const message = createBaseLookupNode(); - message.arrangeKey = object.arrangeKey?.map((e) => e) || []; - message.streamKey = object.streamKey?.map((e) => e) || []; - message.useCurrentEpoch = object.useCurrentEpoch ?? false; - message.columnMapping = object.columnMapping?.map((e) => e) || []; - if ( - object.arrangementTableId?.$case === "tableId" && - object.arrangementTableId?.tableId !== undefined && - object.arrangementTableId?.tableId !== null - ) { - message.arrangementTableId = { $case: "tableId", tableId: object.arrangementTableId.tableId }; - } - if ( - object.arrangementTableId?.$case === "indexId" && - object.arrangementTableId?.indexId !== undefined && - object.arrangementTableId?.indexId !== null - ) { - message.arrangementTableId = { $case: "indexId", indexId: object.arrangementTableId.indexId }; - } - message.arrangementTableInfo = (object.arrangementTableInfo !== undefined && object.arrangementTableInfo !== null) - ? ArrangementInfo.fromPartial(object.arrangementTableInfo) - : undefined; - return message; - }, -}; - -function createBaseWatermarkFilterNode(): WatermarkFilterNode { - return { watermarkDescs: [], tables: [] }; -} - -export const WatermarkFilterNode = { - fromJSON(object: any): WatermarkFilterNode { - return { - watermarkDescs: Array.isArray(object?.watermarkDescs) - ? object.watermarkDescs.map((e: any) => WatermarkDesc.fromJSON(e)) - : [], - tables: Array.isArray(object?.tables) - ? object.tables.map((e: any) => Table.fromJSON(e)) - : [], - }; - }, - - toJSON(message: WatermarkFilterNode): unknown { - const obj: any = {}; - if (message.watermarkDescs) { - obj.watermarkDescs = message.watermarkDescs.map((e) => e ? WatermarkDesc.toJSON(e) : undefined); - } else { - obj.watermarkDescs = []; - } - if (message.tables) { - obj.tables = message.tables.map((e) => e ? Table.toJSON(e) : undefined); - } else { - obj.tables = []; - } - return obj; - }, - - fromPartial, I>>(object: I): WatermarkFilterNode { - const message = createBaseWatermarkFilterNode(); - message.watermarkDescs = object.watermarkDescs?.map((e) => WatermarkDesc.fromPartial(e)) || []; - message.tables = object.tables?.map((e) => Table.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseUnionNode(): UnionNode { - return {}; -} - -export const UnionNode = { - fromJSON(_: any): UnionNode { - return {}; - }, - - toJSON(_: UnionNode): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): UnionNode { - const message = createBaseUnionNode(); - return message; - }, -}; - -function createBaseLookupUnionNode(): LookupUnionNode { - return { order: [] }; -} - -export const LookupUnionNode = { - fromJSON(object: any): LookupUnionNode { - return { order: Array.isArray(object?.order) ? object.order.map((e: any) => Number(e)) : [] }; - }, - - toJSON(message: LookupUnionNode): unknown { - const obj: any = {}; - if (message.order) { - obj.order = message.order.map((e) => Math.round(e)); - } else { - obj.order = []; - } - return obj; - }, - - fromPartial, I>>(object: I): LookupUnionNode { - const message = createBaseLookupUnionNode(); - message.order = object.order?.map((e) => e) || []; - return message; - }, -}; - -function createBaseExpandNode(): ExpandNode { - return { columnSubsets: [] }; -} - -export const ExpandNode = { - fromJSON(object: any): ExpandNode { - return { - columnSubsets: Array.isArray(object?.columnSubsets) - ? object.columnSubsets.map((e: any) => ExpandNode_Subset.fromJSON(e)) - : [], - }; - }, - - toJSON(message: ExpandNode): unknown { - const obj: any = {}; - if (message.columnSubsets) { - obj.columnSubsets = message.columnSubsets.map((e) => e ? ExpandNode_Subset.toJSON(e) : undefined); - } else { - obj.columnSubsets = []; - } - return obj; - }, - - fromPartial, I>>(object: I): ExpandNode { - const message = createBaseExpandNode(); - message.columnSubsets = object.columnSubsets?.map((e) => ExpandNode_Subset.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseExpandNode_Subset(): ExpandNode_Subset { - return { columnIndices: [] }; -} - -export const ExpandNode_Subset = { - fromJSON(object: any): ExpandNode_Subset { - return { - columnIndices: Array.isArray(object?.columnIndices) ? object.columnIndices.map((e: any) => Number(e)) : [], - }; - }, - - toJSON(message: ExpandNode_Subset): unknown { - const obj: any = {}; - if (message.columnIndices) { - obj.columnIndices = message.columnIndices.map((e) => Math.round(e)); - } else { - obj.columnIndices = []; - } - return obj; - }, - - fromPartial, I>>(object: I): ExpandNode_Subset { - const message = createBaseExpandNode_Subset(); - message.columnIndices = object.columnIndices?.map((e) => e) || []; - return message; - }, -}; - -function createBaseProjectSetNode(): ProjectSetNode { - return { selectList: [] }; -} - -export const ProjectSetNode = { - fromJSON(object: any): ProjectSetNode { - return { - selectList: Array.isArray(object?.selectList) - ? object.selectList.map((e: any) => ProjectSetSelectItem.fromJSON(e)) - : [], - }; - }, - - toJSON(message: ProjectSetNode): unknown { - const obj: any = {}; - if (message.selectList) { - obj.selectList = message.selectList.map((e) => e ? ProjectSetSelectItem.toJSON(e) : undefined); - } else { - obj.selectList = []; - } - return obj; - }, - - fromPartial, I>>(object: I): ProjectSetNode { - const message = createBaseProjectSetNode(); - message.selectList = object.selectList?.map((e) => ProjectSetSelectItem.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseSortNode(): SortNode { - return { stateTable: undefined, sortColumnIndex: 0 }; -} - -export const SortNode = { - fromJSON(object: any): SortNode { - return { - stateTable: isSet(object.stateTable) ? Table.fromJSON(object.stateTable) : undefined, - sortColumnIndex: isSet(object.sortColumnIndex) ? Number(object.sortColumnIndex) : 0, - }; - }, - - toJSON(message: SortNode): unknown { - const obj: any = {}; - message.stateTable !== undefined && - (obj.stateTable = message.stateTable ? Table.toJSON(message.stateTable) : undefined); - message.sortColumnIndex !== undefined && (obj.sortColumnIndex = Math.round(message.sortColumnIndex)); - return obj; - }, - - fromPartial, I>>(object: I): SortNode { - const message = createBaseSortNode(); - message.stateTable = (object.stateTable !== undefined && object.stateTable !== null) - ? Table.fromPartial(object.stateTable) - : undefined; - message.sortColumnIndex = object.sortColumnIndex ?? 0; - return message; - }, -}; - -function createBaseDmlNode(): DmlNode { - return { tableId: 0, tableVersionId: 0, columnDescs: [] }; -} - -export const DmlNode = { - fromJSON(object: any): DmlNode { - return { - tableId: isSet(object.tableId) ? Number(object.tableId) : 0, - tableVersionId: isSet(object.tableVersionId) ? Number(object.tableVersionId) : 0, - columnDescs: Array.isArray(object?.columnDescs) ? object.columnDescs.map((e: any) => ColumnDesc.fromJSON(e)) : [], - }; - }, - - toJSON(message: DmlNode): unknown { - const obj: any = {}; - message.tableId !== undefined && (obj.tableId = Math.round(message.tableId)); - message.tableVersionId !== undefined && (obj.tableVersionId = Math.round(message.tableVersionId)); - if (message.columnDescs) { - obj.columnDescs = message.columnDescs.map((e) => e ? ColumnDesc.toJSON(e) : undefined); - } else { - obj.columnDescs = []; - } - return obj; - }, - - fromPartial, I>>(object: I): DmlNode { - const message = createBaseDmlNode(); - message.tableId = object.tableId ?? 0; - message.tableVersionId = object.tableVersionId ?? 0; - message.columnDescs = object.columnDescs?.map((e) => ColumnDesc.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseRowIdGenNode(): RowIdGenNode { - return { rowIdIndex: 0 }; -} - -export const RowIdGenNode = { - fromJSON(object: any): RowIdGenNode { - return { rowIdIndex: isSet(object.rowIdIndex) ? Number(object.rowIdIndex) : 0 }; - }, - - toJSON(message: RowIdGenNode): unknown { - const obj: any = {}; - message.rowIdIndex !== undefined && (obj.rowIdIndex = Math.round(message.rowIdIndex)); - return obj; - }, - - fromPartial, I>>(object: I): RowIdGenNode { - const message = createBaseRowIdGenNode(); - message.rowIdIndex = object.rowIdIndex ?? 0; - return message; - }, -}; - -function createBaseNowNode(): NowNode { - return { stateTable: undefined }; -} - -export const NowNode = { - fromJSON(object: any): NowNode { - return { stateTable: isSet(object.stateTable) ? Table.fromJSON(object.stateTable) : undefined }; - }, - - toJSON(message: NowNode): unknown { - const obj: any = {}; - message.stateTable !== undefined && - (obj.stateTable = message.stateTable ? Table.toJSON(message.stateTable) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): NowNode { - const message = createBaseNowNode(); - message.stateTable = (object.stateTable !== undefined && object.stateTable !== null) - ? Table.fromPartial(object.stateTable) - : undefined; - return message; - }, -}; - -function createBaseStreamNode(): StreamNode { - return { nodeBody: undefined, operatorId: 0, input: [], streamKey: [], appendOnly: false, identity: "", fields: [] }; -} - -export const StreamNode = { - fromJSON(object: any): StreamNode { - return { - nodeBody: isSet(object.source) - ? { $case: "source", source: SourceNode.fromJSON(object.source) } - : isSet(object.project) - ? { $case: "project", project: ProjectNode.fromJSON(object.project) } - : isSet(object.filter) - ? { $case: "filter", filter: FilterNode.fromJSON(object.filter) } - : isSet(object.materialize) - ? { $case: "materialize", materialize: MaterializeNode.fromJSON(object.materialize) } - : isSet(object.localSimpleAgg) - ? { $case: "localSimpleAgg", localSimpleAgg: SimpleAggNode.fromJSON(object.localSimpleAgg) } - : isSet(object.globalSimpleAgg) - ? { $case: "globalSimpleAgg", globalSimpleAgg: SimpleAggNode.fromJSON(object.globalSimpleAgg) } - : isSet(object.hashAgg) - ? { $case: "hashAgg", hashAgg: HashAggNode.fromJSON(object.hashAgg) } - : isSet(object.appendOnlyTopN) - ? { $case: "appendOnlyTopN", appendOnlyTopN: TopNNode.fromJSON(object.appendOnlyTopN) } - : isSet(object.hashJoin) - ? { $case: "hashJoin", hashJoin: HashJoinNode.fromJSON(object.hashJoin) } - : isSet(object.topN) - ? { $case: "topN", topN: TopNNode.fromJSON(object.topN) } - : isSet(object.hopWindow) - ? { $case: "hopWindow", hopWindow: HopWindowNode.fromJSON(object.hopWindow) } - : isSet(object.merge) - ? { $case: "merge", merge: MergeNode.fromJSON(object.merge) } - : isSet(object.exchange) - ? { $case: "exchange", exchange: ExchangeNode.fromJSON(object.exchange) } - : isSet(object.chain) - ? { $case: "chain", chain: ChainNode.fromJSON(object.chain) } - : isSet(object.batchPlan) - ? { $case: "batchPlan", batchPlan: BatchPlanNode.fromJSON(object.batchPlan) } - : isSet(object.lookup) - ? { $case: "lookup", lookup: LookupNode.fromJSON(object.lookup) } - : isSet(object.arrange) - ? { $case: "arrange", arrange: ArrangeNode.fromJSON(object.arrange) } - : isSet(object.lookupUnion) - ? { $case: "lookupUnion", lookupUnion: LookupUnionNode.fromJSON(object.lookupUnion) } - : isSet(object.union) - ? { $case: "union", union: UnionNode.fromJSON(object.union) } - : isSet(object.deltaIndexJoin) - ? { $case: "deltaIndexJoin", deltaIndexJoin: DeltaIndexJoinNode.fromJSON(object.deltaIndexJoin) } - : isSet(object.sink) - ? { $case: "sink", sink: SinkNode.fromJSON(object.sink) } - : isSet(object.expand) - ? { $case: "expand", expand: ExpandNode.fromJSON(object.expand) } - : isSet(object.dynamicFilter) - ? { $case: "dynamicFilter", dynamicFilter: DynamicFilterNode.fromJSON(object.dynamicFilter) } - : isSet(object.projectSet) - ? { $case: "projectSet", projectSet: ProjectSetNode.fromJSON(object.projectSet) } - : isSet(object.groupTopN) - ? { $case: "groupTopN", groupTopN: GroupTopNNode.fromJSON(object.groupTopN) } - : isSet(object.sort) - ? { $case: "sort", sort: SortNode.fromJSON(object.sort) } - : isSet(object.watermarkFilter) - ? { $case: "watermarkFilter", watermarkFilter: WatermarkFilterNode.fromJSON(object.watermarkFilter) } - : isSet(object.dml) - ? { $case: "dml", dml: DmlNode.fromJSON(object.dml) } - : isSet(object.rowIdGen) - ? { $case: "rowIdGen", rowIdGen: RowIdGenNode.fromJSON(object.rowIdGen) } - : isSet(object.now) - ? { $case: "now", now: NowNode.fromJSON(object.now) } - : isSet(object.appendOnlyGroupTopN) - ? { $case: "appendOnlyGroupTopN", appendOnlyGroupTopN: GroupTopNNode.fromJSON(object.appendOnlyGroupTopN) } - : isSet(object.temporalJoin) - ? { $case: "temporalJoin", temporalJoin: TemporalJoinNode.fromJSON(object.temporalJoin) } - : isSet(object.barrierRecv) - ? { $case: "barrierRecv", barrierRecv: BarrierRecvNode.fromJSON(object.barrierRecv) } - : undefined, - operatorId: isSet(object.operatorId) ? Number(object.operatorId) : 0, - input: Array.isArray(object?.input) - ? object.input.map((e: any) => StreamNode.fromJSON(e)) - : [], - streamKey: Array.isArray(object?.streamKey) ? object.streamKey.map((e: any) => Number(e)) : [], - appendOnly: isSet(object.appendOnly) ? Boolean(object.appendOnly) : false, - identity: isSet(object.identity) ? String(object.identity) : "", - fields: Array.isArray(object?.fields) ? object.fields.map((e: any) => Field.fromJSON(e)) : [], - }; - }, - - toJSON(message: StreamNode): unknown { - const obj: any = {}; - message.nodeBody?.$case === "source" && - (obj.source = message.nodeBody?.source ? SourceNode.toJSON(message.nodeBody?.source) : undefined); - message.nodeBody?.$case === "project" && - (obj.project = message.nodeBody?.project ? ProjectNode.toJSON(message.nodeBody?.project) : undefined); - message.nodeBody?.$case === "filter" && - (obj.filter = message.nodeBody?.filter ? FilterNode.toJSON(message.nodeBody?.filter) : undefined); - message.nodeBody?.$case === "materialize" && (obj.materialize = message.nodeBody?.materialize - ? MaterializeNode.toJSON(message.nodeBody?.materialize) - : undefined); - message.nodeBody?.$case === "localSimpleAgg" && (obj.localSimpleAgg = message.nodeBody?.localSimpleAgg - ? SimpleAggNode.toJSON(message.nodeBody?.localSimpleAgg) - : undefined); - message.nodeBody?.$case === "globalSimpleAgg" && (obj.globalSimpleAgg = message.nodeBody?.globalSimpleAgg - ? SimpleAggNode.toJSON(message.nodeBody?.globalSimpleAgg) - : undefined); - message.nodeBody?.$case === "hashAgg" && - (obj.hashAgg = message.nodeBody?.hashAgg ? HashAggNode.toJSON(message.nodeBody?.hashAgg) : undefined); - message.nodeBody?.$case === "appendOnlyTopN" && (obj.appendOnlyTopN = message.nodeBody?.appendOnlyTopN - ? TopNNode.toJSON(message.nodeBody?.appendOnlyTopN) - : undefined); - message.nodeBody?.$case === "hashJoin" && - (obj.hashJoin = message.nodeBody?.hashJoin ? HashJoinNode.toJSON(message.nodeBody?.hashJoin) : undefined); - message.nodeBody?.$case === "topN" && - (obj.topN = message.nodeBody?.topN ? TopNNode.toJSON(message.nodeBody?.topN) : undefined); - message.nodeBody?.$case === "hopWindow" && - (obj.hopWindow = message.nodeBody?.hopWindow ? HopWindowNode.toJSON(message.nodeBody?.hopWindow) : undefined); - message.nodeBody?.$case === "merge" && - (obj.merge = message.nodeBody?.merge ? MergeNode.toJSON(message.nodeBody?.merge) : undefined); - message.nodeBody?.$case === "exchange" && - (obj.exchange = message.nodeBody?.exchange ? ExchangeNode.toJSON(message.nodeBody?.exchange) : undefined); - message.nodeBody?.$case === "chain" && - (obj.chain = message.nodeBody?.chain ? ChainNode.toJSON(message.nodeBody?.chain) : undefined); - message.nodeBody?.$case === "batchPlan" && - (obj.batchPlan = message.nodeBody?.batchPlan ? BatchPlanNode.toJSON(message.nodeBody?.batchPlan) : undefined); - message.nodeBody?.$case === "lookup" && - (obj.lookup = message.nodeBody?.lookup ? LookupNode.toJSON(message.nodeBody?.lookup) : undefined); - message.nodeBody?.$case === "arrange" && - (obj.arrange = message.nodeBody?.arrange ? ArrangeNode.toJSON(message.nodeBody?.arrange) : undefined); - message.nodeBody?.$case === "lookupUnion" && (obj.lookupUnion = message.nodeBody?.lookupUnion - ? LookupUnionNode.toJSON(message.nodeBody?.lookupUnion) - : undefined); - message.nodeBody?.$case === "union" && - (obj.union = message.nodeBody?.union ? UnionNode.toJSON(message.nodeBody?.union) : undefined); - message.nodeBody?.$case === "deltaIndexJoin" && (obj.deltaIndexJoin = message.nodeBody?.deltaIndexJoin - ? DeltaIndexJoinNode.toJSON(message.nodeBody?.deltaIndexJoin) - : undefined); - message.nodeBody?.$case === "sink" && - (obj.sink = message.nodeBody?.sink ? SinkNode.toJSON(message.nodeBody?.sink) : undefined); - message.nodeBody?.$case === "expand" && - (obj.expand = message.nodeBody?.expand ? ExpandNode.toJSON(message.nodeBody?.expand) : undefined); - message.nodeBody?.$case === "dynamicFilter" && (obj.dynamicFilter = message.nodeBody?.dynamicFilter - ? DynamicFilterNode.toJSON(message.nodeBody?.dynamicFilter) - : undefined); - message.nodeBody?.$case === "projectSet" && - (obj.projectSet = message.nodeBody?.projectSet ? ProjectSetNode.toJSON(message.nodeBody?.projectSet) : undefined); - message.nodeBody?.$case === "groupTopN" && - (obj.groupTopN = message.nodeBody?.groupTopN ? GroupTopNNode.toJSON(message.nodeBody?.groupTopN) : undefined); - message.nodeBody?.$case === "sort" && - (obj.sort = message.nodeBody?.sort ? SortNode.toJSON(message.nodeBody?.sort) : undefined); - message.nodeBody?.$case === "watermarkFilter" && (obj.watermarkFilter = message.nodeBody?.watermarkFilter - ? WatermarkFilterNode.toJSON(message.nodeBody?.watermarkFilter) - : undefined); - message.nodeBody?.$case === "dml" && - (obj.dml = message.nodeBody?.dml ? DmlNode.toJSON(message.nodeBody?.dml) : undefined); - message.nodeBody?.$case === "rowIdGen" && - (obj.rowIdGen = message.nodeBody?.rowIdGen ? RowIdGenNode.toJSON(message.nodeBody?.rowIdGen) : undefined); - message.nodeBody?.$case === "now" && - (obj.now = message.nodeBody?.now ? NowNode.toJSON(message.nodeBody?.now) : undefined); - message.nodeBody?.$case === "appendOnlyGroupTopN" && - (obj.appendOnlyGroupTopN = message.nodeBody?.appendOnlyGroupTopN - ? GroupTopNNode.toJSON(message.nodeBody?.appendOnlyGroupTopN) - : undefined); - message.nodeBody?.$case === "temporalJoin" && (obj.temporalJoin = message.nodeBody?.temporalJoin - ? TemporalJoinNode.toJSON(message.nodeBody?.temporalJoin) - : undefined); - message.nodeBody?.$case === "barrierRecv" && (obj.barrierRecv = message.nodeBody?.barrierRecv - ? BarrierRecvNode.toJSON(message.nodeBody?.barrierRecv) - : undefined); - message.operatorId !== undefined && (obj.operatorId = Math.round(message.operatorId)); - if (message.input) { - obj.input = message.input.map((e) => - e ? StreamNode.toJSON(e) : undefined - ); - } else { - obj.input = []; - } - if (message.streamKey) { - obj.streamKey = message.streamKey.map((e) => - Math.round(e) - ); - } else { - obj.streamKey = []; - } - message.appendOnly !== undefined && (obj.appendOnly = message.appendOnly); - message.identity !== undefined && (obj.identity = message.identity); - if (message.fields) { - obj.fields = message.fields.map((e) => - e ? Field.toJSON(e) : undefined - ); - } else { - obj.fields = []; - } - return obj; - }, - - fromPartial, I>>(object: I): StreamNode { - const message = createBaseStreamNode(); - if ( - object.nodeBody?.$case === "source" && object.nodeBody?.source !== undefined && object.nodeBody?.source !== null - ) { - message.nodeBody = { $case: "source", source: SourceNode.fromPartial(object.nodeBody.source) }; - } - if ( - object.nodeBody?.$case === "project" && - object.nodeBody?.project !== undefined && - object.nodeBody?.project !== null - ) { - message.nodeBody = { $case: "project", project: ProjectNode.fromPartial(object.nodeBody.project) }; - } - if ( - object.nodeBody?.$case === "filter" && object.nodeBody?.filter !== undefined && object.nodeBody?.filter !== null - ) { - message.nodeBody = { $case: "filter", filter: FilterNode.fromPartial(object.nodeBody.filter) }; - } - if ( - object.nodeBody?.$case === "materialize" && - object.nodeBody?.materialize !== undefined && - object.nodeBody?.materialize !== null - ) { - message.nodeBody = { - $case: "materialize", - materialize: MaterializeNode.fromPartial(object.nodeBody.materialize), - }; - } - if ( - object.nodeBody?.$case === "localSimpleAgg" && - object.nodeBody?.localSimpleAgg !== undefined && - object.nodeBody?.localSimpleAgg !== null - ) { - message.nodeBody = { - $case: "localSimpleAgg", - localSimpleAgg: SimpleAggNode.fromPartial(object.nodeBody.localSimpleAgg), - }; - } - if ( - object.nodeBody?.$case === "globalSimpleAgg" && - object.nodeBody?.globalSimpleAgg !== undefined && - object.nodeBody?.globalSimpleAgg !== null - ) { - message.nodeBody = { - $case: "globalSimpleAgg", - globalSimpleAgg: SimpleAggNode.fromPartial(object.nodeBody.globalSimpleAgg), - }; - } - if ( - object.nodeBody?.$case === "hashAgg" && - object.nodeBody?.hashAgg !== undefined && - object.nodeBody?.hashAgg !== null - ) { - message.nodeBody = { $case: "hashAgg", hashAgg: HashAggNode.fromPartial(object.nodeBody.hashAgg) }; - } - if ( - object.nodeBody?.$case === "appendOnlyTopN" && - object.nodeBody?.appendOnlyTopN !== undefined && - object.nodeBody?.appendOnlyTopN !== null - ) { - message.nodeBody = { - $case: "appendOnlyTopN", - appendOnlyTopN: TopNNode.fromPartial(object.nodeBody.appendOnlyTopN), - }; - } - if ( - object.nodeBody?.$case === "hashJoin" && - object.nodeBody?.hashJoin !== undefined && - object.nodeBody?.hashJoin !== null - ) { - message.nodeBody = { $case: "hashJoin", hashJoin: HashJoinNode.fromPartial(object.nodeBody.hashJoin) }; - } - if (object.nodeBody?.$case === "topN" && object.nodeBody?.topN !== undefined && object.nodeBody?.topN !== null) { - message.nodeBody = { $case: "topN", topN: TopNNode.fromPartial(object.nodeBody.topN) }; - } - if ( - object.nodeBody?.$case === "hopWindow" && - object.nodeBody?.hopWindow !== undefined && - object.nodeBody?.hopWindow !== null - ) { - message.nodeBody = { $case: "hopWindow", hopWindow: HopWindowNode.fromPartial(object.nodeBody.hopWindow) }; - } - if (object.nodeBody?.$case === "merge" && object.nodeBody?.merge !== undefined && object.nodeBody?.merge !== null) { - message.nodeBody = { $case: "merge", merge: MergeNode.fromPartial(object.nodeBody.merge) }; - } - if ( - object.nodeBody?.$case === "exchange" && - object.nodeBody?.exchange !== undefined && - object.nodeBody?.exchange !== null - ) { - message.nodeBody = { $case: "exchange", exchange: ExchangeNode.fromPartial(object.nodeBody.exchange) }; - } - if (object.nodeBody?.$case === "chain" && object.nodeBody?.chain !== undefined && object.nodeBody?.chain !== null) { - message.nodeBody = { $case: "chain", chain: ChainNode.fromPartial(object.nodeBody.chain) }; - } - if ( - object.nodeBody?.$case === "batchPlan" && - object.nodeBody?.batchPlan !== undefined && - object.nodeBody?.batchPlan !== null - ) { - message.nodeBody = { $case: "batchPlan", batchPlan: BatchPlanNode.fromPartial(object.nodeBody.batchPlan) }; - } - if ( - object.nodeBody?.$case === "lookup" && object.nodeBody?.lookup !== undefined && object.nodeBody?.lookup !== null - ) { - message.nodeBody = { $case: "lookup", lookup: LookupNode.fromPartial(object.nodeBody.lookup) }; - } - if ( - object.nodeBody?.$case === "arrange" && - object.nodeBody?.arrange !== undefined && - object.nodeBody?.arrange !== null - ) { - message.nodeBody = { $case: "arrange", arrange: ArrangeNode.fromPartial(object.nodeBody.arrange) }; - } - if ( - object.nodeBody?.$case === "lookupUnion" && - object.nodeBody?.lookupUnion !== undefined && - object.nodeBody?.lookupUnion !== null - ) { - message.nodeBody = { - $case: "lookupUnion", - lookupUnion: LookupUnionNode.fromPartial(object.nodeBody.lookupUnion), - }; - } - if (object.nodeBody?.$case === "union" && object.nodeBody?.union !== undefined && object.nodeBody?.union !== null) { - message.nodeBody = { $case: "union", union: UnionNode.fromPartial(object.nodeBody.union) }; - } - if ( - object.nodeBody?.$case === "deltaIndexJoin" && - object.nodeBody?.deltaIndexJoin !== undefined && - object.nodeBody?.deltaIndexJoin !== null - ) { - message.nodeBody = { - $case: "deltaIndexJoin", - deltaIndexJoin: DeltaIndexJoinNode.fromPartial(object.nodeBody.deltaIndexJoin), - }; - } - if (object.nodeBody?.$case === "sink" && object.nodeBody?.sink !== undefined && object.nodeBody?.sink !== null) { - message.nodeBody = { $case: "sink", sink: SinkNode.fromPartial(object.nodeBody.sink) }; - } - if ( - object.nodeBody?.$case === "expand" && object.nodeBody?.expand !== undefined && object.nodeBody?.expand !== null - ) { - message.nodeBody = { $case: "expand", expand: ExpandNode.fromPartial(object.nodeBody.expand) }; - } - if ( - object.nodeBody?.$case === "dynamicFilter" && - object.nodeBody?.dynamicFilter !== undefined && - object.nodeBody?.dynamicFilter !== null - ) { - message.nodeBody = { - $case: "dynamicFilter", - dynamicFilter: DynamicFilterNode.fromPartial(object.nodeBody.dynamicFilter), - }; - } - if ( - object.nodeBody?.$case === "projectSet" && - object.nodeBody?.projectSet !== undefined && - object.nodeBody?.projectSet !== null - ) { - message.nodeBody = { $case: "projectSet", projectSet: ProjectSetNode.fromPartial(object.nodeBody.projectSet) }; - } - if ( - object.nodeBody?.$case === "groupTopN" && - object.nodeBody?.groupTopN !== undefined && - object.nodeBody?.groupTopN !== null - ) { - message.nodeBody = { $case: "groupTopN", groupTopN: GroupTopNNode.fromPartial(object.nodeBody.groupTopN) }; - } - if (object.nodeBody?.$case === "sort" && object.nodeBody?.sort !== undefined && object.nodeBody?.sort !== null) { - message.nodeBody = { $case: "sort", sort: SortNode.fromPartial(object.nodeBody.sort) }; - } - if ( - object.nodeBody?.$case === "watermarkFilter" && - object.nodeBody?.watermarkFilter !== undefined && - object.nodeBody?.watermarkFilter !== null - ) { - message.nodeBody = { - $case: "watermarkFilter", - watermarkFilter: WatermarkFilterNode.fromPartial(object.nodeBody.watermarkFilter), - }; - } - if (object.nodeBody?.$case === "dml" && object.nodeBody?.dml !== undefined && object.nodeBody?.dml !== null) { - message.nodeBody = { $case: "dml", dml: DmlNode.fromPartial(object.nodeBody.dml) }; - } - if ( - object.nodeBody?.$case === "rowIdGen" && - object.nodeBody?.rowIdGen !== undefined && - object.nodeBody?.rowIdGen !== null - ) { - message.nodeBody = { $case: "rowIdGen", rowIdGen: RowIdGenNode.fromPartial(object.nodeBody.rowIdGen) }; - } - if (object.nodeBody?.$case === "now" && object.nodeBody?.now !== undefined && object.nodeBody?.now !== null) { - message.nodeBody = { $case: "now", now: NowNode.fromPartial(object.nodeBody.now) }; - } - if ( - object.nodeBody?.$case === "appendOnlyGroupTopN" && - object.nodeBody?.appendOnlyGroupTopN !== undefined && - object.nodeBody?.appendOnlyGroupTopN !== null - ) { - message.nodeBody = { - $case: "appendOnlyGroupTopN", - appendOnlyGroupTopN: GroupTopNNode.fromPartial(object.nodeBody.appendOnlyGroupTopN), - }; - } - if ( - object.nodeBody?.$case === "temporalJoin" && - object.nodeBody?.temporalJoin !== undefined && - object.nodeBody?.temporalJoin !== null - ) { - message.nodeBody = { - $case: "temporalJoin", - temporalJoin: TemporalJoinNode.fromPartial(object.nodeBody.temporalJoin), - }; - } - if ( - object.nodeBody?.$case === "barrierRecv" && - object.nodeBody?.barrierRecv !== undefined && - object.nodeBody?.barrierRecv !== null - ) { - message.nodeBody = { - $case: "barrierRecv", - barrierRecv: BarrierRecvNode.fromPartial(object.nodeBody.barrierRecv), - }; - } - message.operatorId = object.operatorId ?? 0; - message.input = object.input?.map((e) => StreamNode.fromPartial(e)) || []; - message.streamKey = object.streamKey?.map((e) => e) || []; - message.appendOnly = object.appendOnly ?? false; - message.identity = object.identity ?? ""; - message.fields = object.fields?.map((e) => Field.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseDispatchStrategy(): DispatchStrategy { - return { type: DispatcherType.UNSPECIFIED, distKeyIndices: [], outputIndices: [] }; -} - -export const DispatchStrategy = { - fromJSON(object: any): DispatchStrategy { - return { - type: isSet(object.type) ? dispatcherTypeFromJSON(object.type) : DispatcherType.UNSPECIFIED, - distKeyIndices: Array.isArray(object?.distKeyIndices) ? object.distKeyIndices.map((e: any) => Number(e)) : [], - outputIndices: Array.isArray(object?.outputIndices) ? object.outputIndices.map((e: any) => Number(e)) : [], - }; - }, - - toJSON(message: DispatchStrategy): unknown { - const obj: any = {}; - message.type !== undefined && (obj.type = dispatcherTypeToJSON(message.type)); - if (message.distKeyIndices) { - obj.distKeyIndices = message.distKeyIndices.map((e) => Math.round(e)); - } else { - obj.distKeyIndices = []; - } - if (message.outputIndices) { - obj.outputIndices = message.outputIndices.map((e) => Math.round(e)); - } else { - obj.outputIndices = []; - } - return obj; - }, - - fromPartial, I>>(object: I): DispatchStrategy { - const message = createBaseDispatchStrategy(); - message.type = object.type ?? DispatcherType.UNSPECIFIED; - message.distKeyIndices = object.distKeyIndices?.map((e) => e) || []; - message.outputIndices = object.outputIndices?.map((e) => e) || []; - return message; - }, -}; - -function createBaseDispatcher(): Dispatcher { - return { - type: DispatcherType.UNSPECIFIED, - distKeyIndices: [], - outputIndices: [], - hashMapping: undefined, - dispatcherId: 0, - downstreamActorId: [], - }; -} - -export const Dispatcher = { - fromJSON(object: any): Dispatcher { - return { - type: isSet(object.type) ? dispatcherTypeFromJSON(object.type) : DispatcherType.UNSPECIFIED, - distKeyIndices: Array.isArray(object?.distKeyIndices) ? object.distKeyIndices.map((e: any) => Number(e)) : [], - outputIndices: Array.isArray(object?.outputIndices) ? object.outputIndices.map((e: any) => Number(e)) : [], - hashMapping: isSet(object.hashMapping) ? ActorMapping.fromJSON(object.hashMapping) : undefined, - dispatcherId: isSet(object.dispatcherId) ? Number(object.dispatcherId) : 0, - downstreamActorId: Array.isArray(object?.downstreamActorId) - ? object.downstreamActorId.map((e: any) => Number(e)) - : [], - }; - }, - - toJSON(message: Dispatcher): unknown { - const obj: any = {}; - message.type !== undefined && (obj.type = dispatcherTypeToJSON(message.type)); - if (message.distKeyIndices) { - obj.distKeyIndices = message.distKeyIndices.map((e) => Math.round(e)); - } else { - obj.distKeyIndices = []; - } - if (message.outputIndices) { - obj.outputIndices = message.outputIndices.map((e) => Math.round(e)); - } else { - obj.outputIndices = []; - } - message.hashMapping !== undefined && - (obj.hashMapping = message.hashMapping ? ActorMapping.toJSON(message.hashMapping) : undefined); - message.dispatcherId !== undefined && (obj.dispatcherId = Math.round(message.dispatcherId)); - if (message.downstreamActorId) { - obj.downstreamActorId = message.downstreamActorId.map((e) => Math.round(e)); - } else { - obj.downstreamActorId = []; - } - return obj; - }, - - fromPartial, I>>(object: I): Dispatcher { - const message = createBaseDispatcher(); - message.type = object.type ?? DispatcherType.UNSPECIFIED; - message.distKeyIndices = object.distKeyIndices?.map((e) => e) || []; - message.outputIndices = object.outputIndices?.map((e) => e) || []; - message.hashMapping = (object.hashMapping !== undefined && object.hashMapping !== null) - ? ActorMapping.fromPartial(object.hashMapping) - : undefined; - message.dispatcherId = object.dispatcherId ?? 0; - message.downstreamActorId = object.downstreamActorId?.map((e) => e) || []; - return message; - }, -}; - -function createBaseStreamActor(): StreamActor { - return { - actorId: 0, - fragmentId: 0, - nodes: undefined, - dispatcher: [], - upstreamActorId: [], - vnodeBitmap: undefined, - mviewDefinition: "", - }; -} - -export const StreamActor = { - fromJSON(object: any): StreamActor { - return { - actorId: isSet(object.actorId) ? Number(object.actorId) : 0, - fragmentId: isSet(object.fragmentId) ? Number(object.fragmentId) : 0, - nodes: isSet(object.nodes) ? StreamNode.fromJSON(object.nodes) : undefined, - dispatcher: Array.isArray(object?.dispatcher) ? object.dispatcher.map((e: any) => Dispatcher.fromJSON(e)) : [], - upstreamActorId: Array.isArray(object?.upstreamActorId) ? object.upstreamActorId.map((e: any) => Number(e)) : [], - vnodeBitmap: isSet(object.vnodeBitmap) ? Buffer.fromJSON(object.vnodeBitmap) : undefined, - mviewDefinition: isSet(object.mviewDefinition) ? String(object.mviewDefinition) : "", - }; - }, - - toJSON(message: StreamActor): unknown { - const obj: any = {}; - message.actorId !== undefined && (obj.actorId = Math.round(message.actorId)); - message.fragmentId !== undefined && (obj.fragmentId = Math.round(message.fragmentId)); - message.nodes !== undefined && (obj.nodes = message.nodes ? StreamNode.toJSON(message.nodes) : undefined); - if (message.dispatcher) { - obj.dispatcher = message.dispatcher.map((e) => e ? Dispatcher.toJSON(e) : undefined); - } else { - obj.dispatcher = []; - } - if (message.upstreamActorId) { - obj.upstreamActorId = message.upstreamActorId.map((e) => Math.round(e)); - } else { - obj.upstreamActorId = []; - } - message.vnodeBitmap !== undefined && - (obj.vnodeBitmap = message.vnodeBitmap ? Buffer.toJSON(message.vnodeBitmap) : undefined); - message.mviewDefinition !== undefined && (obj.mviewDefinition = message.mviewDefinition); - return obj; - }, - - fromPartial, I>>(object: I): StreamActor { - const message = createBaseStreamActor(); - message.actorId = object.actorId ?? 0; - message.fragmentId = object.fragmentId ?? 0; - message.nodes = (object.nodes !== undefined && object.nodes !== null) - ? StreamNode.fromPartial(object.nodes) - : undefined; - message.dispatcher = object.dispatcher?.map((e) => Dispatcher.fromPartial(e)) || []; - message.upstreamActorId = object.upstreamActorId?.map((e) => e) || []; - message.vnodeBitmap = (object.vnodeBitmap !== undefined && object.vnodeBitmap !== null) - ? Buffer.fromPartial(object.vnodeBitmap) - : undefined; - message.mviewDefinition = object.mviewDefinition ?? ""; - return message; - }, -}; - -function createBaseStreamEnvironment(): StreamEnvironment { - return { timezone: "" }; -} - -export const StreamEnvironment = { - fromJSON(object: any): StreamEnvironment { - return { timezone: isSet(object.timezone) ? String(object.timezone) : "" }; - }, - - toJSON(message: StreamEnvironment): unknown { - const obj: any = {}; - message.timezone !== undefined && (obj.timezone = message.timezone); - return obj; - }, - - fromPartial, I>>(object: I): StreamEnvironment { - const message = createBaseStreamEnvironment(); - message.timezone = object.timezone ?? ""; - return message; - }, -}; - -function createBaseStreamFragmentGraph(): StreamFragmentGraph { - return { fragments: {}, edges: [], dependentRelationIds: [], tableIdsCnt: 0, env: undefined, parallelism: undefined }; -} - -export const StreamFragmentGraph = { - fromJSON(object: any): StreamFragmentGraph { - return { - fragments: isObject(object.fragments) - ? Object.entries(object.fragments).reduce<{ [key: number]: StreamFragmentGraph_StreamFragment }>( - (acc, [key, value]) => { - acc[Number(key)] = StreamFragmentGraph_StreamFragment.fromJSON(value); - return acc; - }, - {}, - ) - : {}, - edges: Array.isArray(object?.edges) - ? object.edges.map((e: any) => StreamFragmentGraph_StreamFragmentEdge.fromJSON(e)) - : [], - dependentRelationIds: Array.isArray(object?.dependentRelationIds) - ? object.dependentRelationIds.map((e: any) => Number(e)) - : [], - tableIdsCnt: isSet(object.tableIdsCnt) ? Number(object.tableIdsCnt) : 0, - env: isSet(object.env) ? StreamEnvironment.fromJSON(object.env) : undefined, - parallelism: isSet(object.parallelism) ? StreamFragmentGraph_Parallelism.fromJSON(object.parallelism) : undefined, - }; - }, - - toJSON(message: StreamFragmentGraph): unknown { - const obj: any = {}; - obj.fragments = {}; - if (message.fragments) { - Object.entries(message.fragments).forEach(([k, v]) => { - obj.fragments[k] = StreamFragmentGraph_StreamFragment.toJSON(v); - }); - } - if (message.edges) { - obj.edges = message.edges.map((e) => e ? StreamFragmentGraph_StreamFragmentEdge.toJSON(e) : undefined); - } else { - obj.edges = []; - } - if (message.dependentRelationIds) { - obj.dependentRelationIds = message.dependentRelationIds.map((e) => Math.round(e)); - } else { - obj.dependentRelationIds = []; - } - message.tableIdsCnt !== undefined && (obj.tableIdsCnt = Math.round(message.tableIdsCnt)); - message.env !== undefined && (obj.env = message.env ? StreamEnvironment.toJSON(message.env) : undefined); - message.parallelism !== undefined && - (obj.parallelism = message.parallelism ? StreamFragmentGraph_Parallelism.toJSON(message.parallelism) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): StreamFragmentGraph { - const message = createBaseStreamFragmentGraph(); - message.fragments = Object.entries(object.fragments ?? {}).reduce< - { [key: number]: StreamFragmentGraph_StreamFragment } - >((acc, [key, value]) => { - if (value !== undefined) { - acc[Number(key)] = StreamFragmentGraph_StreamFragment.fromPartial(value); - } - return acc; - }, {}); - message.edges = object.edges?.map((e) => StreamFragmentGraph_StreamFragmentEdge.fromPartial(e)) || []; - message.dependentRelationIds = object.dependentRelationIds?.map((e) => e) || []; - message.tableIdsCnt = object.tableIdsCnt ?? 0; - message.env = (object.env !== undefined && object.env !== null) - ? StreamEnvironment.fromPartial(object.env) - : undefined; - message.parallelism = (object.parallelism !== undefined && object.parallelism !== null) - ? StreamFragmentGraph_Parallelism.fromPartial(object.parallelism) - : undefined; - return message; - }, -}; - -function createBaseStreamFragmentGraph_StreamFragment(): StreamFragmentGraph_StreamFragment { - return { - fragmentId: 0, - node: undefined, - fragmentTypeMask: 0, - requiresSingleton: false, - tableIdsCnt: 0, - upstreamTableIds: [], - }; -} - -export const StreamFragmentGraph_StreamFragment = { - fromJSON(object: any): StreamFragmentGraph_StreamFragment { - return { - fragmentId: isSet(object.fragmentId) ? Number(object.fragmentId) : 0, - node: isSet(object.node) ? StreamNode.fromJSON(object.node) : undefined, - fragmentTypeMask: isSet(object.fragmentTypeMask) ? Number(object.fragmentTypeMask) : 0, - requiresSingleton: isSet(object.requiresSingleton) ? Boolean(object.requiresSingleton) : false, - tableIdsCnt: isSet(object.tableIdsCnt) ? Number(object.tableIdsCnt) : 0, - upstreamTableIds: Array.isArray(object?.upstreamTableIds) - ? object.upstreamTableIds.map((e: any) => Number(e)) - : [], - }; - }, - - toJSON(message: StreamFragmentGraph_StreamFragment): unknown { - const obj: any = {}; - message.fragmentId !== undefined && (obj.fragmentId = Math.round(message.fragmentId)); - message.node !== undefined && (obj.node = message.node ? StreamNode.toJSON(message.node) : undefined); - message.fragmentTypeMask !== undefined && (obj.fragmentTypeMask = Math.round(message.fragmentTypeMask)); - message.requiresSingleton !== undefined && (obj.requiresSingleton = message.requiresSingleton); - message.tableIdsCnt !== undefined && (obj.tableIdsCnt = Math.round(message.tableIdsCnt)); - if (message.upstreamTableIds) { - obj.upstreamTableIds = message.upstreamTableIds.map((e) => Math.round(e)); - } else { - obj.upstreamTableIds = []; - } - return obj; - }, - - fromPartial, I>>( - object: I, - ): StreamFragmentGraph_StreamFragment { - const message = createBaseStreamFragmentGraph_StreamFragment(); - message.fragmentId = object.fragmentId ?? 0; - message.node = (object.node !== undefined && object.node !== null) - ? StreamNode.fromPartial(object.node) - : undefined; - message.fragmentTypeMask = object.fragmentTypeMask ?? 0; - message.requiresSingleton = object.requiresSingleton ?? false; - message.tableIdsCnt = object.tableIdsCnt ?? 0; - message.upstreamTableIds = object.upstreamTableIds?.map((e) => e) || []; - return message; - }, -}; - -function createBaseStreamFragmentGraph_StreamFragmentEdge(): StreamFragmentGraph_StreamFragmentEdge { - return { dispatchStrategy: undefined, linkId: 0, upstreamId: 0, downstreamId: 0 }; -} - -export const StreamFragmentGraph_StreamFragmentEdge = { - fromJSON(object: any): StreamFragmentGraph_StreamFragmentEdge { - return { - dispatchStrategy: isSet(object.dispatchStrategy) ? DispatchStrategy.fromJSON(object.dispatchStrategy) : undefined, - linkId: isSet(object.linkId) ? Number(object.linkId) : 0, - upstreamId: isSet(object.upstreamId) ? Number(object.upstreamId) : 0, - downstreamId: isSet(object.downstreamId) ? Number(object.downstreamId) : 0, - }; - }, - - toJSON(message: StreamFragmentGraph_StreamFragmentEdge): unknown { - const obj: any = {}; - message.dispatchStrategy !== undefined && - (obj.dispatchStrategy = message.dispatchStrategy ? DispatchStrategy.toJSON(message.dispatchStrategy) : undefined); - message.linkId !== undefined && (obj.linkId = Math.round(message.linkId)); - message.upstreamId !== undefined && (obj.upstreamId = Math.round(message.upstreamId)); - message.downstreamId !== undefined && (obj.downstreamId = Math.round(message.downstreamId)); - return obj; - }, - - fromPartial, I>>( - object: I, - ): StreamFragmentGraph_StreamFragmentEdge { - const message = createBaseStreamFragmentGraph_StreamFragmentEdge(); - message.dispatchStrategy = (object.dispatchStrategy !== undefined && object.dispatchStrategy !== null) - ? DispatchStrategy.fromPartial(object.dispatchStrategy) - : undefined; - message.linkId = object.linkId ?? 0; - message.upstreamId = object.upstreamId ?? 0; - message.downstreamId = object.downstreamId ?? 0; - return message; - }, -}; - -function createBaseStreamFragmentGraph_Parallelism(): StreamFragmentGraph_Parallelism { - return { parallelism: 0 }; -} - -export const StreamFragmentGraph_Parallelism = { - fromJSON(object: any): StreamFragmentGraph_Parallelism { - return { parallelism: isSet(object.parallelism) ? Number(object.parallelism) : 0 }; - }, - - toJSON(message: StreamFragmentGraph_Parallelism): unknown { - const obj: any = {}; - message.parallelism !== undefined && (obj.parallelism = Math.round(message.parallelism)); - return obj; - }, - - fromPartial, I>>( - object: I, - ): StreamFragmentGraph_Parallelism { - const message = createBaseStreamFragmentGraph_Parallelism(); - message.parallelism = object.parallelism ?? 0; - return message; - }, -}; - -function createBaseStreamFragmentGraph_FragmentsEntry(): StreamFragmentGraph_FragmentsEntry { - return { key: 0, value: undefined }; -} - -export const StreamFragmentGraph_FragmentsEntry = { - fromJSON(object: any): StreamFragmentGraph_FragmentsEntry { - return { - key: isSet(object.key) ? Number(object.key) : 0, - value: isSet(object.value) ? StreamFragmentGraph_StreamFragment.fromJSON(object.value) : undefined, - }; - }, - - toJSON(message: StreamFragmentGraph_FragmentsEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = Math.round(message.key)); - message.value !== undefined && - (obj.value = message.value ? StreamFragmentGraph_StreamFragment.toJSON(message.value) : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): StreamFragmentGraph_FragmentsEntry { - const message = createBaseStreamFragmentGraph_FragmentsEntry(); - message.key = object.key ?? 0; - message.value = (object.value !== undefined && object.value !== null) - ? StreamFragmentGraph_StreamFragment.fromPartial(object.value) - : undefined; - return message; - }, -}; - -declare var self: any | undefined; -declare var window: any | undefined; -declare var global: any | undefined; -var globalThis: any = (() => { - if (typeof globalThis !== "undefined") { - return globalThis; - } - if (typeof self !== "undefined") { - return self; - } - if (typeof window !== "undefined") { - return window; - } - if (typeof global !== "undefined") { - return global; - } - throw "Unable to locate global object"; -})(); - -function bytesFromBase64(b64: string): Uint8Array { - if (globalThis.Buffer) { - return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); - } else { - const bin = globalThis.atob(b64); - const arr = new Uint8Array(bin.length); - for (let i = 0; i < bin.length; ++i) { - arr[i] = bin.charCodeAt(i); - } - return arr; - } -} - -function base64FromBytes(arr: Uint8Array): string { - if (globalThis.Buffer) { - return globalThis.Buffer.from(arr).toString("base64"); - } else { - const bin: string[] = []; - arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); - }); - return globalThis.btoa(bin.join("")); - } -} - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> - : T extends { $case: string } ? { [K in keyof Omit]?: DeepPartial } & { $case: T["$case"] } - : T extends {} ? { [K in keyof T]?: DeepPartial } - : Partial; - -type KeysOfUnion = T extends T ? keyof T : never; -export type Exact = P extends Builtin ? P - : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; - -function isObject(value: any): boolean { - return typeof value === "object" && value !== null; -} - -function isSet(value: any): boolean { - return value !== null && value !== undefined; -} diff --git a/dashboard/proto/gen/stream_service.ts b/dashboard/proto/gen/stream_service.ts deleted file mode 100644 index 2740cb287c6b..000000000000 --- a/dashboard/proto/gen/stream_service.ts +++ /dev/null @@ -1,725 +0,0 @@ -/* eslint-disable */ -import { ActorInfo, Status } from "./common"; -import { SstableInfo, TableStats } from "./hummock"; -import { Barrier, StreamActor } from "./stream_plan"; - -export const protobufPackage = "stream_service"; - -/** Describe the fragments which will be running on this node */ -export interface UpdateActorsRequest { - requestId: string; - actors: StreamActor[]; -} - -export interface UpdateActorsResponse { - status: Status | undefined; -} - -export interface BroadcastActorInfoTableRequest { - info: ActorInfo[]; -} - -/** Create channels and gRPC connections for a fragment */ -export interface BuildActorsRequest { - requestId: string; - actorId: number[]; -} - -export interface BuildActorsResponse { - requestId: string; - status: Status | undefined; -} - -export interface DropActorsRequest { - requestId: string; - actorIds: number[]; -} - -export interface DropActorsResponse { - requestId: string; - status: Status | undefined; -} - -export interface ForceStopActorsRequest { - requestId: string; -} - -export interface ForceStopActorsResponse { - requestId: string; - status: Status | undefined; -} - -export interface InjectBarrierRequest { - requestId: string; - barrier: Barrier | undefined; - actorIdsToSend: number[]; - actorIdsToCollect: number[]; -} - -export interface InjectBarrierResponse { - requestId: string; - status: Status | undefined; -} - -export interface BarrierCompleteRequest { - requestId: string; - prevEpoch: number; -} - -export interface BarrierCompleteResponse { - requestId: string; - status: Status | undefined; - createMviewProgress: BarrierCompleteResponse_CreateMviewProgress[]; - syncedSstables: BarrierCompleteResponse_GroupedSstableInfo[]; - workerId: number; -} - -export interface BarrierCompleteResponse_CreateMviewProgress { - chainActorId: number; - done: boolean; - consumedEpoch: number; - consumedRows: number; -} - -export interface BarrierCompleteResponse_GroupedSstableInfo { - compactionGroupId: number; - sst: SstableInfo | undefined; - tableStatsMap: { [key: number]: TableStats }; -} - -export interface BarrierCompleteResponse_GroupedSstableInfo_TableStatsMapEntry { - key: number; - value: TableStats | undefined; -} - -/** Before starting streaming, the leader node broadcast the actor-host table to needed workers. */ -export interface BroadcastActorInfoTableResponse { - status: Status | undefined; -} - -export interface WaitEpochCommitRequest { - epoch: number; -} - -export interface WaitEpochCommitResponse { - status: Status | undefined; -} - -function createBaseUpdateActorsRequest(): UpdateActorsRequest { - return { requestId: "", actors: [] }; -} - -export const UpdateActorsRequest = { - fromJSON(object: any): UpdateActorsRequest { - return { - requestId: isSet(object.requestId) ? String(object.requestId) : "", - actors: Array.isArray(object?.actors) ? object.actors.map((e: any) => StreamActor.fromJSON(e)) : [], - }; - }, - - toJSON(message: UpdateActorsRequest): unknown { - const obj: any = {}; - message.requestId !== undefined && (obj.requestId = message.requestId); - if (message.actors) { - obj.actors = message.actors.map((e) => e ? StreamActor.toJSON(e) : undefined); - } else { - obj.actors = []; - } - return obj; - }, - - fromPartial, I>>(object: I): UpdateActorsRequest { - const message = createBaseUpdateActorsRequest(); - message.requestId = object.requestId ?? ""; - message.actors = object.actors?.map((e) => StreamActor.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseUpdateActorsResponse(): UpdateActorsResponse { - return { status: undefined }; -} - -export const UpdateActorsResponse = { - fromJSON(object: any): UpdateActorsResponse { - return { status: isSet(object.status) ? Status.fromJSON(object.status) : undefined }; - }, - - toJSON(message: UpdateActorsResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): UpdateActorsResponse { - const message = createBaseUpdateActorsResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - return message; - }, -}; - -function createBaseBroadcastActorInfoTableRequest(): BroadcastActorInfoTableRequest { - return { info: [] }; -} - -export const BroadcastActorInfoTableRequest = { - fromJSON(object: any): BroadcastActorInfoTableRequest { - return { info: Array.isArray(object?.info) ? object.info.map((e: any) => ActorInfo.fromJSON(e)) : [] }; - }, - - toJSON(message: BroadcastActorInfoTableRequest): unknown { - const obj: any = {}; - if (message.info) { - obj.info = message.info.map((e) => e ? ActorInfo.toJSON(e) : undefined); - } else { - obj.info = []; - } - return obj; - }, - - fromPartial, I>>( - object: I, - ): BroadcastActorInfoTableRequest { - const message = createBaseBroadcastActorInfoTableRequest(); - message.info = object.info?.map((e) => ActorInfo.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseBuildActorsRequest(): BuildActorsRequest { - return { requestId: "", actorId: [] }; -} - -export const BuildActorsRequest = { - fromJSON(object: any): BuildActorsRequest { - return { - requestId: isSet(object.requestId) ? String(object.requestId) : "", - actorId: Array.isArray(object?.actorId) ? object.actorId.map((e: any) => Number(e)) : [], - }; - }, - - toJSON(message: BuildActorsRequest): unknown { - const obj: any = {}; - message.requestId !== undefined && (obj.requestId = message.requestId); - if (message.actorId) { - obj.actorId = message.actorId.map((e) => Math.round(e)); - } else { - obj.actorId = []; - } - return obj; - }, - - fromPartial, I>>(object: I): BuildActorsRequest { - const message = createBaseBuildActorsRequest(); - message.requestId = object.requestId ?? ""; - message.actorId = object.actorId?.map((e) => e) || []; - return message; - }, -}; - -function createBaseBuildActorsResponse(): BuildActorsResponse { - return { requestId: "", status: undefined }; -} - -export const BuildActorsResponse = { - fromJSON(object: any): BuildActorsResponse { - return { - requestId: isSet(object.requestId) ? String(object.requestId) : "", - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - }; - }, - - toJSON(message: BuildActorsResponse): unknown { - const obj: any = {}; - message.requestId !== undefined && (obj.requestId = message.requestId); - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): BuildActorsResponse { - const message = createBaseBuildActorsResponse(); - message.requestId = object.requestId ?? ""; - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - return message; - }, -}; - -function createBaseDropActorsRequest(): DropActorsRequest { - return { requestId: "", actorIds: [] }; -} - -export const DropActorsRequest = { - fromJSON(object: any): DropActorsRequest { - return { - requestId: isSet(object.requestId) ? String(object.requestId) : "", - actorIds: Array.isArray(object?.actorIds) ? object.actorIds.map((e: any) => Number(e)) : [], - }; - }, - - toJSON(message: DropActorsRequest): unknown { - const obj: any = {}; - message.requestId !== undefined && (obj.requestId = message.requestId); - if (message.actorIds) { - obj.actorIds = message.actorIds.map((e) => Math.round(e)); - } else { - obj.actorIds = []; - } - return obj; - }, - - fromPartial, I>>(object: I): DropActorsRequest { - const message = createBaseDropActorsRequest(); - message.requestId = object.requestId ?? ""; - message.actorIds = object.actorIds?.map((e) => e) || []; - return message; - }, -}; - -function createBaseDropActorsResponse(): DropActorsResponse { - return { requestId: "", status: undefined }; -} - -export const DropActorsResponse = { - fromJSON(object: any): DropActorsResponse { - return { - requestId: isSet(object.requestId) ? String(object.requestId) : "", - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - }; - }, - - toJSON(message: DropActorsResponse): unknown { - const obj: any = {}; - message.requestId !== undefined && (obj.requestId = message.requestId); - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): DropActorsResponse { - const message = createBaseDropActorsResponse(); - message.requestId = object.requestId ?? ""; - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - return message; - }, -}; - -function createBaseForceStopActorsRequest(): ForceStopActorsRequest { - return { requestId: "" }; -} - -export const ForceStopActorsRequest = { - fromJSON(object: any): ForceStopActorsRequest { - return { requestId: isSet(object.requestId) ? String(object.requestId) : "" }; - }, - - toJSON(message: ForceStopActorsRequest): unknown { - const obj: any = {}; - message.requestId !== undefined && (obj.requestId = message.requestId); - return obj; - }, - - fromPartial, I>>(object: I): ForceStopActorsRequest { - const message = createBaseForceStopActorsRequest(); - message.requestId = object.requestId ?? ""; - return message; - }, -}; - -function createBaseForceStopActorsResponse(): ForceStopActorsResponse { - return { requestId: "", status: undefined }; -} - -export const ForceStopActorsResponse = { - fromJSON(object: any): ForceStopActorsResponse { - return { - requestId: isSet(object.requestId) ? String(object.requestId) : "", - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - }; - }, - - toJSON(message: ForceStopActorsResponse): unknown { - const obj: any = {}; - message.requestId !== undefined && (obj.requestId = message.requestId); - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): ForceStopActorsResponse { - const message = createBaseForceStopActorsResponse(); - message.requestId = object.requestId ?? ""; - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - return message; - }, -}; - -function createBaseInjectBarrierRequest(): InjectBarrierRequest { - return { requestId: "", barrier: undefined, actorIdsToSend: [], actorIdsToCollect: [] }; -} - -export const InjectBarrierRequest = { - fromJSON(object: any): InjectBarrierRequest { - return { - requestId: isSet(object.requestId) ? String(object.requestId) : "", - barrier: isSet(object.barrier) ? Barrier.fromJSON(object.barrier) : undefined, - actorIdsToSend: Array.isArray(object?.actorIdsToSend) ? object.actorIdsToSend.map((e: any) => Number(e)) : [], - actorIdsToCollect: Array.isArray(object?.actorIdsToCollect) - ? object.actorIdsToCollect.map((e: any) => Number(e)) - : [], - }; - }, - - toJSON(message: InjectBarrierRequest): unknown { - const obj: any = {}; - message.requestId !== undefined && (obj.requestId = message.requestId); - message.barrier !== undefined && (obj.barrier = message.barrier ? Barrier.toJSON(message.barrier) : undefined); - if (message.actorIdsToSend) { - obj.actorIdsToSend = message.actorIdsToSend.map((e) => Math.round(e)); - } else { - obj.actorIdsToSend = []; - } - if (message.actorIdsToCollect) { - obj.actorIdsToCollect = message.actorIdsToCollect.map((e) => Math.round(e)); - } else { - obj.actorIdsToCollect = []; - } - return obj; - }, - - fromPartial, I>>(object: I): InjectBarrierRequest { - const message = createBaseInjectBarrierRequest(); - message.requestId = object.requestId ?? ""; - message.barrier = (object.barrier !== undefined && object.barrier !== null) - ? Barrier.fromPartial(object.barrier) - : undefined; - message.actorIdsToSend = object.actorIdsToSend?.map((e) => e) || []; - message.actorIdsToCollect = object.actorIdsToCollect?.map((e) => e) || []; - return message; - }, -}; - -function createBaseInjectBarrierResponse(): InjectBarrierResponse { - return { requestId: "", status: undefined }; -} - -export const InjectBarrierResponse = { - fromJSON(object: any): InjectBarrierResponse { - return { - requestId: isSet(object.requestId) ? String(object.requestId) : "", - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - }; - }, - - toJSON(message: InjectBarrierResponse): unknown { - const obj: any = {}; - message.requestId !== undefined && (obj.requestId = message.requestId); - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): InjectBarrierResponse { - const message = createBaseInjectBarrierResponse(); - message.requestId = object.requestId ?? ""; - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - return message; - }, -}; - -function createBaseBarrierCompleteRequest(): BarrierCompleteRequest { - return { requestId: "", prevEpoch: 0 }; -} - -export const BarrierCompleteRequest = { - fromJSON(object: any): BarrierCompleteRequest { - return { - requestId: isSet(object.requestId) ? String(object.requestId) : "", - prevEpoch: isSet(object.prevEpoch) ? Number(object.prevEpoch) : 0, - }; - }, - - toJSON(message: BarrierCompleteRequest): unknown { - const obj: any = {}; - message.requestId !== undefined && (obj.requestId = message.requestId); - message.prevEpoch !== undefined && (obj.prevEpoch = Math.round(message.prevEpoch)); - return obj; - }, - - fromPartial, I>>(object: I): BarrierCompleteRequest { - const message = createBaseBarrierCompleteRequest(); - message.requestId = object.requestId ?? ""; - message.prevEpoch = object.prevEpoch ?? 0; - return message; - }, -}; - -function createBaseBarrierCompleteResponse(): BarrierCompleteResponse { - return { requestId: "", status: undefined, createMviewProgress: [], syncedSstables: [], workerId: 0 }; -} - -export const BarrierCompleteResponse = { - fromJSON(object: any): BarrierCompleteResponse { - return { - requestId: isSet(object.requestId) ? String(object.requestId) : "", - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - createMviewProgress: Array.isArray(object?.createMviewProgress) - ? object.createMviewProgress.map((e: any) => BarrierCompleteResponse_CreateMviewProgress.fromJSON(e)) - : [], - syncedSstables: Array.isArray(object?.syncedSstables) - ? object.syncedSstables.map((e: any) => BarrierCompleteResponse_GroupedSstableInfo.fromJSON(e)) - : [], - workerId: isSet(object.workerId) ? Number(object.workerId) : 0, - }; - }, - - toJSON(message: BarrierCompleteResponse): unknown { - const obj: any = {}; - message.requestId !== undefined && (obj.requestId = message.requestId); - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - if (message.createMviewProgress) { - obj.createMviewProgress = message.createMviewProgress.map((e) => - e ? BarrierCompleteResponse_CreateMviewProgress.toJSON(e) : undefined - ); - } else { - obj.createMviewProgress = []; - } - if (message.syncedSstables) { - obj.syncedSstables = message.syncedSstables.map((e) => - e ? BarrierCompleteResponse_GroupedSstableInfo.toJSON(e) : undefined - ); - } else { - obj.syncedSstables = []; - } - message.workerId !== undefined && (obj.workerId = Math.round(message.workerId)); - return obj; - }, - - fromPartial, I>>(object: I): BarrierCompleteResponse { - const message = createBaseBarrierCompleteResponse(); - message.requestId = object.requestId ?? ""; - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.createMviewProgress = - object.createMviewProgress?.map((e) => BarrierCompleteResponse_CreateMviewProgress.fromPartial(e)) || []; - message.syncedSstables = - object.syncedSstables?.map((e) => BarrierCompleteResponse_GroupedSstableInfo.fromPartial(e)) || []; - message.workerId = object.workerId ?? 0; - return message; - }, -}; - -function createBaseBarrierCompleteResponse_CreateMviewProgress(): BarrierCompleteResponse_CreateMviewProgress { - return { chainActorId: 0, done: false, consumedEpoch: 0, consumedRows: 0 }; -} - -export const BarrierCompleteResponse_CreateMviewProgress = { - fromJSON(object: any): BarrierCompleteResponse_CreateMviewProgress { - return { - chainActorId: isSet(object.chainActorId) ? Number(object.chainActorId) : 0, - done: isSet(object.done) ? Boolean(object.done) : false, - consumedEpoch: isSet(object.consumedEpoch) ? Number(object.consumedEpoch) : 0, - consumedRows: isSet(object.consumedRows) ? Number(object.consumedRows) : 0, - }; - }, - - toJSON(message: BarrierCompleteResponse_CreateMviewProgress): unknown { - const obj: any = {}; - message.chainActorId !== undefined && (obj.chainActorId = Math.round(message.chainActorId)); - message.done !== undefined && (obj.done = message.done); - message.consumedEpoch !== undefined && (obj.consumedEpoch = Math.round(message.consumedEpoch)); - message.consumedRows !== undefined && (obj.consumedRows = Math.round(message.consumedRows)); - return obj; - }, - - fromPartial, I>>( - object: I, - ): BarrierCompleteResponse_CreateMviewProgress { - const message = createBaseBarrierCompleteResponse_CreateMviewProgress(); - message.chainActorId = object.chainActorId ?? 0; - message.done = object.done ?? false; - message.consumedEpoch = object.consumedEpoch ?? 0; - message.consumedRows = object.consumedRows ?? 0; - return message; - }, -}; - -function createBaseBarrierCompleteResponse_GroupedSstableInfo(): BarrierCompleteResponse_GroupedSstableInfo { - return { compactionGroupId: 0, sst: undefined, tableStatsMap: {} }; -} - -export const BarrierCompleteResponse_GroupedSstableInfo = { - fromJSON(object: any): BarrierCompleteResponse_GroupedSstableInfo { - return { - compactionGroupId: isSet(object.compactionGroupId) ? Number(object.compactionGroupId) : 0, - sst: isSet(object.sst) ? SstableInfo.fromJSON(object.sst) : undefined, - tableStatsMap: isObject(object.tableStatsMap) - ? Object.entries(object.tableStatsMap).reduce<{ [key: number]: TableStats }>((acc, [key, value]) => { - acc[Number(key)] = TableStats.fromJSON(value); - return acc; - }, {}) - : {}, - }; - }, - - toJSON(message: BarrierCompleteResponse_GroupedSstableInfo): unknown { - const obj: any = {}; - message.compactionGroupId !== undefined && (obj.compactionGroupId = Math.round(message.compactionGroupId)); - message.sst !== undefined && (obj.sst = message.sst ? SstableInfo.toJSON(message.sst) : undefined); - obj.tableStatsMap = {}; - if (message.tableStatsMap) { - Object.entries(message.tableStatsMap).forEach(([k, v]) => { - obj.tableStatsMap[k] = TableStats.toJSON(v); - }); - } - return obj; - }, - - fromPartial, I>>( - object: I, - ): BarrierCompleteResponse_GroupedSstableInfo { - const message = createBaseBarrierCompleteResponse_GroupedSstableInfo(); - message.compactionGroupId = object.compactionGroupId ?? 0; - message.sst = (object.sst !== undefined && object.sst !== null) ? SstableInfo.fromPartial(object.sst) : undefined; - message.tableStatsMap = Object.entries(object.tableStatsMap ?? {}).reduce<{ [key: number]: TableStats }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[Number(key)] = TableStats.fromPartial(value); - } - return acc; - }, - {}, - ); - return message; - }, -}; - -function createBaseBarrierCompleteResponse_GroupedSstableInfo_TableStatsMapEntry(): BarrierCompleteResponse_GroupedSstableInfo_TableStatsMapEntry { - return { key: 0, value: undefined }; -} - -export const BarrierCompleteResponse_GroupedSstableInfo_TableStatsMapEntry = { - fromJSON(object: any): BarrierCompleteResponse_GroupedSstableInfo_TableStatsMapEntry { - return { - key: isSet(object.key) ? Number(object.key) : 0, - value: isSet(object.value) ? TableStats.fromJSON(object.value) : undefined, - }; - }, - - toJSON(message: BarrierCompleteResponse_GroupedSstableInfo_TableStatsMapEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = Math.round(message.key)); - message.value !== undefined && (obj.value = message.value ? TableStats.toJSON(message.value) : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): BarrierCompleteResponse_GroupedSstableInfo_TableStatsMapEntry { - const message = createBaseBarrierCompleteResponse_GroupedSstableInfo_TableStatsMapEntry(); - message.key = object.key ?? 0; - message.value = (object.value !== undefined && object.value !== null) - ? TableStats.fromPartial(object.value) - : undefined; - return message; - }, -}; - -function createBaseBroadcastActorInfoTableResponse(): BroadcastActorInfoTableResponse { - return { status: undefined }; -} - -export const BroadcastActorInfoTableResponse = { - fromJSON(object: any): BroadcastActorInfoTableResponse { - return { status: isSet(object.status) ? Status.fromJSON(object.status) : undefined }; - }, - - toJSON(message: BroadcastActorInfoTableResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): BroadcastActorInfoTableResponse { - const message = createBaseBroadcastActorInfoTableResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - return message; - }, -}; - -function createBaseWaitEpochCommitRequest(): WaitEpochCommitRequest { - return { epoch: 0 }; -} - -export const WaitEpochCommitRequest = { - fromJSON(object: any): WaitEpochCommitRequest { - return { epoch: isSet(object.epoch) ? Number(object.epoch) : 0 }; - }, - - toJSON(message: WaitEpochCommitRequest): unknown { - const obj: any = {}; - message.epoch !== undefined && (obj.epoch = Math.round(message.epoch)); - return obj; - }, - - fromPartial, I>>(object: I): WaitEpochCommitRequest { - const message = createBaseWaitEpochCommitRequest(); - message.epoch = object.epoch ?? 0; - return message; - }, -}; - -function createBaseWaitEpochCommitResponse(): WaitEpochCommitResponse { - return { status: undefined }; -} - -export const WaitEpochCommitResponse = { - fromJSON(object: any): WaitEpochCommitResponse { - return { status: isSet(object.status) ? Status.fromJSON(object.status) : undefined }; - }, - - toJSON(message: WaitEpochCommitResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): WaitEpochCommitResponse { - const message = createBaseWaitEpochCommitResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - return message; - }, -}; - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> - : T extends { $case: string } ? { [K in keyof Omit]?: DeepPartial } & { $case: T["$case"] } - : T extends {} ? { [K in keyof T]?: DeepPartial } - : Partial; - -type KeysOfUnion = T extends T ? keyof T : never; -export type Exact = P extends Builtin ? P - : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; - -function isObject(value: any): boolean { - return typeof value === "object" && value !== null; -} - -function isSet(value: any): boolean { - return value !== null && value !== undefined; -} diff --git a/dashboard/proto/gen/task_service.ts b/dashboard/proto/gen/task_service.ts deleted file mode 100644 index 2cfcb1d49bf0..000000000000 --- a/dashboard/proto/gen/task_service.ts +++ /dev/null @@ -1,544 +0,0 @@ -/* eslint-disable */ -import { PlanFragment, TaskId as TaskId1, TaskOutputId } from "./batch_plan"; -import { BatchQueryEpoch, Status } from "./common"; -import { DataChunk } from "./data"; -import { StreamMessage } from "./stream_plan"; - -export const protobufPackage = "task_service"; - -/** Task is a running instance of Stage. */ -export interface TaskId { - queryId: string; - stageId: number; - taskId: number; -} - -export interface TaskInfoResponse { - taskId: TaskId1 | undefined; - taskStatus: TaskInfoResponse_TaskStatus; - /** Optional error message for failed task. */ - errorMessage: string; -} - -export const TaskInfoResponse_TaskStatus = { - /** UNSPECIFIED - Note: Requirement of proto3: first enum must be 0. */ - UNSPECIFIED: "UNSPECIFIED", - PENDING: "PENDING", - RUNNING: "RUNNING", - FINISHED: "FINISHED", - FAILED: "FAILED", - ABORTED: "ABORTED", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type TaskInfoResponse_TaskStatus = typeof TaskInfoResponse_TaskStatus[keyof typeof TaskInfoResponse_TaskStatus]; - -export function taskInfoResponse_TaskStatusFromJSON(object: any): TaskInfoResponse_TaskStatus { - switch (object) { - case 0: - case "UNSPECIFIED": - return TaskInfoResponse_TaskStatus.UNSPECIFIED; - case 2: - case "PENDING": - return TaskInfoResponse_TaskStatus.PENDING; - case 3: - case "RUNNING": - return TaskInfoResponse_TaskStatus.RUNNING; - case 6: - case "FINISHED": - return TaskInfoResponse_TaskStatus.FINISHED; - case 7: - case "FAILED": - return TaskInfoResponse_TaskStatus.FAILED; - case 8: - case "ABORTED": - return TaskInfoResponse_TaskStatus.ABORTED; - case -1: - case "UNRECOGNIZED": - default: - return TaskInfoResponse_TaskStatus.UNRECOGNIZED; - } -} - -export function taskInfoResponse_TaskStatusToJSON(object: TaskInfoResponse_TaskStatus): string { - switch (object) { - case TaskInfoResponse_TaskStatus.UNSPECIFIED: - return "UNSPECIFIED"; - case TaskInfoResponse_TaskStatus.PENDING: - return "PENDING"; - case TaskInfoResponse_TaskStatus.RUNNING: - return "RUNNING"; - case TaskInfoResponse_TaskStatus.FINISHED: - return "FINISHED"; - case TaskInfoResponse_TaskStatus.FAILED: - return "FAILED"; - case TaskInfoResponse_TaskStatus.ABORTED: - return "ABORTED"; - case TaskInfoResponse_TaskStatus.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export interface CreateTaskRequest { - taskId: TaskId1 | undefined; - plan: PlanFragment | undefined; - epoch: BatchQueryEpoch | undefined; -} - -export interface AbortTaskRequest { - taskId: TaskId1 | undefined; -} - -export interface AbortTaskResponse { - status: Status | undefined; -} - -export interface GetTaskInfoRequest { - taskId: TaskId1 | undefined; -} - -export interface GetDataResponse { - recordBatch: DataChunk | undefined; -} - -export interface ExecuteRequest { - taskId: TaskId1 | undefined; - plan: PlanFragment | undefined; - epoch: BatchQueryEpoch | undefined; -} - -export interface GetDataRequest { - taskOutputId: TaskOutputId | undefined; -} - -export interface GetStreamRequest { - value?: { $case: "get"; get: GetStreamRequest_Get } | { - $case: "addPermits"; - addPermits: GetStreamRequest_AddPermits; - }; -} - -/** The first message, which tells the upstream which channel this exchange stream is for. */ -export interface GetStreamRequest_Get { - upActorId: number; - downActorId: number; - upFragmentId: number; - downFragmentId: number; -} - -/** The following messages, which adds the permits back to the upstream to achieve back-pressure. */ -export interface GetStreamRequest_AddPermits { - permits: number; -} - -export interface GetStreamResponse { - message: - | StreamMessage - | undefined; - /** The number of permits acquired for this message, which should be sent back to the upstream with `AddPermits`. */ - permits: number; -} - -function createBaseTaskId(): TaskId { - return { queryId: "", stageId: 0, taskId: 0 }; -} - -export const TaskId = { - fromJSON(object: any): TaskId { - return { - queryId: isSet(object.queryId) ? String(object.queryId) : "", - stageId: isSet(object.stageId) ? Number(object.stageId) : 0, - taskId: isSet(object.taskId) ? Number(object.taskId) : 0, - }; - }, - - toJSON(message: TaskId): unknown { - const obj: any = {}; - message.queryId !== undefined && (obj.queryId = message.queryId); - message.stageId !== undefined && (obj.stageId = Math.round(message.stageId)); - message.taskId !== undefined && (obj.taskId = Math.round(message.taskId)); - return obj; - }, - - fromPartial, I>>(object: I): TaskId { - const message = createBaseTaskId(); - message.queryId = object.queryId ?? ""; - message.stageId = object.stageId ?? 0; - message.taskId = object.taskId ?? 0; - return message; - }, -}; - -function createBaseTaskInfoResponse(): TaskInfoResponse { - return { taskId: undefined, taskStatus: TaskInfoResponse_TaskStatus.UNSPECIFIED, errorMessage: "" }; -} - -export const TaskInfoResponse = { - fromJSON(object: any): TaskInfoResponse { - return { - taskId: isSet(object.taskId) ? TaskId1.fromJSON(object.taskId) : undefined, - taskStatus: isSet(object.taskStatus) - ? taskInfoResponse_TaskStatusFromJSON(object.taskStatus) - : TaskInfoResponse_TaskStatus.UNSPECIFIED, - errorMessage: isSet(object.errorMessage) ? String(object.errorMessage) : "", - }; - }, - - toJSON(message: TaskInfoResponse): unknown { - const obj: any = {}; - message.taskId !== undefined && (obj.taskId = message.taskId ? TaskId1.toJSON(message.taskId) : undefined); - message.taskStatus !== undefined && (obj.taskStatus = taskInfoResponse_TaskStatusToJSON(message.taskStatus)); - message.errorMessage !== undefined && (obj.errorMessage = message.errorMessage); - return obj; - }, - - fromPartial, I>>(object: I): TaskInfoResponse { - const message = createBaseTaskInfoResponse(); - message.taskId = (object.taskId !== undefined && object.taskId !== null) - ? TaskId1.fromPartial(object.taskId) - : undefined; - message.taskStatus = object.taskStatus ?? TaskInfoResponse_TaskStatus.UNSPECIFIED; - message.errorMessage = object.errorMessage ?? ""; - return message; - }, -}; - -function createBaseCreateTaskRequest(): CreateTaskRequest { - return { taskId: undefined, plan: undefined, epoch: undefined }; -} - -export const CreateTaskRequest = { - fromJSON(object: any): CreateTaskRequest { - return { - taskId: isSet(object.taskId) ? TaskId1.fromJSON(object.taskId) : undefined, - plan: isSet(object.plan) ? PlanFragment.fromJSON(object.plan) : undefined, - epoch: isSet(object.epoch) ? BatchQueryEpoch.fromJSON(object.epoch) : undefined, - }; - }, - - toJSON(message: CreateTaskRequest): unknown { - const obj: any = {}; - message.taskId !== undefined && (obj.taskId = message.taskId ? TaskId1.toJSON(message.taskId) : undefined); - message.plan !== undefined && (obj.plan = message.plan ? PlanFragment.toJSON(message.plan) : undefined); - message.epoch !== undefined && (obj.epoch = message.epoch ? BatchQueryEpoch.toJSON(message.epoch) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): CreateTaskRequest { - const message = createBaseCreateTaskRequest(); - message.taskId = (object.taskId !== undefined && object.taskId !== null) - ? TaskId1.fromPartial(object.taskId) - : undefined; - message.plan = (object.plan !== undefined && object.plan !== null) - ? PlanFragment.fromPartial(object.plan) - : undefined; - message.epoch = (object.epoch !== undefined && object.epoch !== null) - ? BatchQueryEpoch.fromPartial(object.epoch) - : undefined; - return message; - }, -}; - -function createBaseAbortTaskRequest(): AbortTaskRequest { - return { taskId: undefined }; -} - -export const AbortTaskRequest = { - fromJSON(object: any): AbortTaskRequest { - return { taskId: isSet(object.taskId) ? TaskId1.fromJSON(object.taskId) : undefined }; - }, - - toJSON(message: AbortTaskRequest): unknown { - const obj: any = {}; - message.taskId !== undefined && (obj.taskId = message.taskId ? TaskId1.toJSON(message.taskId) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): AbortTaskRequest { - const message = createBaseAbortTaskRequest(); - message.taskId = (object.taskId !== undefined && object.taskId !== null) - ? TaskId1.fromPartial(object.taskId) - : undefined; - return message; - }, -}; - -function createBaseAbortTaskResponse(): AbortTaskResponse { - return { status: undefined }; -} - -export const AbortTaskResponse = { - fromJSON(object: any): AbortTaskResponse { - return { status: isSet(object.status) ? Status.fromJSON(object.status) : undefined }; - }, - - toJSON(message: AbortTaskResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): AbortTaskResponse { - const message = createBaseAbortTaskResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - return message; - }, -}; - -function createBaseGetTaskInfoRequest(): GetTaskInfoRequest { - return { taskId: undefined }; -} - -export const GetTaskInfoRequest = { - fromJSON(object: any): GetTaskInfoRequest { - return { taskId: isSet(object.taskId) ? TaskId1.fromJSON(object.taskId) : undefined }; - }, - - toJSON(message: GetTaskInfoRequest): unknown { - const obj: any = {}; - message.taskId !== undefined && (obj.taskId = message.taskId ? TaskId1.toJSON(message.taskId) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): GetTaskInfoRequest { - const message = createBaseGetTaskInfoRequest(); - message.taskId = (object.taskId !== undefined && object.taskId !== null) - ? TaskId1.fromPartial(object.taskId) - : undefined; - return message; - }, -}; - -function createBaseGetDataResponse(): GetDataResponse { - return { recordBatch: undefined }; -} - -export const GetDataResponse = { - fromJSON(object: any): GetDataResponse { - return { recordBatch: isSet(object.recordBatch) ? DataChunk.fromJSON(object.recordBatch) : undefined }; - }, - - toJSON(message: GetDataResponse): unknown { - const obj: any = {}; - message.recordBatch !== undefined && - (obj.recordBatch = message.recordBatch ? DataChunk.toJSON(message.recordBatch) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): GetDataResponse { - const message = createBaseGetDataResponse(); - message.recordBatch = (object.recordBatch !== undefined && object.recordBatch !== null) - ? DataChunk.fromPartial(object.recordBatch) - : undefined; - return message; - }, -}; - -function createBaseExecuteRequest(): ExecuteRequest { - return { taskId: undefined, plan: undefined, epoch: undefined }; -} - -export const ExecuteRequest = { - fromJSON(object: any): ExecuteRequest { - return { - taskId: isSet(object.taskId) ? TaskId1.fromJSON(object.taskId) : undefined, - plan: isSet(object.plan) ? PlanFragment.fromJSON(object.plan) : undefined, - epoch: isSet(object.epoch) ? BatchQueryEpoch.fromJSON(object.epoch) : undefined, - }; - }, - - toJSON(message: ExecuteRequest): unknown { - const obj: any = {}; - message.taskId !== undefined && (obj.taskId = message.taskId ? TaskId1.toJSON(message.taskId) : undefined); - message.plan !== undefined && (obj.plan = message.plan ? PlanFragment.toJSON(message.plan) : undefined); - message.epoch !== undefined && (obj.epoch = message.epoch ? BatchQueryEpoch.toJSON(message.epoch) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): ExecuteRequest { - const message = createBaseExecuteRequest(); - message.taskId = (object.taskId !== undefined && object.taskId !== null) - ? TaskId1.fromPartial(object.taskId) - : undefined; - message.plan = (object.plan !== undefined && object.plan !== null) - ? PlanFragment.fromPartial(object.plan) - : undefined; - message.epoch = (object.epoch !== undefined && object.epoch !== null) - ? BatchQueryEpoch.fromPartial(object.epoch) - : undefined; - return message; - }, -}; - -function createBaseGetDataRequest(): GetDataRequest { - return { taskOutputId: undefined }; -} - -export const GetDataRequest = { - fromJSON(object: any): GetDataRequest { - return { taskOutputId: isSet(object.taskOutputId) ? TaskOutputId.fromJSON(object.taskOutputId) : undefined }; - }, - - toJSON(message: GetDataRequest): unknown { - const obj: any = {}; - message.taskOutputId !== undefined && - (obj.taskOutputId = message.taskOutputId ? TaskOutputId.toJSON(message.taskOutputId) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): GetDataRequest { - const message = createBaseGetDataRequest(); - message.taskOutputId = (object.taskOutputId !== undefined && object.taskOutputId !== null) - ? TaskOutputId.fromPartial(object.taskOutputId) - : undefined; - return message; - }, -}; - -function createBaseGetStreamRequest(): GetStreamRequest { - return { value: undefined }; -} - -export const GetStreamRequest = { - fromJSON(object: any): GetStreamRequest { - return { - value: isSet(object.get) - ? { $case: "get", get: GetStreamRequest_Get.fromJSON(object.get) } - : isSet(object.addPermits) - ? { $case: "addPermits", addPermits: GetStreamRequest_AddPermits.fromJSON(object.addPermits) } - : undefined, - }; - }, - - toJSON(message: GetStreamRequest): unknown { - const obj: any = {}; - message.value?.$case === "get" && - (obj.get = message.value?.get ? GetStreamRequest_Get.toJSON(message.value?.get) : undefined); - message.value?.$case === "addPermits" && (obj.addPermits = message.value?.addPermits - ? GetStreamRequest_AddPermits.toJSON(message.value?.addPermits) - : undefined); - return obj; - }, - - fromPartial, I>>(object: I): GetStreamRequest { - const message = createBaseGetStreamRequest(); - if (object.value?.$case === "get" && object.value?.get !== undefined && object.value?.get !== null) { - message.value = { $case: "get", get: GetStreamRequest_Get.fromPartial(object.value.get) }; - } - if ( - object.value?.$case === "addPermits" && - object.value?.addPermits !== undefined && - object.value?.addPermits !== null - ) { - message.value = { - $case: "addPermits", - addPermits: GetStreamRequest_AddPermits.fromPartial(object.value.addPermits), - }; - } - return message; - }, -}; - -function createBaseGetStreamRequest_Get(): GetStreamRequest_Get { - return { upActorId: 0, downActorId: 0, upFragmentId: 0, downFragmentId: 0 }; -} - -export const GetStreamRequest_Get = { - fromJSON(object: any): GetStreamRequest_Get { - return { - upActorId: isSet(object.upActorId) ? Number(object.upActorId) : 0, - downActorId: isSet(object.downActorId) ? Number(object.downActorId) : 0, - upFragmentId: isSet(object.upFragmentId) ? Number(object.upFragmentId) : 0, - downFragmentId: isSet(object.downFragmentId) ? Number(object.downFragmentId) : 0, - }; - }, - - toJSON(message: GetStreamRequest_Get): unknown { - const obj: any = {}; - message.upActorId !== undefined && (obj.upActorId = Math.round(message.upActorId)); - message.downActorId !== undefined && (obj.downActorId = Math.round(message.downActorId)); - message.upFragmentId !== undefined && (obj.upFragmentId = Math.round(message.upFragmentId)); - message.downFragmentId !== undefined && (obj.downFragmentId = Math.round(message.downFragmentId)); - return obj; - }, - - fromPartial, I>>(object: I): GetStreamRequest_Get { - const message = createBaseGetStreamRequest_Get(); - message.upActorId = object.upActorId ?? 0; - message.downActorId = object.downActorId ?? 0; - message.upFragmentId = object.upFragmentId ?? 0; - message.downFragmentId = object.downFragmentId ?? 0; - return message; - }, -}; - -function createBaseGetStreamRequest_AddPermits(): GetStreamRequest_AddPermits { - return { permits: 0 }; -} - -export const GetStreamRequest_AddPermits = { - fromJSON(object: any): GetStreamRequest_AddPermits { - return { permits: isSet(object.permits) ? Number(object.permits) : 0 }; - }, - - toJSON(message: GetStreamRequest_AddPermits): unknown { - const obj: any = {}; - message.permits !== undefined && (obj.permits = Math.round(message.permits)); - return obj; - }, - - fromPartial, I>>(object: I): GetStreamRequest_AddPermits { - const message = createBaseGetStreamRequest_AddPermits(); - message.permits = object.permits ?? 0; - return message; - }, -}; - -function createBaseGetStreamResponse(): GetStreamResponse { - return { message: undefined, permits: 0 }; -} - -export const GetStreamResponse = { - fromJSON(object: any): GetStreamResponse { - return { - message: isSet(object.message) ? StreamMessage.fromJSON(object.message) : undefined, - permits: isSet(object.permits) ? Number(object.permits) : 0, - }; - }, - - toJSON(message: GetStreamResponse): unknown { - const obj: any = {}; - message.message !== undefined && - (obj.message = message.message ? StreamMessage.toJSON(message.message) : undefined); - message.permits !== undefined && (obj.permits = Math.round(message.permits)); - return obj; - }, - - fromPartial, I>>(object: I): GetStreamResponse { - const message = createBaseGetStreamResponse(); - message.message = (object.message !== undefined && object.message !== null) - ? StreamMessage.fromPartial(object.message) - : undefined; - message.permits = object.permits ?? 0; - return message; - }, -}; - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> - : T extends { $case: string } ? { [K in keyof Omit]?: DeepPartial } & { $case: T["$case"] } - : T extends {} ? { [K in keyof T]?: DeepPartial } - : Partial; - -type KeysOfUnion = T extends T ? keyof T : never; -export type Exact = P extends Builtin ? P - : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; - -function isSet(value: any): boolean { - return value !== null && value !== undefined; -} diff --git a/dashboard/proto/gen/user.ts b/dashboard/proto/gen/user.ts deleted file mode 100644 index cdf9070d8425..000000000000 --- a/dashboard/proto/gen/user.ts +++ /dev/null @@ -1,889 +0,0 @@ -/* eslint-disable */ -import { Status } from "./common"; - -export const protobufPackage = "user"; - -/** AuthInfo is the information required to login to a server. */ -export interface AuthInfo { - encryptionType: AuthInfo_EncryptionType; - encryptedValue: Uint8Array; -} - -export const AuthInfo_EncryptionType = { - UNSPECIFIED: "UNSPECIFIED", - PLAINTEXT: "PLAINTEXT", - SHA256: "SHA256", - MD5: "MD5", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type AuthInfo_EncryptionType = typeof AuthInfo_EncryptionType[keyof typeof AuthInfo_EncryptionType]; - -export function authInfo_EncryptionTypeFromJSON(object: any): AuthInfo_EncryptionType { - switch (object) { - case 0: - case "UNSPECIFIED": - return AuthInfo_EncryptionType.UNSPECIFIED; - case 1: - case "PLAINTEXT": - return AuthInfo_EncryptionType.PLAINTEXT; - case 2: - case "SHA256": - return AuthInfo_EncryptionType.SHA256; - case 3: - case "MD5": - return AuthInfo_EncryptionType.MD5; - case -1: - case "UNRECOGNIZED": - default: - return AuthInfo_EncryptionType.UNRECOGNIZED; - } -} - -export function authInfo_EncryptionTypeToJSON(object: AuthInfo_EncryptionType): string { - switch (object) { - case AuthInfo_EncryptionType.UNSPECIFIED: - return "UNSPECIFIED"; - case AuthInfo_EncryptionType.PLAINTEXT: - return "PLAINTEXT"; - case AuthInfo_EncryptionType.SHA256: - return "SHA256"; - case AuthInfo_EncryptionType.MD5: - return "MD5"; - case AuthInfo_EncryptionType.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -/** User defines a user in the system. */ -export interface UserInfo { - id: number; - name: string; - isSuper: boolean; - canCreateDb: boolean; - canCreateUser: boolean; - canLogin: boolean; - authInfo: - | AuthInfo - | undefined; - /** / Granted privileges will be only updated through the command of GRANT/REVOKE. */ - grantPrivileges: GrantPrivilege[]; -} - -/** GrantPrivilege defines a privilege granted to a user. */ -export interface GrantPrivilege { - object?: - | { $case: "databaseId"; databaseId: number } - | { $case: "schemaId"; schemaId: number } - | { $case: "tableId"; tableId: number } - | { $case: "sourceId"; sourceId: number } - | { $case: "sinkId"; sinkId: number } - | { $case: "viewId"; viewId: number } - | { $case: "functionId"; functionId: number } - | { $case: "allTablesSchemaId"; allTablesSchemaId: number } - | { $case: "allSourcesSchemaId"; allSourcesSchemaId: number }; - actionWithOpts: GrantPrivilege_ActionWithGrantOption[]; -} - -export const GrantPrivilege_Action = { - UNSPECIFIED: "UNSPECIFIED", - SELECT: "SELECT", - INSERT: "INSERT", - UPDATE: "UPDATE", - DELETE: "DELETE", - CREATE: "CREATE", - CONNECT: "CONNECT", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type GrantPrivilege_Action = typeof GrantPrivilege_Action[keyof typeof GrantPrivilege_Action]; - -export function grantPrivilege_ActionFromJSON(object: any): GrantPrivilege_Action { - switch (object) { - case 0: - case "UNSPECIFIED": - return GrantPrivilege_Action.UNSPECIFIED; - case 1: - case "SELECT": - return GrantPrivilege_Action.SELECT; - case 2: - case "INSERT": - return GrantPrivilege_Action.INSERT; - case 3: - case "UPDATE": - return GrantPrivilege_Action.UPDATE; - case 4: - case "DELETE": - return GrantPrivilege_Action.DELETE; - case 5: - case "CREATE": - return GrantPrivilege_Action.CREATE; - case 6: - case "CONNECT": - return GrantPrivilege_Action.CONNECT; - case -1: - case "UNRECOGNIZED": - default: - return GrantPrivilege_Action.UNRECOGNIZED; - } -} - -export function grantPrivilege_ActionToJSON(object: GrantPrivilege_Action): string { - switch (object) { - case GrantPrivilege_Action.UNSPECIFIED: - return "UNSPECIFIED"; - case GrantPrivilege_Action.SELECT: - return "SELECT"; - case GrantPrivilege_Action.INSERT: - return "INSERT"; - case GrantPrivilege_Action.UPDATE: - return "UPDATE"; - case GrantPrivilege_Action.DELETE: - return "DELETE"; - case GrantPrivilege_Action.CREATE: - return "CREATE"; - case GrantPrivilege_Action.CONNECT: - return "CONNECT"; - case GrantPrivilege_Action.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export interface GrantPrivilege_ActionWithGrantOption { - action: GrantPrivilege_Action; - withGrantOption: boolean; - grantedBy: number; -} - -export interface CreateUserRequest { - user: UserInfo | undefined; -} - -export interface CreateUserResponse { - status: Status | undefined; - version: number; -} - -export interface DropUserRequest { - userId: number; -} - -export interface DropUserResponse { - status: Status | undefined; - version: number; -} - -export interface UpdateUserRequest { - user: UserInfo | undefined; - updateFields: UpdateUserRequest_UpdateField[]; -} - -export const UpdateUserRequest_UpdateField = { - UNSPECIFIED: "UNSPECIFIED", - SUPER: "SUPER", - LOGIN: "LOGIN", - CREATE_DB: "CREATE_DB", - AUTH_INFO: "AUTH_INFO", - RENAME: "RENAME", - CREATE_USER: "CREATE_USER", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type UpdateUserRequest_UpdateField = - typeof UpdateUserRequest_UpdateField[keyof typeof UpdateUserRequest_UpdateField]; - -export function updateUserRequest_UpdateFieldFromJSON(object: any): UpdateUserRequest_UpdateField { - switch (object) { - case 0: - case "UNSPECIFIED": - return UpdateUserRequest_UpdateField.UNSPECIFIED; - case 1: - case "SUPER": - return UpdateUserRequest_UpdateField.SUPER; - case 2: - case "LOGIN": - return UpdateUserRequest_UpdateField.LOGIN; - case 3: - case "CREATE_DB": - return UpdateUserRequest_UpdateField.CREATE_DB; - case 4: - case "AUTH_INFO": - return UpdateUserRequest_UpdateField.AUTH_INFO; - case 5: - case "RENAME": - return UpdateUserRequest_UpdateField.RENAME; - case 6: - case "CREATE_USER": - return UpdateUserRequest_UpdateField.CREATE_USER; - case -1: - case "UNRECOGNIZED": - default: - return UpdateUserRequest_UpdateField.UNRECOGNIZED; - } -} - -export function updateUserRequest_UpdateFieldToJSON(object: UpdateUserRequest_UpdateField): string { - switch (object) { - case UpdateUserRequest_UpdateField.UNSPECIFIED: - return "UNSPECIFIED"; - case UpdateUserRequest_UpdateField.SUPER: - return "SUPER"; - case UpdateUserRequest_UpdateField.LOGIN: - return "LOGIN"; - case UpdateUserRequest_UpdateField.CREATE_DB: - return "CREATE_DB"; - case UpdateUserRequest_UpdateField.AUTH_INFO: - return "AUTH_INFO"; - case UpdateUserRequest_UpdateField.RENAME: - return "RENAME"; - case UpdateUserRequest_UpdateField.CREATE_USER: - return "CREATE_USER"; - case UpdateUserRequest_UpdateField.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export interface UpdateUserResponse { - status: Status | undefined; - version: number; -} - -export interface GrantPrivilegeRequest { - userIds: number[]; - privileges: GrantPrivilege[]; - withGrantOption: boolean; - grantedBy: number; -} - -export interface GrantPrivilegeResponse { - status: Status | undefined; - version: number; -} - -export interface RevokePrivilegeRequest { - userIds: number[]; - privileges: GrantPrivilege[]; - grantedBy: number; - revokeBy: number; - revokeGrantOption: boolean; - cascade: boolean; -} - -export interface RevokePrivilegeResponse { - status: Status | undefined; - version: number; -} - -function createBaseAuthInfo(): AuthInfo { - return { encryptionType: AuthInfo_EncryptionType.UNSPECIFIED, encryptedValue: new Uint8Array() }; -} - -export const AuthInfo = { - fromJSON(object: any): AuthInfo { - return { - encryptionType: isSet(object.encryptionType) - ? authInfo_EncryptionTypeFromJSON(object.encryptionType) - : AuthInfo_EncryptionType.UNSPECIFIED, - encryptedValue: isSet(object.encryptedValue) ? bytesFromBase64(object.encryptedValue) : new Uint8Array(), - }; - }, - - toJSON(message: AuthInfo): unknown { - const obj: any = {}; - message.encryptionType !== undefined && - (obj.encryptionType = authInfo_EncryptionTypeToJSON(message.encryptionType)); - message.encryptedValue !== undefined && - (obj.encryptedValue = base64FromBytes( - message.encryptedValue !== undefined ? message.encryptedValue : new Uint8Array(), - )); - return obj; - }, - - fromPartial, I>>(object: I): AuthInfo { - const message = createBaseAuthInfo(); - message.encryptionType = object.encryptionType ?? AuthInfo_EncryptionType.UNSPECIFIED; - message.encryptedValue = object.encryptedValue ?? new Uint8Array(); - return message; - }, -}; - -function createBaseUserInfo(): UserInfo { - return { - id: 0, - name: "", - isSuper: false, - canCreateDb: false, - canCreateUser: false, - canLogin: false, - authInfo: undefined, - grantPrivileges: [], - }; -} - -export const UserInfo = { - fromJSON(object: any): UserInfo { - return { - id: isSet(object.id) ? Number(object.id) : 0, - name: isSet(object.name) ? String(object.name) : "", - isSuper: isSet(object.isSuper) ? Boolean(object.isSuper) : false, - canCreateDb: isSet(object.canCreateDb) ? Boolean(object.canCreateDb) : false, - canCreateUser: isSet(object.canCreateUser) ? Boolean(object.canCreateUser) : false, - canLogin: isSet(object.canLogin) ? Boolean(object.canLogin) : false, - authInfo: isSet(object.authInfo) ? AuthInfo.fromJSON(object.authInfo) : undefined, - grantPrivileges: Array.isArray(object?.grantPrivileges) - ? object.grantPrivileges.map((e: any) => GrantPrivilege.fromJSON(e)) - : [], - }; - }, - - toJSON(message: UserInfo): unknown { - const obj: any = {}; - message.id !== undefined && (obj.id = Math.round(message.id)); - message.name !== undefined && (obj.name = message.name); - message.isSuper !== undefined && (obj.isSuper = message.isSuper); - message.canCreateDb !== undefined && (obj.canCreateDb = message.canCreateDb); - message.canCreateUser !== undefined && (obj.canCreateUser = message.canCreateUser); - message.canLogin !== undefined && (obj.canLogin = message.canLogin); - message.authInfo !== undefined && (obj.authInfo = message.authInfo ? AuthInfo.toJSON(message.authInfo) : undefined); - if (message.grantPrivileges) { - obj.grantPrivileges = message.grantPrivileges.map((e) => e ? GrantPrivilege.toJSON(e) : undefined); - } else { - obj.grantPrivileges = []; - } - return obj; - }, - - fromPartial, I>>(object: I): UserInfo { - const message = createBaseUserInfo(); - message.id = object.id ?? 0; - message.name = object.name ?? ""; - message.isSuper = object.isSuper ?? false; - message.canCreateDb = object.canCreateDb ?? false; - message.canCreateUser = object.canCreateUser ?? false; - message.canLogin = object.canLogin ?? false; - message.authInfo = (object.authInfo !== undefined && object.authInfo !== null) - ? AuthInfo.fromPartial(object.authInfo) - : undefined; - message.grantPrivileges = object.grantPrivileges?.map((e) => GrantPrivilege.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseGrantPrivilege(): GrantPrivilege { - return { object: undefined, actionWithOpts: [] }; -} - -export const GrantPrivilege = { - fromJSON(object: any): GrantPrivilege { - return { - object: isSet(object.databaseId) - ? { $case: "databaseId", databaseId: Number(object.databaseId) } - : isSet(object.schemaId) - ? { $case: "schemaId", schemaId: Number(object.schemaId) } - : isSet(object.tableId) - ? { $case: "tableId", tableId: Number(object.tableId) } - : isSet(object.sourceId) - ? { $case: "sourceId", sourceId: Number(object.sourceId) } - : isSet(object.sinkId) - ? { $case: "sinkId", sinkId: Number(object.sinkId) } - : isSet(object.viewId) - ? { $case: "viewId", viewId: Number(object.viewId) } - : isSet(object.functionId) - ? { $case: "functionId", functionId: Number(object.functionId) } - : isSet(object.allTablesSchemaId) - ? { $case: "allTablesSchemaId", allTablesSchemaId: Number(object.allTablesSchemaId) } - : isSet(object.allSourcesSchemaId) - ? { $case: "allSourcesSchemaId", allSourcesSchemaId: Number(object.allSourcesSchemaId) } - : undefined, - actionWithOpts: Array.isArray(object?.actionWithOpts) - ? object.actionWithOpts.map((e: any) => GrantPrivilege_ActionWithGrantOption.fromJSON(e)) - : [], - }; - }, - - toJSON(message: GrantPrivilege): unknown { - const obj: any = {}; - message.object?.$case === "databaseId" && (obj.databaseId = Math.round(message.object?.databaseId)); - message.object?.$case === "schemaId" && (obj.schemaId = Math.round(message.object?.schemaId)); - message.object?.$case === "tableId" && (obj.tableId = Math.round(message.object?.tableId)); - message.object?.$case === "sourceId" && (obj.sourceId = Math.round(message.object?.sourceId)); - message.object?.$case === "sinkId" && (obj.sinkId = Math.round(message.object?.sinkId)); - message.object?.$case === "viewId" && (obj.viewId = Math.round(message.object?.viewId)); - message.object?.$case === "functionId" && (obj.functionId = Math.round(message.object?.functionId)); - message.object?.$case === "allTablesSchemaId" && - (obj.allTablesSchemaId = Math.round(message.object?.allTablesSchemaId)); - message.object?.$case === "allSourcesSchemaId" && - (obj.allSourcesSchemaId = Math.round(message.object?.allSourcesSchemaId)); - if (message.actionWithOpts) { - obj.actionWithOpts = message.actionWithOpts.map((e) => - e ? GrantPrivilege_ActionWithGrantOption.toJSON(e) : undefined - ); - } else { - obj.actionWithOpts = []; - } - return obj; - }, - - fromPartial, I>>(object: I): GrantPrivilege { - const message = createBaseGrantPrivilege(); - if ( - object.object?.$case === "databaseId" && - object.object?.databaseId !== undefined && - object.object?.databaseId !== null - ) { - message.object = { $case: "databaseId", databaseId: object.object.databaseId }; - } - if ( - object.object?.$case === "schemaId" && object.object?.schemaId !== undefined && object.object?.schemaId !== null - ) { - message.object = { $case: "schemaId", schemaId: object.object.schemaId }; - } - if (object.object?.$case === "tableId" && object.object?.tableId !== undefined && object.object?.tableId !== null) { - message.object = { $case: "tableId", tableId: object.object.tableId }; - } - if ( - object.object?.$case === "sourceId" && object.object?.sourceId !== undefined && object.object?.sourceId !== null - ) { - message.object = { $case: "sourceId", sourceId: object.object.sourceId }; - } - if (object.object?.$case === "sinkId" && object.object?.sinkId !== undefined && object.object?.sinkId !== null) { - message.object = { $case: "sinkId", sinkId: object.object.sinkId }; - } - if (object.object?.$case === "viewId" && object.object?.viewId !== undefined && object.object?.viewId !== null) { - message.object = { $case: "viewId", viewId: object.object.viewId }; - } - if ( - object.object?.$case === "functionId" && - object.object?.functionId !== undefined && - object.object?.functionId !== null - ) { - message.object = { $case: "functionId", functionId: object.object.functionId }; - } - if ( - object.object?.$case === "allTablesSchemaId" && - object.object?.allTablesSchemaId !== undefined && - object.object?.allTablesSchemaId !== null - ) { - message.object = { $case: "allTablesSchemaId", allTablesSchemaId: object.object.allTablesSchemaId }; - } - if ( - object.object?.$case === "allSourcesSchemaId" && - object.object?.allSourcesSchemaId !== undefined && - object.object?.allSourcesSchemaId !== null - ) { - message.object = { $case: "allSourcesSchemaId", allSourcesSchemaId: object.object.allSourcesSchemaId }; - } - message.actionWithOpts = object.actionWithOpts?.map((e) => GrantPrivilege_ActionWithGrantOption.fromPartial(e)) || - []; - return message; - }, -}; - -function createBaseGrantPrivilege_ActionWithGrantOption(): GrantPrivilege_ActionWithGrantOption { - return { action: GrantPrivilege_Action.UNSPECIFIED, withGrantOption: false, grantedBy: 0 }; -} - -export const GrantPrivilege_ActionWithGrantOption = { - fromJSON(object: any): GrantPrivilege_ActionWithGrantOption { - return { - action: isSet(object.action) ? grantPrivilege_ActionFromJSON(object.action) : GrantPrivilege_Action.UNSPECIFIED, - withGrantOption: isSet(object.withGrantOption) ? Boolean(object.withGrantOption) : false, - grantedBy: isSet(object.grantedBy) ? Number(object.grantedBy) : 0, - }; - }, - - toJSON(message: GrantPrivilege_ActionWithGrantOption): unknown { - const obj: any = {}; - message.action !== undefined && (obj.action = grantPrivilege_ActionToJSON(message.action)); - message.withGrantOption !== undefined && (obj.withGrantOption = message.withGrantOption); - message.grantedBy !== undefined && (obj.grantedBy = Math.round(message.grantedBy)); - return obj; - }, - - fromPartial, I>>( - object: I, - ): GrantPrivilege_ActionWithGrantOption { - const message = createBaseGrantPrivilege_ActionWithGrantOption(); - message.action = object.action ?? GrantPrivilege_Action.UNSPECIFIED; - message.withGrantOption = object.withGrantOption ?? false; - message.grantedBy = object.grantedBy ?? 0; - return message; - }, -}; - -function createBaseCreateUserRequest(): CreateUserRequest { - return { user: undefined }; -} - -export const CreateUserRequest = { - fromJSON(object: any): CreateUserRequest { - return { user: isSet(object.user) ? UserInfo.fromJSON(object.user) : undefined }; - }, - - toJSON(message: CreateUserRequest): unknown { - const obj: any = {}; - message.user !== undefined && (obj.user = message.user ? UserInfo.toJSON(message.user) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): CreateUserRequest { - const message = createBaseCreateUserRequest(); - message.user = (object.user !== undefined && object.user !== null) ? UserInfo.fromPartial(object.user) : undefined; - return message; - }, -}; - -function createBaseCreateUserResponse(): CreateUserResponse { - return { status: undefined, version: 0 }; -} - -export const CreateUserResponse = { - fromJSON(object: any): CreateUserResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - version: isSet(object.version) ? Number(object.version) : 0, - }; - }, - - toJSON(message: CreateUserResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - message.version !== undefined && (obj.version = Math.round(message.version)); - return obj; - }, - - fromPartial, I>>(object: I): CreateUserResponse { - const message = createBaseCreateUserResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.version = object.version ?? 0; - return message; - }, -}; - -function createBaseDropUserRequest(): DropUserRequest { - return { userId: 0 }; -} - -export const DropUserRequest = { - fromJSON(object: any): DropUserRequest { - return { userId: isSet(object.userId) ? Number(object.userId) : 0 }; - }, - - toJSON(message: DropUserRequest): unknown { - const obj: any = {}; - message.userId !== undefined && (obj.userId = Math.round(message.userId)); - return obj; - }, - - fromPartial, I>>(object: I): DropUserRequest { - const message = createBaseDropUserRequest(); - message.userId = object.userId ?? 0; - return message; - }, -}; - -function createBaseDropUserResponse(): DropUserResponse { - return { status: undefined, version: 0 }; -} - -export const DropUserResponse = { - fromJSON(object: any): DropUserResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - version: isSet(object.version) ? Number(object.version) : 0, - }; - }, - - toJSON(message: DropUserResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - message.version !== undefined && (obj.version = Math.round(message.version)); - return obj; - }, - - fromPartial, I>>(object: I): DropUserResponse { - const message = createBaseDropUserResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.version = object.version ?? 0; - return message; - }, -}; - -function createBaseUpdateUserRequest(): UpdateUserRequest { - return { user: undefined, updateFields: [] }; -} - -export const UpdateUserRequest = { - fromJSON(object: any): UpdateUserRequest { - return { - user: isSet(object.user) ? UserInfo.fromJSON(object.user) : undefined, - updateFields: Array.isArray(object?.updateFields) - ? object.updateFields.map((e: any) => updateUserRequest_UpdateFieldFromJSON(e)) - : [], - }; - }, - - toJSON(message: UpdateUserRequest): unknown { - const obj: any = {}; - message.user !== undefined && (obj.user = message.user ? UserInfo.toJSON(message.user) : undefined); - if (message.updateFields) { - obj.updateFields = message.updateFields.map((e) => updateUserRequest_UpdateFieldToJSON(e)); - } else { - obj.updateFields = []; - } - return obj; - }, - - fromPartial, I>>(object: I): UpdateUserRequest { - const message = createBaseUpdateUserRequest(); - message.user = (object.user !== undefined && object.user !== null) ? UserInfo.fromPartial(object.user) : undefined; - message.updateFields = object.updateFields?.map((e) => e) || []; - return message; - }, -}; - -function createBaseUpdateUserResponse(): UpdateUserResponse { - return { status: undefined, version: 0 }; -} - -export const UpdateUserResponse = { - fromJSON(object: any): UpdateUserResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - version: isSet(object.version) ? Number(object.version) : 0, - }; - }, - - toJSON(message: UpdateUserResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - message.version !== undefined && (obj.version = Math.round(message.version)); - return obj; - }, - - fromPartial, I>>(object: I): UpdateUserResponse { - const message = createBaseUpdateUserResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.version = object.version ?? 0; - return message; - }, -}; - -function createBaseGrantPrivilegeRequest(): GrantPrivilegeRequest { - return { userIds: [], privileges: [], withGrantOption: false, grantedBy: 0 }; -} - -export const GrantPrivilegeRequest = { - fromJSON(object: any): GrantPrivilegeRequest { - return { - userIds: Array.isArray(object?.userIds) ? object.userIds.map((e: any) => Number(e)) : [], - privileges: Array.isArray(object?.privileges) - ? object.privileges.map((e: any) => GrantPrivilege.fromJSON(e)) - : [], - withGrantOption: isSet(object.withGrantOption) ? Boolean(object.withGrantOption) : false, - grantedBy: isSet(object.grantedBy) ? Number(object.grantedBy) : 0, - }; - }, - - toJSON(message: GrantPrivilegeRequest): unknown { - const obj: any = {}; - if (message.userIds) { - obj.userIds = message.userIds.map((e) => Math.round(e)); - } else { - obj.userIds = []; - } - if (message.privileges) { - obj.privileges = message.privileges.map((e) => e ? GrantPrivilege.toJSON(e) : undefined); - } else { - obj.privileges = []; - } - message.withGrantOption !== undefined && (obj.withGrantOption = message.withGrantOption); - message.grantedBy !== undefined && (obj.grantedBy = Math.round(message.grantedBy)); - return obj; - }, - - fromPartial, I>>(object: I): GrantPrivilegeRequest { - const message = createBaseGrantPrivilegeRequest(); - message.userIds = object.userIds?.map((e) => e) || []; - message.privileges = object.privileges?.map((e) => GrantPrivilege.fromPartial(e)) || []; - message.withGrantOption = object.withGrantOption ?? false; - message.grantedBy = object.grantedBy ?? 0; - return message; - }, -}; - -function createBaseGrantPrivilegeResponse(): GrantPrivilegeResponse { - return { status: undefined, version: 0 }; -} - -export const GrantPrivilegeResponse = { - fromJSON(object: any): GrantPrivilegeResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - version: isSet(object.version) ? Number(object.version) : 0, - }; - }, - - toJSON(message: GrantPrivilegeResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - message.version !== undefined && (obj.version = Math.round(message.version)); - return obj; - }, - - fromPartial, I>>(object: I): GrantPrivilegeResponse { - const message = createBaseGrantPrivilegeResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.version = object.version ?? 0; - return message; - }, -}; - -function createBaseRevokePrivilegeRequest(): RevokePrivilegeRequest { - return { userIds: [], privileges: [], grantedBy: 0, revokeBy: 0, revokeGrantOption: false, cascade: false }; -} - -export const RevokePrivilegeRequest = { - fromJSON(object: any): RevokePrivilegeRequest { - return { - userIds: Array.isArray(object?.userIds) ? object.userIds.map((e: any) => Number(e)) : [], - privileges: Array.isArray(object?.privileges) - ? object.privileges.map((e: any) => GrantPrivilege.fromJSON(e)) - : [], - grantedBy: isSet(object.grantedBy) ? Number(object.grantedBy) : 0, - revokeBy: isSet(object.revokeBy) ? Number(object.revokeBy) : 0, - revokeGrantOption: isSet(object.revokeGrantOption) ? Boolean(object.revokeGrantOption) : false, - cascade: isSet(object.cascade) ? Boolean(object.cascade) : false, - }; - }, - - toJSON(message: RevokePrivilegeRequest): unknown { - const obj: any = {}; - if (message.userIds) { - obj.userIds = message.userIds.map((e) => Math.round(e)); - } else { - obj.userIds = []; - } - if (message.privileges) { - obj.privileges = message.privileges.map((e) => e ? GrantPrivilege.toJSON(e) : undefined); - } else { - obj.privileges = []; - } - message.grantedBy !== undefined && (obj.grantedBy = Math.round(message.grantedBy)); - message.revokeBy !== undefined && (obj.revokeBy = Math.round(message.revokeBy)); - message.revokeGrantOption !== undefined && (obj.revokeGrantOption = message.revokeGrantOption); - message.cascade !== undefined && (obj.cascade = message.cascade); - return obj; - }, - - fromPartial, I>>(object: I): RevokePrivilegeRequest { - const message = createBaseRevokePrivilegeRequest(); - message.userIds = object.userIds?.map((e) => e) || []; - message.privileges = object.privileges?.map((e) => GrantPrivilege.fromPartial(e)) || []; - message.grantedBy = object.grantedBy ?? 0; - message.revokeBy = object.revokeBy ?? 0; - message.revokeGrantOption = object.revokeGrantOption ?? false; - message.cascade = object.cascade ?? false; - return message; - }, -}; - -function createBaseRevokePrivilegeResponse(): RevokePrivilegeResponse { - return { status: undefined, version: 0 }; -} - -export const RevokePrivilegeResponse = { - fromJSON(object: any): RevokePrivilegeResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - version: isSet(object.version) ? Number(object.version) : 0, - }; - }, - - toJSON(message: RevokePrivilegeResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - message.version !== undefined && (obj.version = Math.round(message.version)); - return obj; - }, - - fromPartial, I>>(object: I): RevokePrivilegeResponse { - const message = createBaseRevokePrivilegeResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.version = object.version ?? 0; - return message; - }, -}; - -declare var self: any | undefined; -declare var window: any | undefined; -declare var global: any | undefined; -var globalThis: any = (() => { - if (typeof globalThis !== "undefined") { - return globalThis; - } - if (typeof self !== "undefined") { - return self; - } - if (typeof window !== "undefined") { - return window; - } - if (typeof global !== "undefined") { - return global; - } - throw "Unable to locate global object"; -})(); - -function bytesFromBase64(b64: string): Uint8Array { - if (globalThis.Buffer) { - return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); - } else { - const bin = globalThis.atob(b64); - const arr = new Uint8Array(bin.length); - for (let i = 0; i < bin.length; ++i) { - arr[i] = bin.charCodeAt(i); - } - return arr; - } -} - -function base64FromBytes(arr: Uint8Array): string { - if (globalThis.Buffer) { - return globalThis.Buffer.from(arr).toString("base64"); - } else { - const bin: string[] = []; - arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); - }); - return globalThis.btoa(bin.join("")); - } -} - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> - : T extends { $case: string } ? { [K in keyof Omit]?: DeepPartial } & { $case: T["$case"] } - : T extends {} ? { [K in keyof T]?: DeepPartial } - : Partial; - -type KeysOfUnion = T extends T ? keyof T : never; -export type Exact = P extends Builtin ? P - : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; - -function isSet(value: any): boolean { - return value !== null && value !== undefined; -} diff --git a/dashboard/scripts/generate_proto.sh b/dashboard/scripts/generate_proto.sh index 860820d56fea..0ce74084a42a 100755 --- a/dashboard/scripts/generate_proto.sh +++ b/dashboard/scripts/generate_proto.sh @@ -8,11 +8,13 @@ cp -a ../proto/*.proto tmp_gen # Array in proto will conflict with JavaScript's Array, so we replace it with RwArray. if [[ "$OSTYPE" == "darwin"* ]]; then - sed -i "" -e "s/Array/RwArray/" "tmp_gen/data.proto" + sed -i "" -e "s/Array/RwArray/" "tmp_gen/data.proto" else - sed -i -e "s/Array/RwArray/" "tmp_gen/data.proto" + sed -i -e "s/Array/RwArray/" "tmp_gen/data.proto" fi +mkdir -p proto/gen + protoc --plugin=./node_modules/.bin/protoc-gen-ts_proto \ --experimental_allow_proto3_optional \ --ts_proto_out=proto/gen/ \