UNPKG

@finos/legend-graph

Version:
121 lines 4.08 kB
/** * Copyright (c) 2020-present, Goldman Sachs * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { hashArray, uuid } from '@finos/legend-shared'; import { CORE_HASH_STRUCTURE, hashElementPointer, } from '../../../../../graph/Core_HashUtils.js'; import { PackageableElementPointerType } from '../../../../MetaModelConst.js'; export class IdentifiedConnection { _UUID = uuid(); id; connection; constructor(id, connection) { this.id = id; this.connection = connection; } get hashCode() { return hashArray([ CORE_HASH_STRUCTURE.IDENTIFIED_CONNECTION, this.id, this.connection, ]); } } export class StoreConnections { store; storeConnections = []; constructor(store) { this.store = store; } get hashCode() { return hashArray([ CORE_HASH_STRUCTURE.STORE_CONNECTIONS, hashElementPointer(PackageableElementPointerType.STORE, this.store.valueForSerialization ?? ''), hashArray(this.storeConnections), ]); } } export class ConnectionStores { connectionPointer; storePointers = []; constructor(connectionPointer) { this.connectionPointer = connectionPointer; } get hashCode() { return hashArray([ CORE_HASH_STRUCTURE.STORE_CONNECTIONS, this.connectionPointer, hashArray(this.storePointers.map((s) => hashElementPointer(PackageableElementPointerType.STORE, s.valueForSerialization ?? ''))), ]); } } export class Runtime { } export class EngineRuntime extends Runtime { mappings = []; connectionStores = []; connections = []; get hashCode() { return hashArray([ CORE_HASH_STRUCTURE.ENGINE_RUNTIME, hashArray(this.mappings.map((mapping) => hashElementPointer(PackageableElementPointerType.MAPPING, mapping.valueForSerialization ?? ''))), hashArray(this.connectionStores), hashArray(this.connections.filter( // TODO: use `isStubbed_StoreConnections` when we refactor hashing (connection) => connection.storeConnections.length)), ]); } } export class SingleConnectionRuntime extends EngineRuntime { get hashCode() { return hashArray([ CORE_HASH_STRUCTURE.SINGLE_ENGINE_RUNTIME, hashArray(this.mappings.map((mapping) => hashElementPointer(PackageableElementPointerType.MAPPING, mapping.valueForSerialization ?? ''))), hashArray(this.connectionStores), hashArray(this.connections.filter( // TODO: use `isStubbed_StoreConnections` when we refactor hashing (connection) => connection.storeConnections.length)), ]); } } export class LakehouseRuntime extends EngineRuntime { ingestEnv; warehouse; constructor(ingestEnv, warehouse) { super(); this.ingestEnv = ingestEnv; this.warehouse = warehouse; } get hashCode() { return hashArray([ CORE_HASH_STRUCTURE.LAKEHOUSE_RUNTIME, this.ingestEnv, this.warehouse, ]); } } export class RuntimePointer extends Runtime { packageableRuntime; constructor(packageableRuntime) { super(); this.packageableRuntime = packageableRuntime; } get hashCode() { return hashArray([ CORE_HASH_STRUCTURE.RUNTIME_POINTER, this.packageableRuntime.valueForSerialization ?? '', ]); } } //# sourceMappingURL=Runtime.js.map