コード例 #1
0
 public MerkleTreeStub(IMongoClient client, IMerkleHasher hasher, IMerkleSigner signer, IOptions <MongoDBStoreOptions> options, ILogger <MongoDBMerkleTree> logger, List <MerkleRoot> roots, List <MerkleLeaf> leaves, Dictionary <byte[], MerkleNode> nodes)
     : base(client, hasher, signer, options, logger)
 {
     Roots  = roots;
     Leaves = leaves;
     Nodes  = nodes;
 }
コード例 #2
0
        public MongoDBMerkleTree(IMongoClient client, IMerkleHasher hasher, IMerkleSigner signer, IOptions <MongoDBStoreOptions> options, ILogger <MongoDBMerkleTree> logger)
        {
            if (options is null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            _client  = client ?? throw new ArgumentNullException(nameof(client));
            _hasher  = hasher ?? throw new ArgumentNullException(nameof(hasher));
            _signer  = signer ?? throw new ArgumentNullException(nameof(signer));
            _options = options.Value;
            var db = client.GetDatabase(_options.Database);

            _roots  = db.GetCollection <MerkleRoot>("merkle_roots");
            _nodes  = db.GetCollection <MerkleNode>("merkle_nodes");
            _leaves = db.GetCollection <MerkleLeaf>("merkle_leaves");
            _logger = logger ?? throw new ArgumentNullException(nameof(logger));
            EnsureIndexes();
        }
コード例 #3
0
 public MerkleTreeVerifier(IMerkleHasher hasher, ILogger logger)
 {
     _hasher = hasher;
     _logger = logger;
 }