示例#1
0
文件: Store.cs 项目: skyiah/skychain
        internal static void InitializeStore(JObj storecfg)
        {
            // create db source
            dbSource = new DbSource(storecfg);

            // create self peer info
            self = new Peer(storecfg)
            {
            };

            // load  peer connectors
            //
            using var dc = NewDbContext();
            dc.Sql("SELECT ").collst(Peer.Empty).T(" FROM peers_ WHERE state > 0");
            var arr = dc.Query <Peer>();

            if (arr != null)
            {
                foreach (var peer in arr)
                {
                    var cli = new FedClient(peer);

                    okayed.TryAdd(cli.Key, cli);

                    // init current block id
                    // await o.PeekLastBlockAsync(dc);
                }
            }

            // start the puller thead
            puller = new Thread(Replicate)
            {
                Name = "Block Puller"
            };
            puller.Start();
        }
示例#2
0
 internal LdgrContext(FedClient connector)
 {
     this.connector = connector;
 }