dimensions-ai
Version:
A generalized AI Competition framework that allows you to create any competition you want in any language you want with no hassle.
64 lines (63 loc) • 2.33 kB
TypeScript
import { Storage as DStorage } from '../../Plugin/Storage';
import { Storage, Bucket } from '@google-cloud/storage';
import { DeepPartial } from '../../utils/DeepPartial';
import { Dimension } from '../../Dimension';
import { Plugin } from '../../Plugin';
import { Database } from '../../Plugin/Database';
import { Tournament } from '../../Tournament';
import { Logger } from '../../Logger';
export declare class GCloudStorage extends DStorage {
name: string;
type: Plugin.Type;
storage: Storage;
configs: GCloudStorage.Configs;
log: Logger;
dimensionBucket: Bucket;
private lruFileCache;
constructor(configs: DeepPartial<GCloudStorage.Configs>);
/**
* Initializer. Initializes the storage object and creates necessary buckets
*/
initialize(dimension: Dimension): Promise<void>;
uploadTournamentFile(file: string, user: Database.User, tournament: Tournament): Promise<string>;
upload(file: string, destination?: string): Promise<string>;
download(key: string, destination: string, useCached: boolean): Promise<string>;
/**
* Returns a download URL to use to download an object
* @param key - key referencing the object to download
*/
getDownloadURL(key: string): Promise<string>;
manipulate(dimension: Dimension): Promise<void>;
}
export declare namespace GCloudStorage {
/**
* Specific configurations for GCloud storage
*/
interface Configs extends DeepPartial<DStorage.Configs> {
/**
* Path to key file from a google account service key
*/
keyFilename: string;
/**
* Project ID
*/
projectId: string;
/**
* When caching files to prevent downloading the same data files over and over, this is the max size of files to
* try and cache before throwing out the largest least used files.
*
* @default `1 GB = 1024 * 1024 * 1024`
*/
fileCacheMaxSize: number;
/**
* Location for all cached files. Actual location is a subdirectry of the local directory used for storing files
* related to dimensions
* @default `cache`
*/
cacheDir: string;
/**
* Logging level for storage service
*/
loggingLevel: Logger.LEVEL;
}
}