コード例 #1
0
        /// <exception cref="ChainscriptException">
        ///  </exception>
        public LinkBuilder(string process, string mapId)
        {
            if (String.IsNullOrEmpty(process))
            {
                throw new ChainscriptException(Error.LinkProcessMissing);
            }

            if (String.IsNullOrEmpty(mapId))
            {
                throw new ChainscriptException(Error.LinkMapIdMissing);
            }

            Stratumn.Chainscript.Proto.Process processObj = new Stratumn.Chainscript.Proto.Process
            {
                Name = process
            };

            Stratumn.Chainscript.Proto.LinkMeta linkMeta = new Stratumn.Chainscript.Proto.LinkMeta
            {
                ClientId  = Constants.ClientId,
                MapId     = mapId,
                OutDegree = -1,
                Process   = processObj
            };

            this.link = new Stratumn.Chainscript.Proto.Link
            {
                Version = Constants.LINK_VERSION,
                Meta    = linkMeta
            };
        }
コード例 #2
0
        public Segment(Stratumn.Chainscript.Proto.Segment pbSegment)
        {
            if (pbSegment.Link == null)
            {
                throw new ChainscriptException(Error.LinkMissing);
            }

            this.pbLink    = pbSegment.Link;
            this.pbSegment = pbSegment;

            if (pbSegment.Meta == null)
            {
                this.pbSegment.Meta = new Stratumn.Chainscript.Proto.SegmentMeta();
            }

            Link link = new Link(this.pbLink);

            this.pbSegment.Meta.LinkHash = ByteString.CopyFrom(link.Hash());
        }
コード例 #3
0
ファイル: Link.cs プロジェクト: step-stp/csharp-chainscript
 /// <param name="link"> </param>
 public Link(Stratumn.Chainscript.Proto.Link link)
 {
     this.ALink = link;
 }