Example #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Dependency" /> class.
        /// </summary>
        /// <param name="kind">The kind of dependency. It can be a recipe or an plugin. (required).</param>
        /// <param name="name">Workflow name. This name should be unique among all the resources in your resource. Use an alias if this is not the case. (required).</param>
        /// <param name="tag">Tag of the resource. (required).</param>
        /// <param name="source">URL to a repository where this resource can be found. (required).</param>
        /// <param name="annotations">An optional dictionary to add annotations to inputs. These annotations will be used by the client side libraries..</param>
        /// <param name="hash">The digest hash of the dependency when retrieved from its source. This is locked when the resource dependencies are downloaded..</param>
        /// <param name="alias">An optional alias to refer to this dependency. Useful if the name is already used somewhere else..</param>
        public Dependency
        (
            DependencyKind kind, string name, string tag, string source,                                     // Required parameters
            Dictionary <string, string> annotations = default, string hash = default, string alias = default // Optional parameters
        ) : base()                                                                                           // BaseClass
        {
            this.Kind = kind;
            // to ensure "name" is required (not null)
            this.Name = name ?? throw new ArgumentNullException("name is a required property for Dependency and cannot be null");
            // to ensure "tag" is required (not null)
            this.Tag = tag ?? throw new ArgumentNullException("tag is a required property for Dependency and cannot be null");
            // to ensure "source" is required (not null)
            this.Source      = source ?? throw new ArgumentNullException("source is a required property for Dependency and cannot be null");
            this.Annotations = annotations;
            this.Hash        = hash;
            this.Alias       = alias;

            // Set non-required readonly properties with defaultValue
            this.Type = "Dependency";
        }
Example #2
0
        public void AddDependency(CSharpReloadableInput input, DependencyKind kind)
        {
            if (input.OriginalIdentifier == this.ThisDependencyNode.Input.OriginalIdentifier)
            {
                Logger.LogDebug("Not adding dependency to self: {OriginalIdentifier}", input.OriginalIdentifier);
                return;
            }

            var existingNode = DependencyNodes.FirstOrDefault(x => x.Input == input);

            if (existingNode == null)
            {
                existingNode = new DependencyNode {
                    Input = input
                };
                DependencyNodes.Add(existingNode);
            }

            if (!ThisDependencyNode.Dependencies.Contains(existingNode))
            {
                ThisDependencyNode.Dependencies.Add(existingNode);
            }
        }
Example #3
0
 public DependencyInfo(DependencyKind kind, object source) => (Kind, Source) = (kind, source);
 protected DependencyBase(Dataflow host, Action <Task> completionCallback, DependencyKind kind)
 {
     m_host = host;
     m_completionCallback = completionCallback;
     this.Kind            = kind;
 }
 public DataflowDependency(IDataflow dependentFlow, Dataflow host, DependencyKind kind, Action <Task> completionCallback = null) : base(host, completionCallback, kind)
 {
     m_dependentFlow = (Dataflow)dependentFlow;
     m_completion    = GetWrappedCompletion(this.m_dependentFlow.CompletionTask);
 }
 public BlockDependency(IDataflowBlock block, Dataflow host, DependencyKind kind, Action <Task> completionCallback = null, string displayName = null) : base(host, completionCallback, kind)
 {
     m_block            = block;
     this.m_displayName = displayName;
     m_completion       = GetWrappedCompletion(m_block.Completion);
 }
 public static DependencyKinds ToFlags(this DependencyKind kind)
 {
     return((DependencyKinds)(int)kind);
 }
Example #8
0
 public bool Add(int source, int target, DependencyKind kind, out Edge edge)
 {
     return Add(source, target, kind.ToFlags(), out edge);
 }
Example #9
0
 public Dependency(CSharpReloadableInput input, DependencyKind kind)
 {
     Input = input;
     Kinds = new[] { kind }.ToList();
 }
Example #10
0
 public bool Add(int source, int target, DependencyKind kind, out Edge edge)
 {
     return(Add(source, target, kind.ToFlags(), out edge));
 }