Skip to content

Commit

Permalink
Give option to enable debug logging for cleanDeletedBlocks (#6771)
Browse files Browse the repository at this point in the history
Co-authored-by: imodeljs-admin <[email protected]>
  • Loading branch information
nick4598 and imodeljs-admin authored May 30, 2024
1 parent 0c604c7 commit 0728f06
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 13 deletions.
7 changes: 6 additions & 1 deletion common/api/core-backend.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -992,6 +992,11 @@ export namespace CloudSqlite {
name: string;
rootDir: string;
}
// (undocumented)
export interface CleanDeletedBlocksOptions {
debugLogging?: boolean;
nSeconds?: number;
}
export interface CloudCache {
// @internal
destroy(): void;
Expand Down Expand Up @@ -1020,7 +1025,7 @@ export namespace CloudSqlite {
// (undocumented)
readonly cache?: CloudCache;
checkForChanges(): void;
cleanDeletedBlocks(nSeconds?: number): Promise<void>;
cleanDeletedBlocks(options?: CleanDeletedBlocksOptions): Promise<void>;
clearWriteLock(): void;
connect(cache: CloudCache): void;
get containerId(): string;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@itwin/core-backend",
"comment": "",
"type": "none"
}
],
"packageName": "@itwin/core-backend"
}
8 changes: 4 additions & 4 deletions common/config/rush/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion core/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
"webpack": "^5.76.0"
},
"dependencies": {
"@bentley/imodeljs-native": "4.7.17",
"@bentley/imodeljs-native": "4.7.18",
"@itwin/cloud-agnostic-core": "^2.1.0",
"@itwin/core-telemetry": "workspace:*",
"@itwin/object-storage-azure": "^2.2.2",
Expand Down
17 changes: 13 additions & 4 deletions core/backend/src/CloudSqlite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,17 @@ export namespace CloudSqlite {
destroy(): void;
}

export interface CleanDeletedBlocksOptions {
/**
* Any block that was marked as unused before this number of seconds ago will be deleted. Specifying a non-zero
* value gives a period of time for other clients to refresh their manifests and stop using the now-garbage blocks. Otherwise they may get
* a 404 error. Default is 1 hour.
*/
nSeconds?: number;
/** if enabled, outputs verbose logs about the cleanup process. These would include outputting blocks which are determined as eligible for deletion. */
debugLogging?: boolean;
}

/**
* A CloudSqlite container that may be connected to a CloudCache. A CloudContainer maps a container in a cloud blob-storage
* account to a local cache, so that the contents of a database in the container may be accessed as if it were a local file.
Expand Down Expand Up @@ -488,11 +499,9 @@ export namespace CloudSqlite {
* by new versions, sometimes leaving the originals unused. In this case, they are not deleted immediately.
* Instead, they are scheduled for deletion at some later time. Calling this method deletes all blocks in the cloud container
* for which the scheduled deletion time has passed.
* @param nSeconds Any block that was marked as unused before this number of seconds ago will be deleted. Specifying a non-zero
* value gives a period of time for other clients to refresh their manifests and stop using the now-garbage blocks. Otherwise they may get
* a 404 error. Default is 1 hour.
* @param options options which influence the behavior of cleanDeletedBlocks. @see CleanDeletedBlocksOptions
*/
cleanDeletedBlocks(nSeconds?: number): Promise<void>;
cleanDeletedBlocks(options?: CleanDeletedBlocksOptions): Promise<void>;

/**
* Create a copy of an existing database within this CloudContainer with a new name.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ dependencies {
implementation 'com.google.android.material:material:1.7.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.navigation:navigation-ui:2.5.3'
implementation 'com.github.itwin:mobile-native-android:4.7.17'
implementation 'com.github.itwin:mobile-native-android:4.7.18'
implementation 'androidx.webkit:webkit:1.5.0'
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@
repositoryURL = "https://github.com/iTwin/mobile-native-ios";
requirement = {
kind = exactVersion;
version = 4.7.17;
version = 4.7.18;
};
};
/* End XCRemoteSwiftPackageReference section */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@
repositoryURL = "https://github.com/iTwin/mobile-native-ios";
requirement = {
kind = exactVersion;
version = 4.7.17;
version = 4.7.18;
};
};
/* End XCRemoteSwiftPackageReference section */
Expand Down

0 comments on commit 0728f06

Please sign in to comment.