Ejemplo n.º 1
0
        public NodeStateTable <TOutput> UpdateStateTable(DriverStateTable.Builder builder, NodeStateTable <TOutput> previousTable, CancellationToken cancellationToken)
        {
            // grab the source inputs
            var sourceTable = builder.GetLatestStateTableForNode(_sourceNode);

            if (sourceTable.IsCached)
            {
                if (builder.DriverState.TrackIncrementalSteps)
                {
                    return(previousTable.CreateCachedTableWithUpdatedSteps(sourceTable, _name));
                }
                return(previousTable);
            }

            // Semantics of a transform:
            // Element-wise comparison of upstream table
            // - Cached or Removed: no transform, just use previous values
            // - Added: perform transform and add
            // - Modified: perform transform and do element wise comparison with previous results

            var newTable = builder.CreateTableBuilder(previousTable, _name);

            foreach (var entry in sourceTable)
            {
                var inputs = newTable.TrackIncrementalSteps ? ImmutableArray.Create((entry.Step !, entry.OutputIndex)) : default;
Ejemplo n.º 2
0
        public NodeStateTable <TOutput> UpdateStateTable(DriverStateTable.Builder graphState, NodeStateTable <TOutput> previousTable, CancellationToken cancellationToken)
        {
            string stepName    = Kind == IncrementalGeneratorOutputKind.Source ? WellKnownGeneratorOutputs.SourceOutput : WellKnownGeneratorOutputs.ImplementationSourceOutput;
            var    sourceTable = graphState.GetLatestStateTableForNode(_source);

            if (sourceTable.IsCached)
            {
                if (graphState.DriverState.TrackIncrementalSteps)
                {
                    return(previousTable.CreateCachedTableWithUpdatedSteps(sourceTable, stepName));
                }
                return(previousTable);
            }

            var nodeTable = graphState.CreateTableBuilder(previousTable, stepName);

            foreach (var entry in sourceTable)
            {
                var inputs = nodeTable.TrackIncrementalSteps ? ImmutableArray.Create((entry.Step !, entry.OutputIndex)) : default;