Example #1
0
        public override void Commit(ulong height)
        {
            base.Commit();
            if (State == TrackState.None)
            {
                return;
            }
            var wbt = new WriteBatchTask();

            wbt.tableid = prefix;
            wbt.key     = null;
            wbt.value   = new MongoDB.Bson.BsonBinaryData(Item.ToArray());
            wbt.state   = (byte)State;
            wbt.height  = height;
            MongoDBHelper.InsertOne(Settings.Default.MongoSetting["Conn"], Settings.Default.MongoSetting["DataBase"], "Test", wbt);
        }
Example #2
0
        public override void Commit(ulong height)
        {
            base.Commit();
            WriteBatchTask wbt;

            foreach (var i in  this.dictionary.Values)
            {
                if (i.State == TrackState.None)
                {
                    continue;
                }
                wbt           = new WriteBatchTask();
                wbt.tableid   = prefix;
                wbt.key       = new MongoDB.Bson.BsonBinaryData(i.Key.ToArray());
                wbt.value     = new MongoDB.Bson.BsonBinaryData(i.Item.ToArray());
                wbt.valuehash = new MongoDB.Bson.BsonBinaryData(Cryptography.Crypto.Default.Hash256(i.Item.ToArray()));
                wbt.state     = (byte)i.State;
                wbt.height    = height;
                MongoDBHelper.InsertOne(Settings.Default.MongoSetting["Conn"], Settings.Default.MongoSetting["DataBase"], "Test", wbt);
            }
        }