示例#1
0
        public Stream CreateContent(string sigName)
        {
            var sigFileName = NameToPath(sigName);

            var signatureDirectory = Path.GetDirectoryName(sigFileName);

            IOExtensions.CreateDirectoryIfNotExists(signatureDirectory);

            var result = File.Create(sigFileName, 64 * 1024);

            log.Info("File {0} created", sigFileName);
            _createdFiles.Add(sigFileName, result);
            return(result);
        }
        public GenericDiskPerformanceTester(GenericPerformanceTestRequest testRequest, Action <string> onInfo, CancellationToken taskKillToken = new CancellationToken()) : base(testRequest, onInfo, taskKillToken)
        {
            IOExtensions.CreateDirectoryIfNotExists(testRequest.Path);
            filePath        = Path.Combine(testRequest.Path, TemporaryFileName);
            threads         = new List <Thread>(testRequest.ThreadCount);
            perThreadRandom = Enumerable.Range(1, testRequest.ThreadCount)
                              .Select(i => testRequest.RandomSeed.HasValue ? new Random(testRequest.RandomSeed.Value) : new Random()).ToList();

            if (testRequest.Sequential && testRequest.OperationType == OperationType.Mix)
            {
                onInfo("Sequential test with mixed read/write mode is not supported. Changing to random access");
                testRequest.Sequential = false;
            }
        }
示例#3
0
        private void CheckDirectoryPermissions()
        {
            var tempPath     = Core.TempPath;
            var tempFileName = Guid.NewGuid().ToString("N");
            var tempFilePath = Path.Combine(tempPath, tempFileName);

            try
            {
                IOExtensions.CreateDirectoryIfNotExists(tempPath);
                File.WriteAllText(tempFilePath, string.Empty);
                File.Delete(tempFilePath);
            }
            catch (Exception e)
            {
                throw new InvalidOperationException(string.Format("Could not access temp path '{0}'. Please check if you have sufficient privileges to access this path or change 'Raven/TempPath' value.", tempPath), e);
            }
        }
 public BatchDiskPerformanceTester(BatchPerformanceTestRequest testRequest, Action <string> onInfo, CancellationToken token = new CancellationToken()) : base(testRequest, onInfo, token)
 {
     IOExtensions.CreateDirectoryIfNotExists(testRequest.Path);
     filePath    = Path.Combine(testRequest.Path, TemporaryFileName);
     journalPath = Path.Combine(testRequest.Path, TemporaryJournalFileName);
 }