@bentley/imodeljs-native 5.3.27 → 5.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/NativeCloudSqlite.d.ts
CHANGED
|
@@ -98,6 +98,15 @@ export declare namespace NativeCloudSqlite {
|
|
|
98
98
|
readonly memoryHighwater?: string;
|
|
99
99
|
/** The total amount of memory used for the manifests for each attached container, in bytes. */
|
|
100
100
|
readonly memoryManifest?: string;
|
|
101
|
+
/** Memory used for arrays of block references held in the daemon on behalf of clients, in bytes.
|
|
102
|
+
* @note this value is only present when running in daemon mode.
|
|
103
|
+
*/
|
|
104
|
+
readonly memoryClientArray?: string;
|
|
105
|
+
/** Memory used by manifests that are kept in memory only for clients use - not the newest manifest
|
|
106
|
+
* available held by the container object, in bytes.
|
|
107
|
+
* @note this value is only present when running in daemon mode.
|
|
108
|
+
*/
|
|
109
|
+
readonly memoryClientManifest?: string;
|
|
101
110
|
}
|
|
102
111
|
/** Properties for accessing a CloudContainer */
|
|
103
112
|
type ContainerAccessProps = ContainerProps & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeCloudSqlite.d.ts","sourceRoot":"","sources":["../src/NativeCloudSqlite.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAC;AAMpD;;GAEG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAKxD,yBAAiB,iBAAiB,CAAC;IAEjC,WAAkB,OAAO;QACvB,QAAQ,IAAS;QAAE,UAAU,IAAS;QAAE,WAAW,IAAS;QAAE,SAAS,IAAS;KACjF;IAED,sCAAsC;IACtC,UAAiB,cAAc;QAC7B,4BAA4B;QAC5B,WAAW,EAAE,OAAO,GAAG,QAAQ,GAAG,IAAI,CAAC;QACvC,8BAA8B;QAC9B,OAAO,EAAE,MAAM,CAAC;QAChB,iCAAiC;QACjC,WAAW,EAAE,MAAM,C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Y,EAAE,wBAAwB,EAAE,IAAI,EAAE,CAAC,CAAC;QACnH,CAAC;KACF;IA7BY,wBAAM,SA6BlB,CAAA;AAEH,CAAC,EAnOgB,iBAAiB,iCAAjB,iBAAiB,QAmOjC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module iModels\r\n */\r\n\r\nimport * as child_process from \"node:child_process\";\r\nimport * as fs from \"node:fs\";\r\nimport * as os from \"node:os\";\r\nimport * as path from \"node:path\";\r\nimport { NativeLibrary } from \"./NativeLibrary\";\r\n\r\n/**\r\n * @note This package may only have **dev** dependencies on @itwin packages, so they are *not* available at runtime. Therefore we can only import **types** from them.\r\n */\r\nimport type { LocalFileName } from \"@itwin/core-common\";\r\n\r\n// cspell:ignore polltime cachesize notimestamps deletetime gctime retrytime nwrite ndelete prefetch httptimeout\r\n/* eslint-disable no-restricted-syntax */\r\n\r\nexport namespace NativeCloudSqlite {\r\n\r\n export const enum LogMask {\r\n LOG_HTTP = 0x0001, LOG_UPLOAD = 0x0002, LOG_CLEANUP = 0x0004, LOG_EVENT = 0x0008\r\n }\r\n\r\n /** Properties of a CloudContainer. */\r\n export interface ContainerProps {\r\n /** blob storage provider */\r\n storageType: \"azure\" | \"google\" | \"s3\";\r\n /** base URI for container. */\r\n baseUri: string;\r\n /** the name of the container. */\r\n containerId: string;\r\n /** an alias for the container. Defaults to `containerId` */\r\n alias?: string;\r\n /** token that grants access to the container. For sas=1 `storageType`s, this is the sasToken. For sas=0, this is the account key */\r\n accessToken: string;\r\n /** if true, container is attached with write permissions, and accessToken must provide write access to the cloud container. */\r\n writeable?: boolean;\r\n /** if true, container is attached in \"secure\" mode (blocks are encrypted). Only supported in daemon mode. */\r\n secure?: boolean;\r\n /** true if the container is public (doesn't require authentication) */\r\n isPublic?: boolean;\r\n /** string attached to log messages from CloudSQLite. This is most useful for identifying usage from daemon mode. */\r\n logId?: string;\r\n }\r\n\r\n /** Returned from `CloudContainer.queryDatabase` describing one database in the container */\r\n export interface CachedDbProps {\r\n /** The total of (4Mb) blocks in the database. */\r\n readonly totalBlocks: number;\r\n /** the number of blocks of the database that have been downloaded into the CloudCache */\r\n readonly localBlocks: number;\r\n /** the number of blocks from this database that have been modified in the CloudCache and need to be uploaded. */\r\n readonly dirtyBlocks: number;\r\n /** If true, the database currently has transactions in the WAL file and may not be uploaded until they have been checkPointed. */\r\n readonly transactions: boolean;\r\n /** the state of this database. Indicates whether the database is new or deleted since last upload */\r\n readonly state: \"\" | \"copied\" | \"deleted\";\r\n /** current number of clients that have this database open. */\r\n readonly nClient: number;\r\n /** current number of ongoing prefetches on this database. */\r\n readonly nPrefetch: number;\r\n }\r\n\r\n /** Returned from 'CloudContainer.queryHttpLog' describing a row in the bcv_http_log table. */\r\n export interface BcvHttpLog {\r\n /** Unique, monotonically increasing id value */\r\n readonly id: number;\r\n /** Time request was made, as iso-8601 */\r\n readonly startTime: string;\r\n /** Time reply received, as iso-8601 (or NULL) */\r\n readonly endTime: string | undefined;\r\n /** \"PUT\", \"GET\", etc. */\r\n readonly method: string;\r\n /** String configured by 'logId' in ContainerProps. Will be \"prefetch\" if request was triggered by a prefetch. */\r\n readonly logId: string;\r\n /** Log message associated with request */\r\n readonly logmsg: string;\r\n /** URI of request */\r\n readonly uri: string;\r\n /** HTTP response code (e.g. 200) */\r\n readonly httpcode: number;\r\n }\r\n\r\n /** Returned from 'CloudContainer.queryBcvStats' describing the rows in the bcv_stat table.\r\n * Also gathers additional statistics using the other virtual tables bcv_container, bcv_database\r\n * such as totalClients, ongoingPrefetches, activeClients and attachedContainers.\r\n * NOTE: All values are returned as hex strings to avoid any possibility of overflow.\r\n */\r\n export interface BcvStats {\r\n /** The total number of cache slots that are currently in use or 'locked' by ongoing client read transactions. In daemonless mode, this value is always 0.\r\n * A locked cache slot implies that it is not eligible for eviction in the event of a full cachefile.\r\n */\r\n readonly lockedCacheslots: string;\r\n /** The current number of slots with data in them in the cache. */\r\n readonly populatedCacheslots: string;\r\n /** The configured size of the cache, in number of slots. */\r\n readonly totalCacheslots: string;\r\n /** The total number of clients opened on this cache */\r\n readonly totalClients?: string;\r\n /** The total number of ongoing prefetches on this cache */\r\n readonly ongoingPrefetches?: string;\r\n /** The total number of active clients on this cache. An active client is one which has an open read txn. */\r\n readonly activeClients?: string;\r\n /** The total number of attached containers on this cache. */\r\n readonly attachedContainers?: string;\r\n /** The total amount of memory used by sqlite, in bytes. */\r\n readonly memoryUsed?: string;\r\n /** The maximum value of memoryUsed since high-water mark was last reset, in bytes. */\r\n readonly memoryHighwater?: string;\r\n /** The total amount of memory used for the manifests for each attached container, in bytes. */\r\n readonly memoryManifest?: string;\r\n }\r\n\r\n /** Properties for accessing a CloudContainer */\r\n export type ContainerAccessProps = ContainerProps & {\r\n /** Duration for holding write lock, in seconds. After this time the write lock expires if not refreshed. Default is one hour. */\r\n lockExpireSeconds?: number;\r\n };\r\n\r\n /** The name of a CloudSqlite database within a CloudContainer. */\r\n export interface DbNameProp {\r\n /** the name of the database within the CloudContainer.\r\n * @note names of databases within a CloudContainer are always **case sensitive** on all platforms.*/\r\n dbName: string;\r\n }\r\n\r\n /** Properties for accessing a database within a CloudContainer */\r\n export interface DbProps extends DbNameProp {\r\n /** the name of the local file to access the database. */\r\n localFileName: LocalFileName;\r\n }\r\n\r\n export type TransferDirection = \"upload\" | \"download\";\r\n export interface TransferProgress {\r\n /** a user-supplied progress function called during the transfer operation. Return a non-0 value to abort the transfer. */\r\n onProgress?: (loaded: number, total: number) => number;\r\n }\r\n\r\n export interface CloudHttpProps {\r\n /** The number of simultaneous HTTP requests. Default is 6. */\r\n nRequests?: number;\r\n /** The time in seconds to wait without a response before considering a http request as timed out. Default is 60 seconds. */\r\n httpTimeout?: number;\r\n }\r\n\r\n export interface PrefetchProps extends CloudHttpProps {\r\n /** timeout between requests, in milliseconds. Default is 100. */\r\n timeout?: number;\r\n /** The number of prefetch requests to issue while there is foreground activity. Default is 3. */\r\n minRequests?: number;\r\n }\r\n\r\n export interface CleanDeletedBlocksOptions {\r\n /**\r\n * Any block that was marked as unused before this number of seconds ago will be deleted. Specifying a non-zero\r\n * value gives a period of time for other clients to refresh their manifests and stop using the now-garbage blocks. Otherwise they may get\r\n * a 404 error. Default is 1 hour.\r\n */\r\n nSeconds?: number;\r\n /** if enabled, outputs verbose logs about the cleanup process. These would include outputting blocks which are determined as eligible for deletion.\r\n * @default false\r\n */\r\n debugLogging?: boolean;\r\n /** If true, iterates over all blobs in the cloud container to add blocks that are 'orphaned' to the delete list in the manifest.\r\n * Orphaned blocks are created when a client abruptly halts, is disconnected or encounters an error while uploading a change.\r\n * If false, the search for 'orphaned' blocks is skipped and only any blocks which are already on the delete list are deleted.\r\n * @default true\r\n */\r\n findOrphanedBlocks?: boolean;\r\n /**\r\n * a user-supplied progress function called during the cleanup operation. While the search for orphaned blocks occurs, nDeleted will be 0 and nTotalToDelete will be 1.\r\n * Once the search is complete and orphaned blocks begin being deleted, nDeleted will be the number of blocks deleted and nTotalToDelete will be the total number of blocks to delete.\r\n * If the return value is 1, the job will be cancelled. If one or more blocks have already been deleted, then a new manifest file is uploaded saving the progress of the delete job.\r\n * Return any other non-0 value to abort the transfer without saving progress.\r\n */\r\n onProgress?: (nDeleted: number, nTotalToDelete: number) => Promise<number>;\r\n }\r\n\r\n export type TransferDbProps = DbProps & TransferProgress & CloudHttpProps;\r\n\r\n /** Properties for creating a CloudCache. */\r\n export interface CacheProps extends CloudHttpProps {\r\n /** full path of directory for cache to store its files. Must be on a (preferably fast) local drive, and must be empty when the cache is first created. */\r\n rootDir: string;\r\n /** name of this cache. It is possible to have more than one CloudCache in the same session. */\r\n name: string;\r\n /** maximum cache Size. Must be a number followed by either M (for megabytes) or G (for gigabytes.) Default is 1G */\r\n cacheSize?: string;\r\n /** turn on diagnostics for `curl` (outputs to stderr) */\r\n curlDiagnostics?: boolean;\r\n }\r\n\r\n /** Properties for creating a new instance of a daemon process. */\r\n export interface DaemonProps {\r\n /** full path name of daemon.exe file. Default is to find \"iTwinDaemon.exe\" in the same directory as this library. */\r\n exePath?: string;\r\n /** daemon connection address. Default is \"127.0.0.1\" */\r\n addr?: string;\r\n /** port number. Default 22002 */\r\n portNumber?: number;\r\n /** maximum cache Size. Must be a number followed by either M (for megabytes) or G (for gigabytes.) Default is 1G */\r\n cacheSize?: string;\r\n /** logging options */\r\n log?: string;\r\n /** if true, don't include timestamps in log messages */\r\n noTimeStamps?: boolean;\r\n /** The amount of time, in seconds before an http request made to cloud storage by the daemon times out. Default 600 seconds. */\r\n httptimeout?: number;\r\n /** options for spawn */\r\n spawnOptions?: child_process.SpawnOptions;\r\n }\r\n export type DaemonCommandArg = DbNameProp & CacheProps & ContainerProps;\r\n\r\n export class Daemon {\r\n public static exeName(props: DaemonProps) {\r\n return props.exePath ?? path.join(__dirname, NativeLibrary.archName, os.platform() === \"win32\" ? \"iTwinDaemon.exe\" : \"iTwinDaemon\");\r\n }\r\n public static daemonDir(props: CacheProps) {\r\n return props.rootDir ?? path.join(NativeLibrary.defaultCacheDir, \"itwin-daemon\");\r\n }\r\n\r\n /** Start the Daemon process using the supplied properties. The process will be detached from the current process. */\r\n public static start(props: DaemonProps & CacheProps): child_process.ChildProcess {\r\n const dir = this.daemonDir(props);\r\n fs.mkdirSync(dir, { recursive: true }); // make sure the directory exists before starting the daemon\r\n\r\n const args = [`daemon`];\r\n if (props.addr !== undefined)\r\n args.push(`-addr`, `${props.addr}`);\r\n if (props.portNumber !== undefined)\r\n args.push(`-port`, `${props.portNumber}`);\r\n if (props.cacheSize)\r\n args.push(`-cachesize`, `${props.cacheSize}`);\r\n if (props.log)\r\n args.push(`-log`, `${props.log}`);\r\n if (props.noTimeStamps)\r\n args.push(`-notimestamps`);\r\n if (props.httptimeout !== undefined)\r\n args.push(`-httptimeout`, `${props.httptimeout}`);\r\n args.push(`${dir}`); // This MUST be the last arg when starting the daemon.\r\n return child_process.spawn(this.exeName(props), args, { ...props.spawnOptions, windowsVerbatimArguments: true });\r\n }\r\n }\r\n\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"NativeCloudSqlite.js","sourceRoot":"","sources":["../src/NativeCloudSqlite.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,oDAAoD;AACpD,8BAA8B;AAC9B,8BAA8B;AAC9B,kCAAkC;AAClC,mDAAgD;AAOhD,gHAAgH;AAChH,yCAAyC;AAEzC,IAAiB,iBAAiB,CA4OjC;AA5OD,WAAiB,iBAAiB;IA6MhC,MAAa,MAAM;QACV,MAAM,CAAC,OAAO,CAAC,KAAkB;YACtC,OAAO,KAAK,CAAC,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,6BAAa,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,EAAE,KAAK,OAAO,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC;QACtI,CAAC;QACM,MAAM,CAAC,SAAS,CAAC,KAAiB;YACvC,OAAO,KAAK,CAAC,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,6BAAa,CAAC,eAAe,EAAE,cAAc,CAAC,CAAC;QACnF,CAAC;QAED,qHAAqH;QAC9G,MAAM,CAAC,KAAK,CAAC,KAA+B;YACjD,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;YAClC,EAAE,CAAC,SAAS,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,4DAA4D;YAEpG,MAAM,IAAI,GAAG,CAAC,QAAQ,CAAC,CAAC;YACxB,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS;gBAC1B,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;YACtC,IAAI,KAAK,CAAC,UAAU,KAAK,SAAS;gBAChC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC;YAC5C,IAAI,KAAK,CAAC,SAAS;gBACjB,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC;YAChD,IAAI,KAAK,CAAC,GAAG;gBACX,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC;YACpC,IAAI,KAAK,CAAC,YAAY;gBACpB,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;YAC7B,IAAI,KAAK,CAAC,WAAW,KAAK,SAAS;gBACjC,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC;YACpD,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC,CAAC,CAAC,sDAAsD;YAC3E,OAAO,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,EAAE,GAAG,KAAK,CAAC,YAAY,EAAE,wBAAwB,EAAE,IAAI,EAAE,CAAC,CAAC;QACnH,CAAC;KACF;IA7BY,wBAAM,SA6BlB,CAAA;AAEH,CAAC,EA5OgB,iBAAiB,iCAAjB,iBAAiB,QA4OjC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module iModels\r\n */\r\n\r\nimport * as child_process from \"node:child_process\";\r\nimport * as fs from \"node:fs\";\r\nimport * as os from \"node:os\";\r\nimport * as path from \"node:path\";\r\nimport { NativeLibrary } from \"./NativeLibrary\";\r\n\r\n/**\r\n * @note This package may only have **dev** dependencies on @itwin packages, so they are *not* available at runtime. Therefore we can only import **types** from them.\r\n */\r\nimport type { LocalFileName } from \"@itwin/core-common\";\r\n\r\n// cspell:ignore polltime cachesize notimestamps deletetime gctime retrytime nwrite ndelete prefetch httptimeout\r\n/* eslint-disable no-restricted-syntax */\r\n\r\nexport namespace NativeCloudSqlite {\r\n\r\n export const enum LogMask {\r\n LOG_HTTP = 0x0001, LOG_UPLOAD = 0x0002, LOG_CLEANUP = 0x0004, LOG_EVENT = 0x0008\r\n }\r\n\r\n /** Properties of a CloudContainer. */\r\n export interface ContainerProps {\r\n /** blob storage provider */\r\n storageType: \"azure\" | \"google\" | \"s3\";\r\n /** base URI for container. */\r\n baseUri: string;\r\n /** the name of the container. */\r\n containerId: string;\r\n /** an alias for the container. Defaults to `containerId` */\r\n alias?: string;\r\n /** token that grants access to the container. For sas=1 `storageType`s, this is the sasToken. For sas=0, this is the account key */\r\n accessToken: string;\r\n /** if true, container is attached with write permissions, and accessToken must provide write access to the cloud container. */\r\n writeable?: boolean;\r\n /** if true, container is attached in \"secure\" mode (blocks are encrypted). Only supported in daemon mode. */\r\n secure?: boolean;\r\n /** true if the container is public (doesn't require authentication) */\r\n isPublic?: boolean;\r\n /** string attached to log messages from CloudSQLite. This is most useful for identifying usage from daemon mode. */\r\n logId?: string;\r\n }\r\n\r\n /** Returned from `CloudContainer.queryDatabase` describing one database in the container */\r\n export interface CachedDbProps {\r\n /** The total of (4Mb) blocks in the database. */\r\n readonly totalBlocks: number;\r\n /** the number of blocks of the database that have been downloaded into the CloudCache */\r\n readonly localBlocks: number;\r\n /** the number of blocks from this database that have been modified in the CloudCache and need to be uploaded. */\r\n readonly dirtyBlocks: number;\r\n /** If true, the database currently has transactions in the WAL file and may not be uploaded until they have been checkPointed. */\r\n readonly transactions: boolean;\r\n /** the state of this database. Indicates whether the database is new or deleted since last upload */\r\n readonly state: \"\" | \"copied\" | \"deleted\";\r\n /** current number of clients that have this database open. */\r\n readonly nClient: number;\r\n /** current number of ongoing prefetches on this database. */\r\n readonly nPrefetch: number;\r\n }\r\n\r\n /** Returned from 'CloudContainer.queryHttpLog' describing a row in the bcv_http_log table. */\r\n export interface BcvHttpLog {\r\n /** Unique, monotonically increasing id value */\r\n readonly id: number;\r\n /** Time request was made, as iso-8601 */\r\n readonly startTime: string;\r\n /** Time reply received, as iso-8601 (or NULL) */\r\n readonly endTime: string | undefined;\r\n /** \"PUT\", \"GET\", etc. */\r\n readonly method: string;\r\n /** String configured by 'logId' in ContainerProps. Will be \"prefetch\" if request was triggered by a prefetch. */\r\n readonly logId: string;\r\n /** Log message associated with request */\r\n readonly logmsg: string;\r\n /** URI of request */\r\n readonly uri: string;\r\n /** HTTP response code (e.g. 200) */\r\n readonly httpcode: number;\r\n }\r\n\r\n /** Returned from 'CloudContainer.queryBcvStats' describing the rows in the bcv_stat table.\r\n * Also gathers additional statistics using the other virtual tables bcv_container, bcv_database\r\n * such as totalClients, ongoingPrefetches, activeClients and attachedContainers.\r\n * NOTE: All values are returned as hex strings to avoid any possibility of overflow.\r\n */\r\n export interface BcvStats {\r\n /** The total number of cache slots that are currently in use or 'locked' by ongoing client read transactions. In daemonless mode, this value is always 0.\r\n * A locked cache slot implies that it is not eligible for eviction in the event of a full cachefile.\r\n */\r\n readonly lockedCacheslots: string;\r\n /** The current number of slots with data in them in the cache. */\r\n readonly populatedCacheslots: string;\r\n /** The configured size of the cache, in number of slots. */\r\n readonly totalCacheslots: string;\r\n /** The total number of clients opened on this cache */\r\n readonly totalClients?: string;\r\n /** The total number of ongoing prefetches on this cache */\r\n readonly ongoingPrefetches?: string;\r\n /** The total number of active clients on this cache. An active client is one which has an open read txn. */\r\n readonly activeClients?: string;\r\n /** The total number of attached containers on this cache. */\r\n readonly attachedContainers?: string;\r\n /** The total amount of memory used by sqlite, in bytes. */\r\n readonly memoryUsed?: string;\r\n /** The maximum value of memoryUsed since high-water mark was last reset, in bytes. */\r\n readonly memoryHighwater?: string;\r\n /** The total amount of memory used for the manifests for each attached container, in bytes. */\r\n readonly memoryManifest?: string;\r\n /** Memory used for arrays of block references held in the daemon on behalf of clients, in bytes.\r\n * @note this value is only present when running in daemon mode.\r\n */\r\n readonly memoryClientArray?: string;\r\n /** Memory used by manifests that are kept in memory only for clients use - not the newest manifest\r\n * available held by the container object, in bytes.\r\n * @note this value is only present when running in daemon mode.\r\n */\r\n readonly memoryClientManifest?: string;\r\n }\r\n\r\n /** Properties for accessing a CloudContainer */\r\n export type ContainerAccessProps = ContainerProps & {\r\n /** Duration for holding write lock, in seconds. After this time the write lock expires if not refreshed. Default is one hour. */\r\n lockExpireSeconds?: number;\r\n };\r\n\r\n /** The name of a CloudSqlite database within a CloudContainer. */\r\n export interface DbNameProp {\r\n /** the name of the database within the CloudContainer.\r\n * @note names of databases within a CloudContainer are always **case sensitive** on all platforms.*/\r\n dbName: string;\r\n }\r\n\r\n /** Properties for accessing a database within a CloudContainer */\r\n export interface DbProps extends DbNameProp {\r\n /** the name of the local file to access the database. */\r\n localFileName: LocalFileName;\r\n }\r\n\r\n export type TransferDirection = \"upload\" | \"download\";\r\n export interface TransferProgress {\r\n /** a user-supplied progress function called during the transfer operation. Return a non-0 value to abort the transfer. */\r\n onProgress?: (loaded: number, total: number) => number;\r\n }\r\n\r\n export interface CloudHttpProps {\r\n /** The number of simultaneous HTTP requests. Default is 6. */\r\n nRequests?: number;\r\n /** The time in seconds to wait without a response before considering a http request as timed out. Default is 60 seconds. */\r\n httpTimeout?: number;\r\n }\r\n\r\n export interface PrefetchProps extends CloudHttpProps {\r\n /** timeout between requests, in milliseconds. Default is 100. */\r\n timeout?: number;\r\n /** The number of prefetch requests to issue while there is foreground activity. Default is 3. */\r\n minRequests?: number;\r\n }\r\n\r\n export interface CleanDeletedBlocksOptions {\r\n /**\r\n * Any block that was marked as unused before this number of seconds ago will be deleted. Specifying a non-zero\r\n * value gives a period of time for other clients to refresh their manifests and stop using the now-garbage blocks. Otherwise they may get\r\n * a 404 error. Default is 1 hour.\r\n */\r\n nSeconds?: number;\r\n /** if enabled, outputs verbose logs about the cleanup process. These would include outputting blocks which are determined as eligible for deletion.\r\n * @default false\r\n */\r\n debugLogging?: boolean;\r\n /** If true, iterates over all blobs in the cloud container to add blocks that are 'orphaned' to the delete list in the manifest.\r\n * Orphaned blocks are created when a client abruptly halts, is disconnected or encounters an error while uploading a change.\r\n * If false, the search for 'orphaned' blocks is skipped and only any blocks which are already on the delete list are deleted.\r\n * @default true\r\n */\r\n findOrphanedBlocks?: boolean;\r\n /**\r\n * a user-supplied progress function called during the cleanup operation. While the search for orphaned blocks occurs, nDeleted will be 0 and nTotalToDelete will be 1.\r\n * Once the search is complete and orphaned blocks begin being deleted, nDeleted will be the number of blocks deleted and nTotalToDelete will be the total number of blocks to delete.\r\n * If the return value is 1, the job will be cancelled. If one or more blocks have already been deleted, then a new manifest file is uploaded saving the progress of the delete job.\r\n * Return any other non-0 value to abort the transfer without saving progress.\r\n */\r\n onProgress?: (nDeleted: number, nTotalToDelete: number) => Promise<number>;\r\n }\r\n\r\n export type TransferDbProps = DbProps & TransferProgress & CloudHttpProps;\r\n\r\n /** Properties for creating a CloudCache. */\r\n export interface CacheProps extends CloudHttpProps {\r\n /** full path of directory for cache to store its files. Must be on a (preferably fast) local drive, and must be empty when the cache is first created. */\r\n rootDir: string;\r\n /** name of this cache. It is possible to have more than one CloudCache in the same session. */\r\n name: string;\r\n /** maximum cache Size. Must be a number followed by either M (for megabytes) or G (for gigabytes.) Default is 1G */\r\n cacheSize?: string;\r\n /** turn on diagnostics for `curl` (outputs to stderr) */\r\n curlDiagnostics?: boolean;\r\n }\r\n\r\n /** Properties for creating a new instance of a daemon process. */\r\n export interface DaemonProps {\r\n /** full path name of daemon.exe file. Default is to find \"iTwinDaemon.exe\" in the same directory as this library. */\r\n exePath?: string;\r\n /** daemon connection address. Default is \"127.0.0.1\" */\r\n addr?: string;\r\n /** port number. Default 22002 */\r\n portNumber?: number;\r\n /** maximum cache Size. Must be a number followed by either M (for megabytes) or G (for gigabytes.) Default is 1G */\r\n cacheSize?: string;\r\n /** logging options */\r\n log?: string;\r\n /** if true, don't include timestamps in log messages */\r\n noTimeStamps?: boolean;\r\n /** The amount of time, in seconds before an http request made to cloud storage by the daemon times out. Default 600 seconds. */\r\n httptimeout?: number;\r\n /** options for spawn */\r\n spawnOptions?: child_process.SpawnOptions;\r\n }\r\n export type DaemonCommandArg = DbNameProp & CacheProps & ContainerProps;\r\n\r\n export class Daemon {\r\n public static exeName(props: DaemonProps) {\r\n return props.exePath ?? path.join(__dirname, NativeLibrary.archName, os.platform() === \"win32\" ? \"iTwinDaemon.exe\" : \"iTwinDaemon\");\r\n }\r\n public static daemonDir(props: CacheProps) {\r\n return props.rootDir ?? path.join(NativeLibrary.defaultCacheDir, \"itwin-daemon\");\r\n }\r\n\r\n /** Start the Daemon process using the supplied properties. The process will be detached from the current process. */\r\n public static start(props: DaemonProps & CacheProps): child_process.ChildProcess {\r\n const dir = this.daemonDir(props);\r\n fs.mkdirSync(dir, { recursive: true }); // make sure the directory exists before starting the daemon\r\n\r\n const args = [`daemon`];\r\n if (props.addr !== undefined)\r\n args.push(`-addr`, `${props.addr}`);\r\n if (props.portNumber !== undefined)\r\n args.push(`-port`, `${props.portNumber}`);\r\n if (props.cacheSize)\r\n args.push(`-cachesize`, `${props.cacheSize}`);\r\n if (props.log)\r\n args.push(`-log`, `${props.log}`);\r\n if (props.noTimeStamps)\r\n args.push(`-notimestamps`);\r\n if (props.httptimeout !== undefined)\r\n args.push(`-httptimeout`, `${props.httptimeout}`);\r\n args.push(`${dir}`); // This MUST be the last arg when starting the daemon.\r\n return child_process.spawn(this.exeName(props), args, { ...props.spawnOptions, windowsVerbatimArguments: true });\r\n }\r\n }\r\n\r\n}\r\n"]}
|