Esempio n. 1
0
        public StorageManager(IRocksDbContext rocksDbContext)
        {
            var versionIndexer = new VersionRepository(rocksDbContext);

            _versionFactory = new VersionFactory(versionIndexer.GetVersion(0));
            foreach (var repository in Enum.GetValues(typeof(RepositoryType)).Cast <RepositoryType>())
            {
                _repositoryManagers[(uint)repository] = new RepositoryManager(
                    (uint)repository, rocksDbContext, _versionFactory, versionIndexer
                    );
            }
        }
Esempio n. 2
0
        public RepositoryManager(
            uint repositoryId,
            IRocksDbContext dbContext,
            VersionFactory versionFactory,
            VersionRepository versionRepository
            )
        {
            _repositoryId      = repositoryId;
            _dbContext         = dbContext;
            _versionFactory    = versionFactory;
            _versionRepository = versionRepository;
            var storageContext = new NodeRepository(dbContext);

            TrieMap       = new TrieHashMap(storageContext, versionFactory);
            LatestVersion = _versionRepository.GetVersion(_repositoryId);
        }
Esempio n. 3
0
        public HttpResponseMessage GetVersion([FromBody] AppVersionsDto appVersion)
        {
            int results = 0;

            try
            {
                CommonResponse commonResponse = new CommonResponse();
                VersionResults versionResults = new VersionResults();

                DataTable item = VersionRepository.GetVersion();

                if (item != null)
                {
                    int val1 = VersionValue(item.Rows[0]["AppVersion"].ToString());
                    int val2 = VersionValue(appVersion.AppVersion.ToString());
                    results = VersionItem(val1, val2);

                    versionResults.values     = results;
                    versionResults.apiMessage = appmessage.versionSuccessfully;
                    commonResponse.status     = true;
                    commonResponse.message    = appmessage.executedSuccessfully;
                    commonResponse.results    = versionResults;

                    var response = this.Request.CreateResponse(HttpStatusCode.OK);
                    response.Content = new StringContent(JsonConvert.SerializeObject(commonResponse, Formatting.None), Encoding.UTF8, "application/json");
                    return(response);
                }
                else
                {
                    return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "Not found"));
                }
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex));
            }
        }