@itwin/core-backend
Version:
iTwin.js backend components
59 lines • 2.41 kB
TypeScript
import { Metadata, ServerStorage, TransferConfig } from "@itwin/object-storage-core";
/**
* Identifies a tile in cloud tile cache.
* @beta
*/
export interface TileId {
treeId: string;
contentId: string;
guid: string;
}
/**
* Facilitates interaction with cloud tile cache.
* @beta
*/
export declare class TileStorage {
/**
* Allows using the underlying `ServerStorage` API directly.
* @see https://github.com/iTwin/object-storage/
*/
readonly storage: ServerStorage;
constructor(storage: ServerStorage);
private _initializedIModels;
/**
* Ensures any required cloud storage resources for a specific iModel are ready to use.
*/
initialize(iModelId: string): Promise<void>;
/**
* Returns config that can be used by frontends to download tiles
* @param iModelId Id of the iModel
* @param expiresInSeconds Optional number of seconds until the download URL expires. Defaults to expiring exactly at midnight of next Sunday to enable persistent client-side caching.
* It is recommended to set this to a shorter period when using S3-compatible storage - an exact expiry date cannot be ensured due to limitations in their API.
* @see [TileStorage]($frontend)
*/
getDownloadConfig(iModelId: string, expiresInSeconds?: number): Promise<TransferConfig>;
/**
* Uploads a tile to the cloud cache.
*/
uploadTile(iModelId: string, changesetId: string, treeId: string, contentId: string, content: Uint8Array, guid?: string, metadata?: Metadata): Promise<void>;
/**
* Downloads a tile from the cloud cache.
*/
downloadTile(iModelId: string, changesetId: string, treeId: string, contentId: string, guid?: string): Promise<Uint8Array>;
/**
* Returns an async iterator of all tiles that are found in the cloud cache.
*/
getCachedTilesGenerator(iModelId: string): AsyncGenerator<TileId>;
private getCachedTilePages;
private convertPage;
/**
* Returns a list of all tiles that are found in the cloud cache.
*/
getCachedTiles(iModelId: string): Promise<TileId[]>;
/**
* Returns a boolean indicating whether a tile exists in the cloud cache
*/
isTileCached(iModelId: string, changesetId: string, treeId: string, contentId: string, guid?: string): Promise<boolean>;
private logException;
}
//# sourceMappingURL=TileStorage.d.ts.map