Skip to main content

Neuralyzer::Entity::Lineage::LineageRegistry

Neuralyzer::Entity::Lineage::LineageRegistry

Registry for container lineage metadata. More…

#include <LineageRegistry.hpp>

Public Functions

Name
LineageRegistry() =default
~LineageRegistry() =default
LineageRegistry(LineageRegistry const & ) =delete
LineageRegistry & operator=(LineageRegistry const & ) =delete
LineageRegistry(LineageRegistry && ) =default
LineageRegistry & operator=(LineageRegistry && ) =default
void setLineage(std::string const & data_key, Descriptor lineage)
Register lineage for a data container.
void setLineageWithFileOrigin(std::string const & data_key, Descriptor lineage, FileOrigin file_origin)
Register lineage and file-origin metadata for source data.
void removeLineage(std::string const & data_key)
Remove lineage for a data container.
void clear()
Clear all lineage entries.
std::optional< Descriptor > getLineage(std::string const & data_key) const
Get lineage descriptor for a container.
std::optional< LineageEntry > getLineageEntry(std::string const & data_key) const
Get full lineage entry (including metadata) for a container.
std::optional< FileOrigin > getFileOrigin(std::string const & data_key) const
Get file-origin metadata for a loaded source container.
bool hasLineage(std::string const & data_key) const
Check if a container has registered lineage.
bool isSource(std::string const & data_key) const
Check if a container is a source (no parent lineage).
std::vector< std::string > getSourceKeys(std::string const & data_key) const
Get source keys for a container’s lineage.
std::vector< std::string > getDependentKeys(std::string const & source_key) const
Get all containers that depend on a given source.
std::vector< std::string > getLineageChain(std::string const & data_key) const
Get the complete lineage chain from a container to its root sources.
std::vector< std::string > getAllKeys() const
Get all registered data keys.
std::size_t size() const
Get total number of registered lineages.
bool empty() const
Check if registry is empty.
void markStale(std::string const & data_key)
Mark a lineage as stale (out of sync with source).
void markValid(std::string const & data_key)
Mark a lineage as valid (in sync with source).
bool isStale(std::string const & data_key) const
Check if a lineage is marked as stale.
void propagateStale(std::string const & data_key)
Mark a lineage and all its dependents as stale.
void setInvalidationCallback(InvalidationCallback callback)
Set a custom callback for invalidation events.

Detailed Description

class Neuralyzer::Entity::Lineage::LineageRegistry;

Registry for container lineage metadata.

Stores lineage descriptors that track parent-child relationships between data containers. Supports staleness tracking and provides query methods for lineage chain traversal.

Thread-safety: Not thread-safe. Caller must synchronize access.

Public Functions Documentation

function LineageRegistry

LineageRegistry() =default

function ~LineageRegistry

~LineageRegistry() =default

function LineageRegistry

LineageRegistry(
    LineageRegistry const & 
) =delete

function operator=

LineageRegistry & operator=(
    LineageRegistry const & 
) =delete

function LineageRegistry

LineageRegistry(
    LineageRegistry && 
) =default

function operator=

LineageRegistry & operator=(
    LineageRegistry && 
) =default

function setLineage

void setLineage(
    std::string const & data_key,
    Descriptor lineage
)

Register lineage for a data container.

Parameters:

  • data_key Key of the derived container
  • lineage The lineage descriptor

function setLineageWithFileOrigin

void setLineageWithFileOrigin(
    std::string const & data_key,
    Descriptor lineage,
    FileOrigin file_origin
)

Register lineage and file-origin metadata for source data.

Parameters:

  • data_key Key of the loaded source container.
  • lineage The source lineage descriptor.
  • file_origin Filesystem provenance for the load event.

Precondition: lineage must describe source data.

Postcondition: The registry contains lineage and file-origin metadata for data_key.

function removeLineage

void removeLineage(
    std::string const & data_key
)

Remove lineage for a data container.

Parameters:

  • data_key Key of the container

function clear

void clear()

Clear all lineage entries.

function getLineage

std::optional< Descriptor > getLineage(
    std::string const & data_key
) const

Get lineage descriptor for a container.

Parameters:

  • data_key Key of the container

Return: Lineage descriptor if found, std::nullopt otherwise

function getLineageEntry

std::optional< LineageEntry > getLineageEntry(
    std::string const & data_key
) const

Get full lineage entry (including metadata) for a container.

Parameters:

  • data_key Key of the container

Return: Lineage entry if found, std::nullopt otherwise

function getFileOrigin

std::optional< FileOrigin > getFileOrigin(
    std::string const & data_key
) const

Get file-origin metadata for a loaded source container.

Parameters:

  • data_key Key of the container.

Return: File origin if known, std::nullopt otherwise.

Postcondition: The registry is not modified.

function hasLineage

bool hasLineage(
    std::string const & data_key
) const

Check if a container has registered lineage.

function isSource

bool isSource(
    std::string const & data_key
) const

Check if a container is a source (no parent lineage).

Returns true if:

  • No lineage is registered for this key
  • Lineage is registered but is Source type

function getSourceKeys

std::vector< std::string > getSourceKeys(
    std::string const & data_key
) const

Get source keys for a container’s lineage.

Parameters:

  • data_key Key of the derived container

Return: Vector of source data keys (empty if no lineage or Source type)

function getDependentKeys

std::vector< std::string > getDependentKeys(
    std::string const & source_key
) const

Get all containers that depend on a given source.

Parameters:

  • source_key Key of the source container

Return: Vector of derived container keys

function getLineageChain

std::vector< std::string > getLineageChain(
    std::string const & data_key
) const

Get the complete lineage chain from a container to its root sources.

Parameters:

  • data_key Key of the starting container

Return: Vector of data keys in order from the given key to root sources (may branch if there are multiple sources)

function getAllKeys

std::vector< std::string > getAllKeys() const

Get all registered data keys.

function size

inline std::size_t size() const

Get total number of registered lineages.

function empty

inline bool empty() const

Check if registry is empty.

function markStale

void markStale(
    std::string const & data_key
)

Mark a lineage as stale (out of sync with source).

function markValid

void markValid(
    std::string const & data_key
)

Mark a lineage as valid (in sync with source).

function isStale

bool isStale(
    std::string const & data_key
) const

Check if a lineage is marked as stale.

Return: true if stale or no lineage exists

function propagateStale

void propagateStale(
    std::string const & data_key
)

Mark a lineage and all its dependents as stale.

Recursively marks all containers that depend on this one as stale.

function setInvalidationCallback

void setInvalidationCallback(
    InvalidationCallback callback
)

Set a custom callback for invalidation events.

The callback is invoked when markStale() is called.


Updated on 2026-11-13 at 20:25:41 +0000