Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: updated to match IKB assetrealizer (draft)
Panel
borderColor#3D3D3D
bgColor#F4F4F4
titleColor#3D3D3D
borderWidth0
titleBGColor#3D3D3D
borderStylesolid

ON THIS PAGE

Table of Contents
indent20px

...

Code Block
languagejs
titleassetrealizer IDL
collapsetrue
interface AssetRealizer {
    constructor(AssetPool pool, String destinationPath);
    Promise<unsigned long long> estimateRealizedSize(AssetList assets);
    Promise<void> realize(AssetList assets);
    Promise<Array<ValidationResult>> validateFiles(AssetList assets, StringListAssetValidationOptions options);
};
 
interface AssetValidationOptions {
    attribute deleteCorrupt;
};
 
interface ValidationResult {
    attribute String name;
    attribute String reason;
};

Object Creation

To create an assetrealizer object, you will first need to create an assetpool instance and download files to it using an assetfetcher  assetpoolfetcher instance. Then, load the brightsign/assetrealizer module using the require() method, and create an instance of the assetrealizer class using the assetpool instance and the destination directory for realization.

Code Block
languagejs
varconst AssetPoolClass = require("@brightsign/assetpool");
varlet assetPool = new AssetPoolClass("SD:/pool");
   
varconst AssetRealizerClass = require("@brightsign/assetrealizer");
varlet assetRealizer = new AssetRealizerClass(assetPool, "SD:/");

AssetRealizer

Use this interface to

...

copy assets out of the pool into real named files in the file system and perform related functions.

estimateRealizedSize()
Code Block
languagejs
Promise<unsigned long long> estimateRealizedSize(AssetList assets)

...

Places the files into the destination directory specified in the passed AssetList objectAssetList object. If the pool does not contain the full set of required files, then this method will immediately fail before any files are changed (this method attempts to do as much work as possible before destructively modifying the file system). This method automatically checks the length of the file and that any hashes that match the specificationthose specified. If there is a mismatch, then the affected file is deleted from the pool and realization fails. This method may cause unprotected assets to be pruned from the pool. The method indicates success or failure by returning a FailureReason interface.The BrightSign JavaScript API currently does not have an equivalent to the roAssetPoolFiles object, so JavaScript applications must allow time to realize assets from an asset pool, rather than referring to them directlyfailure by rejecting the returned promise.

Note
titleNote

The pool and the destination must be on the same storage device in the same file system.

validateFiles()
Code Block
languagejs
Promise<Array<ValidationResult>> validateFiles(AssetList assets, StringListAssetValidationOptions options)

Checks the hash of every file in the

...

passed AssetList against the corresponding file in the destination path and returns a string list containing each mismatched file name mapped to the reason. This operation can take a long time and slow down access to the storage device. It is normally only useful if file system or storage corruption is suspected or for debugging. The options parameter is a string list, which can currently support a single option:

  • "deleteCorrupt": Automatically deletes any files that do not match the expected hash. By default, these files are not deleted.

ValidationResult

This interface is returned by the realizevalidateFiles() method  method to indicate the results of the realize operation.

...