Esempio n. 1
0
        /// <nodoc />
        public static Xldb.Proto.Pip ToPip(this Pip pip, CachedGraph cachedGraph)
        {
            var xldbPip = new Xldb.Proto.Pip()
            {
                SemiStableHash = pip.SemiStableHash,
                PipId          = pip.PipId.Value,
            };

            foreach (var incomingEdge in cachedGraph.DirectedGraph.GetIncomingEdges(pip.PipId.ToNodeId()))
            {
                var pipType = cachedGraph.PipTable.HydratePip(incomingEdge.OtherNode.ToPipId(), Pips.PipQueryContext.Explorer).PipType;

                if (pipType != PipType.Value && pipType != PipType.HashSourceFile && pipType != PipType.SpecFile && pipType != PipType.Module)
                {
                    xldbPip.IncomingEdges.Add(incomingEdge.OtherNode.Value);
                }
            }

            foreach (var outgoingEdge in cachedGraph.DirectedGraph.GetOutgoingEdges(pip.PipId.ToNodeId()))
            {
                var pipType = cachedGraph.PipTable.HydratePip(outgoingEdge.OtherNode.ToPipId(), Pips.PipQueryContext.Explorer).PipType;

                if (pipType != PipType.Value && pipType != PipType.HashSourceFile && pipType != PipType.SpecFile && pipType != PipType.Module)
                {
                    xldbPip.OutgoingEdges.Add(outgoingEdge.OtherNode.Value);
                }
            }

            return(xldbPip);
        }
Esempio n. 2
0
 private void SerializePip(PipWriter writer, Pip pip)
 {
     pip.Serialize(writer);
     pip.PipId.Serialize(writer);
     Stats.Increment(pip, serialize: true);
 }
Esempio n. 3
0
        private async Task <bool> HandleAndReportDeserializedPipAsync(Func <PipId, Pip, Task <bool> > handleDeserializedPip, PipId pipId, Pip pip)
        {
            var result = await handleDeserializedPip(pipId, pip);

            Stats.Increment(pip, serialize: false);
            return(result);
        }