Skip to content

Commit

Permalink
move storage modules to storage directory
Browse files Browse the repository at this point in the history
  • Loading branch information
benStre committed Feb 7, 2024
1 parent 720da52 commit 094373f
Show file tree
Hide file tree
Showing 19 changed files with 27 additions and 26 deletions.
3 changes: 2 additions & 1 deletion datex_all.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,11 @@ export * from "./runtime/io_handler.ts";
export * from "./runtime/js_interface.ts";
export * from "./runtime/performance_measure.ts";
export * from "./runtime/pointers.ts";
export * from "./runtime/storage.ts";
export * from "./runtime/cli.ts";
export * from "./runtime/cache_path.ts";

// storage
export * from "./storage/storage.ts";

// types
export * from "./types/abstract_types.ts";
Expand Down
12 changes: 6 additions & 6 deletions init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import { Runtime } from "./runtime/runtime.ts";
import { Pointer } from "./runtime/pointers.ts";
import { LOCAL_ENDPOINT } from "./types/addressing.ts";
import { client_type } from "./utils/constants.ts";
import { Storage, registerStorageAsPointerSource } from "./runtime/storage.ts";
import { Storage, registerStorageAsPointerSource } from "./storage/storage.ts";
import { cwdURL, logger } from "./utils/global_values.ts";
import { IndexedDBStorageLocation } from "./runtime/storage-locations/indexed-db.ts";
import { LocalStorageLocation } from "./runtime/storage-locations/local-storage.ts";
import { DenoKVStorageLocation } from "./runtime/storage-locations/deno-kv.ts";
import { IndexedDBStorageLocation } from "./storage/storage-locations/indexed-db.ts";
import { LocalStorageLocation } from "./storage/storage-locations/local-storage.ts";
import { DenoKVStorageLocation } from "./storage/storage-locations/deno-kv.ts";
import { loadEternalValues } from "./utils/eternals.ts";
import { DX_BOUND_LOCAL_SLOT } from "./runtime/constants.ts";
import { verboseArg } from "./utils/logger.ts";
Expand Down Expand Up @@ -45,9 +45,9 @@ export async function init() {
}

if (await storageInitModule?.fsExists()) {
logger.info("Initializing custom storage configuration (" + storageInitModule!.normal_pathname + ")")
logger.info("Initializing custom storage configuration (" + storageInitModule!.toString() + ")")
try {
await import(storageInitModule!.normal_pathname);
await import(storageInitModule!.toString());
}
catch (e) {
console.error(e)
Expand Down
2 changes: 1 addition & 1 deletion network/supranet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { Logger } from "../utils/logger.ts";
import { endpoint_config } from "../runtime/endpoint_config.ts";
import { endpoint_name, UnresolvedEndpointProperty } from "../datex_all.ts";
import { Datex } from "../mod.ts";
import { Storage } from "../runtime/storage.ts";
import { Storage } from "../storage/storage.ts";
import { WebSocketClientInterface } from "./communication-interfaces/websocket-client-interface.ts";
import { communicationHub } from "./communication-hub.ts";

Expand Down
2 changes: 1 addition & 1 deletion runtime/crypto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { logger } from "../utils/global_values.ts";
import { Endpoint, Target } from "../types/addressing.ts";
import { SecurityError, ValueError } from "../types/errors.ts";
import { NetworkUtils } from "../network/network_utils.ts";
import { Storage } from "../runtime/storage.ts";
import { Storage } from "../storage/storage.ts";
import { Runtime } from "./runtime.ts";
import { displayFatalError } from "./display.ts";
import { Supranet } from "../network/supranet.ts";
Expand Down
2 changes: 1 addition & 1 deletion runtime/pointers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { LazyPointer } from "./lazy-pointer.ts";
import { ReactiveArrayMethods } from "../types/reactive-methods/array.ts";
import { Assertion } from "../types/assertion.ts";
import { StorageSet } from "../types/storage-set.ts";
import { Storage } from "./storage.ts";
import { Storage } from "../storage/storage.ts";

export type observe_handler<K=any, V extends RefLike = any> = (value:V extends RefLike<infer T> ? T : V, key?:K, type?:Ref.UPDATE_TYPE, transform?:boolean, is_child_update?:boolean, previous?: any, atomic_id?:symbol)=>void|boolean
export type observe_options = {types?:Ref.UPDATE_TYPE[], ignore_transforms?:boolean, recursive?:boolean}
Expand Down
2 changes: 1 addition & 1 deletion runtime/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import { BROADCAST, Endpoint, endpoints, IdEndpoint, LOCAL_ENDPOINT, Target, tar
import { RuntimePerformance } from "./performance_measure.ts";
import { NetworkError, PermissionError, PointerError, RuntimeError, SecurityError, ValueError, Error as DatexError, CompilerError, TypeError, SyntaxError, AssertionError } from "../types/errors.ts";
import { Function as DatexFunction } from "../types/function.ts";
import { Storage } from "../runtime/storage.ts";
import { Storage } from "../storage/storage.ts";
import { Observers } from "../utils/observers.ts";
import { BinaryCode } from "../compiler/binary_codes.ts";
import type { ExecConditions, trace, compile_info, datex_meta, datex_scope, dxb_header, routing_info } from "../utils/global_types.ts";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { Runtime } from "../../runtime/runtime.ts";
import { Compiler } from "../../compiler/compiler.ts";
import { Pointer } from "../../runtime/pointers.ts";

import { NOT_EXISTING } from "../constants.ts";
import { NOT_EXISTING } from "../../runtime/constants.ts";
import { AsyncStorageLocation } from "../storage.ts";
import { ptr_cache_path } from "../cache_path.ts";
import { ptr_cache_path } from "../../runtime/cache_path.ts";
import { client_type } from "../../utils/constants.ts";
import { normalizePath } from "../../utils/normalize-path.ts";
import { ExecConditions } from "../../utils/global_types.ts";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Runtime } from "../../runtime/runtime.ts";
import { Compiler } from "../../compiler/compiler.ts";
import { Pointer } from "../../runtime/pointers.ts";

import { NOT_EXISTING } from "../constants.ts";
import { NOT_EXISTING } from "../../runtime/constants.ts";
import { AsyncStorageLocation, site_suffix } from "../storage.ts";

import localforage from "../../lib/localforage/localforage.js";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { logger } from "../../utils/global_values.ts";
import { client_type } from "../../utils/constants.ts";
import { ptr_cache_path } from "../cache_path.ts";
import { ptr_cache_path } from "../../runtime/cache_path.ts";
import { normalizePath } from "../../utils/normalize-path.ts";

class LocalStorage implements Storage {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Compiler } from "../../compiler/compiler.ts";
import { Storage, SyncStorageLocation } from "../storage.ts";
import { Pointer } from "../pointers.ts";
import { Pointer } from "../../runtime/pointers.ts";
import { Runtime } from "../../runtime/runtime.ts";
import { NOT_EXISTING } from "../constants.ts";
import { NOT_EXISTING } from "../../runtime/constants.ts";
import { base64ToArrayBuffer } from "../../utils/utils.ts";
import { arrayBufferToBase64 } from "../../datex_all.ts";
import { localStorage } from "./local-storage-compat.ts";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { NOT_EXISTING } from "../../runtime/constants.ts";
import { client_type } from "../../utils/constants.ts";
import { Compiler } from "../../compiler/compiler.ts";
import { ExecConditions } from "../../utils/global_types.ts";
import { Runtime } from "../runtime.ts";
import { Runtime } from "../../runtime/runtime.ts";

const logger = new Logger("SQL Storage");

Expand Down
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions runtime/storage.ts → storage/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ import { Runtime } from "../runtime/runtime.ts";
import type { ExecConditions, PointerSource } from "../utils/global_types.ts";
import { logger } from "../utils/global_values.ts";
import { client_type } from "../utils/constants.ts";
import { NOT_EXISTING } from "./constants.ts";
import { Pointer, type MinimalJSRef, Ref } from "./pointers.ts";
import { NOT_EXISTING } from "../runtime/constants.ts";
import { Pointer, type MinimalJSRef, Ref } from "../runtime/pointers.ts";
import { localStorage } from "./storage-locations/local-storage-compat.ts";
import { MessageLogger } from "../utils/message_logger.ts";
import { displayFatalError } from "./display.ts"
import { displayFatalError } from "../runtime/display.ts"
import { Type } from "../types/type.ts";
import { addPersistentListener } from "../utils/persistent-listeners.ts";
import { Endpoint, LOCAL_ENDPOINT } from "../types/addressing.ts";
import { ESCAPE_SEQUENCES } from "../utils/logger.ts";
import { StorageMap } from "../types/storage-map.ts";
import { StorageSet } from "../types/storage-set.ts";
import { IterableWeakSet } from "../utils/iterable-weak-set.ts";
import { LazyPointer } from "./lazy-pointer.ts";
import { LazyPointer } from "../runtime/lazy-pointer.ts";


// displayInit();
Expand Down
2 changes: 1 addition & 1 deletion types/storage-map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { Compiler } from "../compiler/compiler.ts";
import { DX_PTR } from "../runtime/constants.ts";
import { Pointer } from "../runtime/pointers.ts";
import { Storage } from "../runtime/storage.ts";
import { Storage } from "../storage/storage.ts";
import { Logger } from "../utils/logger.ts";

const logger = new Logger("StorageMap");
Expand Down
2 changes: 1 addition & 1 deletion types/storage-set.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { Compiler } from "../compiler/compiler.ts";
import { DX_PTR } from "../runtime/constants.ts";
import { Pointer } from "../runtime/pointers.ts";
import { Storage } from "../runtime/storage.ts";
import { Storage } from "../storage/storage.ts";
import { Logger } from "../utils/logger.ts";

const logger = new Logger("StorageSet");
Expand Down
2 changes: 1 addition & 1 deletion utils/eternals.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { NOT_EXISTING } from "../runtime/constants.ts";
import { Storage } from "../runtime/storage.ts";
import { Storage } from "../storage/storage.ts";
import { getCallerInfo } from "./caller_metadata.ts";
import { logger } from "./global_values.ts";

Expand Down
2 changes: 1 addition & 1 deletion utils/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


//import { Storage } from "../runtime/storage.ts"; TODO Storage cannot be importet here, handle file caching somehow (somewhere else)
//import { Storage } from "../storage/storage.ts"; TODO Storage cannot be importet here, handle file caching somehow (somewhere else)
import { ValueError } from "../types/errors.ts";
import { baseURL, Deno } from "./global_values.ts";
import { client_type } from "./constants.ts";
Expand Down

0 comments on commit 094373f

Please sign in to comment.