CSpace DGS functions

DGS related functions


$adt+ CSpace
{
    void StopGcAndEvictAllDgsNodes();
    ssize_t TryEvictDgsNodes(ssize_t evictionQueueIndex, ssize_t maxTotalBytes);
    ssize_t GetMaxDgsTotalByteSize(ssize_t evictionQueueIndex) const;
    void SetMaxDgsTotalByteSize(ssize_t evictionQueueIndex, ssize_t maxTotalBytes);
};

A CSpace supports a Dependency Graph System (DGS).


void StopGcAndEvictAllDgsNodes()

Must be called without a CSpace lock. Intended to be called before Destroy() to manually close the garbage collector and evict all the DGS nodes. This calls ForceEvict() on every node in the eviction queue. It ignores whether the node is evictable according to its implementation of IsEvictable().


ssize_t TryEvictDgsNodes(ssize_t evictionQueueIndex, ssize_t maxTotalBytes)

Must be called with a CSpace lock. Try to evict DGS nodes from the eviction queue with the given index so they use at most maxTotalBytes. Returns the actual number of bytes taken up by the DGS nodes which can less than, equal to or greater than maxTotalBytes.


ssize_t GetMaxDgsTotalByteSize(ssize_t evictionQueueIndex) const

Get the maximum number of bytes to be taken by the DGS nodes after each eviction for the eviction queue with the given index.


void SetMaxDgsTotalByteSize(ssize_t evictionQueueIndex, ssize_t maxTotalBytes)

Set the maximum number of bytes to be taken by the DGS nodes after each eviction for the eviction queue with the given index.

Free functions using the CSpace in thread local storage


$function+ ssize_t GetMaxDgsTotalByteSize(ssize_t evictionQueueIndex)
{
    if (CSpace* cs = GetThreadPtr<CSpace>())
    {
        return GetMaxDgsTotalByteSize(cs, evictionQueueIndex);
    }
    else
    {
        throw AssertionException("GetMaxDgsTotalByteSize called without CSpace set in thread local storage");
    }
}

$function+ void SetMaxDgsTotalByteSize(ssize_t evictionQueueIndex, ssize_t totalSizeInBytes)
{
    if (CSpace* cs = GetThreadPtr<CSpace>())
    {
        SetMaxDgsTotalByteSize(cs, evictionQueueIndex, totalSizeInBytes);
    }
    else
    {
        throw AssertionException("SetMaxDgsTotalByteSize called without CSpace set in thread local storage");
    }
}