Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Reverted from v. 10

...

Code Block
languagejs
titleassetpool IDL
collapsetrue
[
    GarbageCollected
] interface AssetPool {
    AssetPool(DOMString poolPath);
    Promise<void> protectAssets(DOMString name, AssetList assets);
    Promise<void> unprotectAssets(DOMString name);
    Promise<void> reserveStorage(numberlong size);
    Promise<void> setMaximumPoolSize(numberlong size);
    Promise<number>Promise<long> getPoolSize();
    Promise<ValidationResultList> validate(AssetList assets, ValidationOptions options)
    Promise<QueryResultAssetList> queryFiles(AssetList assets);
    Promise<bool> areAssetsReady(AssetList);
};

interface AssetList {
    attribute DOMString name;
    attribute DOMString link;
    attribute numberlong size;
    attribute Hash hash;
    attribute DOMString changeHint;
    [optional] attribute Authentication auth;
    [optional] attribute HeaderList headers;
    attribute DOMString probe;
};

interface ValidateOptions {
    attribute DOMString deleteCorruptFiles;
};

interface Hash {
    attribute DOMString method;
    attribute DOMString hex;
}

interface Authentication {
    attribute DOMString user;
    attribute DOMString password;
};

interface HeaderList {
    attribute DOMString name;
    attribute DOMString value;
};

interface QueryResultAssetList : Asset {
    attribute DOMString name;
    attribute bool present;
};

interface ValidationResultList : Asset {
    attribute DOMString name;
    attribute bool ok;
    attribute DOMString reason;
};

...

Code Block
languagejs
Promise<void> reserveStorage(numberlong size)

Reserves the specified amount of storage space (in megabytes). This method is persistent: The system software attempts to keep the specified amount of space free even as parallel processes fill up the storage.

...

Code Block
languagejs
Promise<void> setMaximumPoolSize(numberlong size)

Specifies the maximum size of the asset pool (in megabytes). This method is more resource-intensive than reserveStorage(), but it is useful when creating multiple pools on a storage device.

getPoolSize()
Code Block
languagejs
Promise<number>Promise<long> getPoolSize()

Returns the current size of the asset pool (in megabytes).

...

  • [DOMString] name: The filename. For a file to be realized, it must have a valid filename (i.e. no slashes).
  • [DOMString] link: The download URL of the file
  • [numberlong] size: The file length (in bytes)
  • [Hash] hash: A Hash interface specifying the hash algorithm and hash value of the file
  • [DOMString] changeHint: An arbitrary value that can be used by the client to specify that a file has changed even when the hash value and download URL remain the same.
  • [optional] [Authentication] auth: An Authentication interface specifying the credentials to use when downloading the asset. By default, credentials are inherited from the assetpoolfetcher instance used to download the asset.
  • [optional] [HeaderList] headers: A HeaderList interface specifying headers that are passed to the download URL. By default, headers are inherited from the assetpoolfetcher instance used to download the asset.
  • [DOMString] probe: The media probe data

...