public CustomQueryCompiler(
            IQueryContextFactory queryContextFactory,
            ICompiledQueryCache compiledQueryCache,
            ICompiledQueryCacheKeyGenerator compiledQueryCacheKeyGenerator,
            IDatabase database,
            IDiagnosticsLogger <DbLoggerCategory.Query> logger,
            ICurrentDbContext currentContext,
            IQueryModelGenerator queryModelGenerator,
            IEvaluatableExpressionFilter evaluableExpressionFilter)
            : base(queryContextFactory, compiledQueryCache, compiledQueryCacheKeyGenerator, database, logger, currentContext, queryModelGenerator)
        {
            Check.NotNull(queryContextFactory, nameof(queryContextFactory));
            Check.NotNull(compiledQueryCache, nameof(compiledQueryCache));
            Check.NotNull(compiledQueryCacheKeyGenerator, nameof(compiledQueryCacheKeyGenerator));
            Check.NotNull(database, nameof(database));
            Check.NotNull(logger, nameof(logger));
            Check.NotNull(currentContext, nameof(currentContext));
            Check.NotNull(evaluableExpressionFilter, nameof(evaluableExpressionFilter));

            _queryModelGenerator = queryModelGenerator;

            _cacheProvider = currentContext.Context.GetService <ICacheProvider>();

            _xxHash = xxHashFactory.Instance.Create(new xxHashConfig()
            {
                HashSizeInBits = 64
            });
        }
示例#2
0
 public XxHashAlgorithm()
 {
     algorithm = xxHashFactory.Instance.Create(new xxHashConfig
     {
         HashSizeInBits = 64
     });
 }
        public FsStorageManager(ILogger <FsStorageManager> logger, IConfiguration conf, IxxHash hashprovider)
        {
            Configuration = conf;
            Logger        = (Logger <FsStorageManager>)logger;
            HashFunction  = hashprovider;

            Logger.LogInformation("File System Storage initiated and ready... Using Cache Dir: {CacheBasePath}, Cache Elements Dir: {CacheElementsBasePath}", CacheBasePath, CacheElementsBasePath);
        }
示例#4
0
        public void GlobalSetup()
        {
            var path = Path.GetDirectoryName(typeof(StringHash).GetTypeInfo().Assembly.Location);

            path = Path.Combine(path, "Files", "JEOPARDY_CSV.csv");

            List <byte[]> list = new();

            using var reader = new StreamReader(path);
            using var csv    = new CsvReader(reader, CultureInfo.InvariantCulture);
            csv.Read();
            csv.ReadHeader();
            StringBuilder stringBuilder = new StringBuilder();

            while (csv.Read())
            {
                var str = csv.GetField <string>(6);
                stringBuilder.Append(" " + str);
                list.Add(Encoding.UTF8.GetBytes(str));
            }
            _sentences = list.ToArray();
            _longText  = Encoding.UTF8.GetBytes(stringBuilder.ToString());

            list.Clear();
            path = Path.GetDirectoryName(typeof(StringHash).GetTypeInfo().Assembly.Location);
            using var streamReader = new StreamReader(new FileStream(Path.Combine(path, "Files", "words.txt"), FileMode.Open));
            while (!streamReader.EndOfStream)
            {
                list.Add(Encoding.UTF8.GetBytes(streamReader.ReadLine() ?? ""));
            }

            _words = list.ToArray();

            _sha1 = System.Data.HashFunction.HashAlgorithm.HashAlgorithmWrapperFactory.Instance.Create(
                new HashAlgorithmWrapperConfig()
            {
                InstanceFactory = SHA1.Create
            });
            _md5 = System.Data.HashFunction.HashAlgorithm.HashAlgorithmWrapperFactory.Instance.Create(
                new HashAlgorithmWrapperConfig()
            {
                InstanceFactory = MD5.Create
            });
            _sha512 = System.Data.HashFunction.HashAlgorithm.HashAlgorithmWrapperFactory.Instance.Create(
                new HashAlgorithmWrapperConfig()
            {
                InstanceFactory = SHA512.Create
            });

            _blake2   = System.Data.HashFunction.Blake2.Blake2BFactory.Instance.Create();
            _city     = System.Data.HashFunction.CityHash.CityHashFactory.Instance.Create();
            _fnv1     = System.Data.HashFunction.FNV.FNV1Factory.Instance.Create();
            _fnv1A    = System.Data.HashFunction.FNV.FNV1aFactory.Instance.Create();
            _jenkins3 = System.Data.HashFunction.Jenkins.JenkinsLookup3Factory.Instance.Create();
            _murmur3  = System.Data.HashFunction.MurmurHash.MurmurHash3Factory.Instance.Create();
            _pearson  = System.Data.HashFunction.Pearson.PearsonFactory.Instance.Create();
            _xxHash   = System.Data.HashFunction.xxHash.xxHashFactory.Instance.Create();
        }
示例#5
0
        private void ComputeXxHash()
        {
            IxxHash xxHash = xxHashFactory.Instance.Create();

            byte[]     file      = File.ReadAllBytes(Path);
            IHashValue hashValue = xxHash.ComputeHash(file);

            Hash = hashValue.AsHexString(false);
        }
 public AttachmentsService(IAttachmentsRepository repository)
 {
     _repository     = repository;
     _xxHashInstance = xxHashFactory.Instance.Create();
 }
示例#7
0
 public XXHash64()
 {
     xx = xxHashFactory.Instance.Create(new xxHashConfig {
         HashSizeInBits = 64
     });
 }
        public xxHasher()
        {
            xxHashConfig XxHashConfig = this.CreatexxHashConfig();

            this.hasher = xxHashFactory.Instance.Create(XxHashConfig);
        }