hecl
High-Level Extensible Combiner Language and Resource Database
Classes | Public Types | Public Member Functions | Public Attributes | List of all members
HECL::Database::Project Class Reference

Main project interface. More...

#include <HECLDatabase.hpp>

Collaboration diagram for HECL::Database::Project:
Collaboration graph

Classes

class  ConfigFile
 Configuration file handle. More...
 
class  IndexFile
 Index file handle. More...
 
class  PackageException
 Internal packagePath() exception. More...
 

Public Types

enum  Cost { C_NONE, C_LIGHT, C_MEDIUM, C_HEAVY }
 A rough description of how 'expensive' a given cook operation is. More...
 
typedef std::vector< std::pair< const DataSpecEntry &, bool > > CompiledSpecs
 

Public Member Functions

 Project (const HECL::ProjectRootPath &rootPath)
 
void registerLogger (HECL::FLogger logger)
 Register an optional callback to report log-messages using. More...
 
const ProjectRootPathgetProjectRootPath () const
 Get the path of the project's root-directory. More...
 
bool addPaths (const std::vector< ProjectPath > &paths)
 Add given file(s) to the database. More...
 
bool removePaths (const std::vector< ProjectPath > &paths, bool recursive=false)
 Remove a given file or file-pattern from the database. More...
 
bool addGroup (const ProjectPath &path)
 Register a working sub-directory as a Dependency Group. More...
 
bool removeGroup (const ProjectPath &path)
 Unregister a working sub-directory as a dependency group. More...
 
const CompiledSpecs & getDataSpecs ()
 Return map populated with dataspecs targetable by this project interface. More...
 
bool enableDataSpecs (const std::vector< SystemString > &specs)
 Enable persistent user preference for particular spec string(s) More...
 
bool disableDataSpecs (const std::vector< SystemString > &specs)
 Disable persistent user preference for particular spec string(s) More...
 
bool cookPath (const ProjectPath &path, std::function< void(SystemString &, Cost, unsigned)> feedbackCb, bool recursive=false)
 Begin cook process for specified directory. More...
 
void interruptCook ()
 Interrupts a cook in progress (call from SIGINT handler) More...
 
bool cleanPath (const ProjectPath &path, bool recursive=false)
 Delete cooked objects for directory. More...
 
PackageDepsgraph buildPackageDepsgraph (const ProjectPath &path)
 Constructs a full depsgraph of the project-subpath provided. More...
 

Public Attributes

ConfigFile m_specs
 
ConfigFile m_paths
 
ConfigFile m_groups
 
IndexFile m_index
 

Detailed Description

Main project interface.

Projects are intermediate working directories used for staging resources in their ideal editor-formats. This interface exposes all primary operations to perform on a given project.

Member Enumeration Documentation

A rough description of how 'expensive' a given cook operation is.

This is used to provide pretty colors during the cook operation

Member Function Documentation

bool HECL::Database::Project::addGroup ( const ProjectPath path)

Register a working sub-directory as a Dependency Group.

Parameters
pathdirectory to register as Dependency Group
Returns
true on success

Dependency Groups are used at runtime to stage burst load-transactions. They may only be added to directories and will automatically claim subdirectories as well.

Cooked objects in dependency groups will be packaged contiguously and automatically duplicated if shared with other dependency groups. This contiguous storage makes for optimal loading from slow block-devices like optical drives.

bool HECL::Database::Project::addPaths ( const std::vector< ProjectPath > &  paths)

Add given file(s) to the database.

Parameters
pathfile or pattern within project
Returns
true on success

This method blocks while object hashing takes place

PackageDepsgraph HECL::Database::Project::buildPackageDepsgraph ( const ProjectPath path)

Constructs a full depsgraph of the project-subpath provided.

Parameters
pathSubpath of project to root depsgraph at
Returns
Populated depsgraph ready to traverse
bool HECL::Database::Project::cleanPath ( const ProjectPath path,
bool  recursive = false 
)

Delete cooked objects for directory.

Parameters
pathdirectory of intermediates to clean
recursivetraverse subdirectories to clean as well
Returns
true on success

Developers understand how useful 'clean' is. While ideally not required, it's useful for verifying that a rebuild from ground-up is doable.

bool HECL::Database::Project::cookPath ( const ProjectPath path,
std::function< void(SystemString &, Cost, unsigned)>  feedbackCb,
bool  recursive = false 
)

Begin cook process for specified directory.

Parameters
pathdirectory of intermediates to cook
feedbackCba callback to run reporting cook-progress
recursivetraverse subdirectories to cook as well
Returns
true on success

Object cooking is generally an expensive process for large projects. This method blocks execution during the procedure, with periodic feedback delivered via feedbackCb.

bool HECL::Database::Project::disableDataSpecs ( const std::vector< SystemString > &  specs)

Disable persistent user preference for particular spec string(s)

Parameters
specsString(s) representing unique spec(s) from listDataSpecs
Returns
true on success
bool HECL::Database::Project::enableDataSpecs ( const std::vector< SystemString > &  specs)

Enable persistent user preference for particular spec string(s)

Parameters
specsString(s) representing unique spec(s) from listDataSpecs
Returns
true on success
const CompiledSpecs& HECL::Database::Project::getDataSpecs ( )
inline

Return map populated with dataspecs targetable by this project interface.

Returns
Platform map with name-string keys and enable-status values
const ProjectRootPath& HECL::Database::Project::getProjectRootPath ( ) const
inline

Get the path of the project's root-directory.

Parameters
absolutereturn as absolute-path
Returns
project root path

Self explanatory

void HECL::Database::Project::interruptCook ( )

Interrupts a cook in progress (call from SIGINT handler)

Database corruption is bad! sqlite is pretty robust at avoiding data corruption, but HECL spreads its data objects through the filesystem; this ensures that those objects are cleanly finalized or discarded before stopping.

Note that this method returns immediately; the resumed cookPath() call will return as quickly as possible.

void HECL::Database::Project::registerLogger ( HECL::FLogger  logger)

Register an optional callback to report log-messages using.

Parameters
loggerlogger-callback

If this method is never called, all project operations will run silently.

bool HECL::Database::Project::removeGroup ( const ProjectPath path)

Unregister a working sub-directory as a dependency group.

Parameters
pathdirectory to unregister as Dependency Group
Returns
true on success
bool HECL::Database::Project::removePaths ( const std::vector< ProjectPath > &  paths,
bool  recursive = false 
)

Remove a given file or file-pattern from the database.

Parameters
pathsfile(s) or pattern(s) within project
recursivetraverse into matched subdirectories
Returns
true on success

This method will not delete actual working files from the project directory. It will delete associated cooked objects though.


The documentation for this class was generated from the following file: