コード例 #1
0
ファイル: ParentMapProvider.cs プロジェクト: nemanjazz/iog
        /// <summary>
        /// Returns list of parents for given node witin a snapshot
        /// </summary>
        /// <param name="snapshotId">Snapshot within parents are requested</param>
        /// <param name="nodeId">Node which parents are returned</param>
        /// <returns>List of parent node identifiers for each node in dictionary format, or null if there are no parent edges</returns>
        public IEnumerator <Edge <Guid, EdgeData> > ParentEdges(Guid snapshotId, Guid nodeId)
        {
            lock (dataSync)
            {
                // Generate parents if they dont exist
                if (!createdNodes)
                {
                    createdNodes = true;
                    AddParentsRecursive(snapshotId, new Hashtable(), nodes);
                    lastSnapshotId = snapshotId;
                }

                // Do we have the last snapshot in the memory
                if (snapshotId != lastSnapshotId)
                {
                    // Try going for fallback provider
                    if (fallbackParentMapProvider != null)
                    {
                        return(fallbackParentMapProvider.ParentEdges(snapshotId, nodeId));
                    }
                    else
                    {
                        // If not, generate asked snapshot
                        nodes.Clear();
                        AddParentsRecursive(snapshotId, new Hashtable(), nodes);
                        lastSnapshotId = snapshotId;
                    }
                }

                // Find edge leading to holder node for given ID
                if (nodes.Contains(nodeId))
                {
                    return(BPlusTreeOperations.GetEnumerator(nodes, nodeId, EdgeType.Contains));
                }
                else
                {
                    return(null);
                }
            }
        }
コード例 #2
0
 /// <summary>
 /// Clears nodes from the parent provider and cache
 /// </summary>
 public void Clear()
 {
     rwLock.AcquireWriterLock(-1);
     try
     {
         parentProvider.Clear();
         cacheProvider.Clear();
     }
     finally
     {
         rwLock.ReleaseLock();
     }
 }
コード例 #3
0
 /// <summary>
 /// Clears nodes from the parent provider and cache
 /// </summary>
 public void Clear()
 {
     parentProvider.Clear();
     cacheProvider.Clear();
 }
コード例 #4
0
ファイル: IsolatedNodeProvider.cs プロジェクト: nemanjazz/iog
 /// <summary>
 /// Clears nodes from the provider
 /// </summary>
 public void Clear()
 {
     CheckThread();
     isolatedProvider.Clear();
     nodeStates.Clear();
 }