CompactableAssetRepositoryInterface Class Reference

#include <compactable_repository.h>

Inheritance diagram for CompactableAssetRepositoryInterface:

Detailed Description

Repository which allows to write an index.

Public Member Functions

MAXON_METHOD Result< void > Compact ()
 
MAXON_METHOD Result< void > DeleteIndexFiles ()
 
MAXON_METHOD Result< void > CompactInBackground (const TimeValue &delay, const BackgroundProgressRef &backgroundJob)
 
MAXON_METHOD REPOSITORYINDEXSTATE GetIndexState ()
 
MAXON_METHOD Result< void > WriteIndex (const Url &dest, const AssetRepositoryRef &baseToInclude, Bool incremental) const
 

Private Member Functions

 MAXON_INTERFACE (CompactableAssetRepositoryInterface, MAXON_REFERENCE_NORMAL, "net.maxon.interface.compactableassetrepository", MAXON_IMPLEMENTATION_MODULE("net.maxon.asset"))
 

Member Function Documentation

◆ MAXON_INTERFACE()

MAXON_INTERFACE ( CompactableAssetRepositoryInterface  ,
MAXON_REFERENCE_NORMAL  ,
"net.maxon.interface.compactableassetrepository"  ,
MAXON_IMPLEMENTATION_MODULE("net.maxon.asset")   
)
private

◆ Compact()

MAXON_METHOD Result<void> Compact ( )

Generates an index for the current state of this repository. This will generate the folder _index at the root URL of the repository, and that folder contains the compacted structure of the repository and all meta data as binary, json and .dat format.

This method updates the repository itself. If you want to write the index without changing the repository, use WriteIndex.

Returns
OK on success.

◆ DeleteIndexFiles()

MAXON_METHOD Result<void> DeleteIndexFiles ( )

DeleteIndexFiles removes all index files.

Returns
OK on success.

◆ CompactInBackground()

MAXON_METHOD Result<void> CompactInBackground ( const TimeValue delay,
const BackgroundProgressRef &  backgroundJob 
)

Compact generates an index for a repository in a async background job.

Parameters
[in]delayOptional delay after which time the compact should run. TimeValue() to run immediatly.
[in]backgroundJobOptional backgroundJob to use given job. Nullptr to create a backgroundjob internally.
Returns
OK on success.

◆ GetIndexState()

GetIndexState returns the state of the database index.

◆ WriteIndex()

MAXON_METHOD Result<void> WriteIndex ( const Url dest,
const AssetRepositoryRef &  baseToInclude,
Bool  incremental 
) const

Generates an index for the current state of this repository. This will generate the folder _index at the given URL, and that folder contains

  • the compacted list of all assets and their versions.
  • the compacted meta data of all assets in binary and json format. This information is used to speed up loading of meta data.
  • the index.dat file with lists all files of the repository which are needed to load it in compacted form, including the newly created compacted meta data files. This file isn't used by asset repositories themselves, but by AssetDataBasesInterface::CreateRamDiskCache.

Unlike Compact(), this method doesn't update the repository itself.

You can pass an additional base repository. Then the generated index.dat will also list the files of that base. This is useful for the scenario where you have a local repository with new assets and want to prepare an upload of those new assets to the base repository's file storage. In that case the incremental flag is used:

  • When true, only the asset list and meta data of this repository is compacted to a folder of the name from-to, where from and to describe the range of version numbers of this repository. It is an error if there's an overlap with the range of version numbers of the base repository.
  • When false, the asset list and meta data of this repository and the base is written. In both cases, index.dat will contain the files of this repository and the base.
Parameters
[in]destA url where you want the _index to be generated.
[in]baseToIncludeAn optional base repository if you want to write a merged index of base and this repository.
[in]incrementalTrue if you want to write the meta data of just this repository (but index.dat is written for this and base).
Returns
OK on success.