Example #1
0
 /// <summary>
 /// Returns node enumeration containing all nodes in the parent provider
 /// </summary>
 /// <returns>Nodes identifiers</returns>
 public IEnumerable EnumerateNodes()
 {
     rwLock.AcquireReaderLock(-1);
     try
     {
         return(parentProvider.EnumerateNodes());
     }
     finally
     {
         rwLock.ReleaseLock();
     }
 }
Example #2
0
        public string CollectionReport()
        {
            Hashtable usedNodes = new Hashtable();

            // Collect used nodes
            foreach (var snapshotId in snapshotsService.ListSnapshots())
            {
                AddUsedNodesRecursive(snapshotId, usedNodes);
            }

            StringBuilder sb = new StringBuilder();

            foreach (Guid nodeId in provider.EnumerateNodes())
            {
                if (!usedNodes.ContainsKey(nodeId))
                {
                    // We found a node which is not used and should be collected
                    var node = provider.GetNode(nodeId, NodeAccess.Read);

                    string line = nodeId.ToString() + "\t" + node.NodeType.ToString() + "\t";

                    var typeData = new EdgeData(EdgeType.OfType, null);

                    if (node.Edges.ContainsKey(typeData))
                    {
                        var typeEdge = node.FindEdge(typeData);

                        if (typeEdge != null)
                        {
                            line += typesService.GetTypeFromIdCached(typeEdge.ToNodeId).Name + "\t";
                        }
                    }

                    sb.AppendLine(line);
                }
            }

            return(sb.ToString());
        }
        /// <summary>
        /// Returns node enumeration containing all nodes
        /// </summary>
        /// <returns>Nodes identifiers</returns>
        public IEnumerable EnumerateNodes()
        {
            Collection <TIdentifier> items = new Collection <TIdentifier>();

            foreach (TIdentifier item in cacheProvider.EnumerateNodes())
            {
                items.Add(item);
            }

            foreach (TIdentifier item in parentProvider.EnumerateNodes())
            {
                items.Add(item);
            }

            return(items);
        }
Example #4
0
        internal void Archive(Guid revisionId, INodeProvider<Guid, object, EdgeData> source, INodeProvider<Guid, object, EdgeData> destination)
        {
            foreach (var item in destination.EnumerateNodes())
            {
                throw new ArgumentException("Destination provider must be empty");
            }

            var visitedNodes = new Hashtable();

            // Create types
            AddNodesRecursive(Constants.TypesNodeId, source, destination, visitedNodes);

            // Copy snapshot
            AddNodesRecursive(revisionId, source, destination, visitedNodes);

            // Create snapshots root
            var snapshotsNode = new Node<Guid, object, EdgeData>(NodeType.SnapshotsRoot, null);
            // Create link to the snapshot
            snapshotsNode.AddEdge(new Edge<Guid, EdgeData>(revisionId, new EdgeData(EdgeType.Contains, null)));
            // Store the snapshots root as the last operation of backup
            destination.SetNode(Constants.SnapshotsNodeId, snapshotsNode);
        }
Example #5
0
        internal void Archive(Guid revisionId, INodeProvider <Guid, object, EdgeData> source, INodeProvider <Guid, object, EdgeData> destination)
        {
            foreach (var item in destination.EnumerateNodes())
            {
                throw new ArgumentException("Destination provider must be empty");
            }

            var visitedNodes = new Hashtable();

            // Create types
            AddNodesRecursive(Constants.TypesNodeId, source, destination, visitedNodes);

            // Copy snapshot
            AddNodesRecursive(revisionId, source, destination, visitedNodes);

            // Create snapshots root
            var snapshotsNode = new Node <Guid, object, EdgeData>(NodeType.SnapshotsRoot, null);

            // Create link to the snapshot
            snapshotsNode.AddEdge(new Edge <Guid, EdgeData>(revisionId, new EdgeData(EdgeType.Contains, null)));
            // Store the snapshots root as the last operation of backup
            destination.SetNode(Constants.SnapshotsNodeId, snapshotsNode);
        }
        /// <summary>
        /// Returns node enumeration containing all nodes
        /// </summary>
        /// <returns>Nodes identifiers</returns>
        public IEnumerable EnumerateNodes()
        {
            rwLock.AcquireReaderLock(-1);
            try
            {
                Collection <TIdentifier> items = new Collection <TIdentifier>();

                foreach (TIdentifier item in cacheProvider.EnumerateNodes())
                {
                    items.Add(item);
                }

                foreach (TIdentifier item in parentProvider.EnumerateNodes())
                {
                    items.Add(item);
                }

                return(items);
            }
            finally
            {
                rwLock.ReleaseLock();
            }
        }
Example #7
0
 /// <summary>
 /// Returns node enumeration containing changed nodes
 /// </summary>
 /// <returns>Nodes identifiers</returns>
 public IEnumerable EnumerateChanges()
 {
     CheckThread();
     return(isolatedProvider.EnumerateNodes());
 }
Example #8
0
 /// <summary>
 /// Returns node enumeration containing all nodes in the provider
 /// </summary>
 /// <returns>Nodes identifiers</returns>
 public IEnumerable EnumerateNodes()
 {
     CheckThread();
     return(parentProvider.EnumerateNodes());
 }