示例#1
0
 /// <summary>
 /// Instantiates the ReadQueueManager
 /// </summary>
 /// <param name="myWriteQueueLock">hold all position which are currently not written from WriteQueueManager</param>
 public ReadQueueManager(WriteQueueLock myWriteQueueLock)
 {
     _WriteQueueLock        = myWriteQueueLock;
     GraphFSFileStream    = null;
     ShutdownReaderThread   = false;
     _ReadQueue             = new List<QueueEntry>();
     _ReaderThread          = new Thread(new ThreadStart(ReadQueueThread));
     _ReaderThread.Name     = "ReadQueueManager.ReadQueueThread()";
     _ReaderThread.Priority = ThreadPriority.Highest;
     _ReaderThread.Start();
 }
示例#2
0
 /// <summary>
 /// Instantiates the ReadQueueManager and attaches the given FileStream
 /// </summary>
 /// <param name="myInputFileStream">the FileStream for reading and writing</param>
 /// <param name="myWriteQueueLock">hold all position which are currently not written from WriteQueueManager</param>
 public ReadQueueManager(FileStream myInputFileStream, WriteQueueLock myWriteQueueLock)
     : this(myWriteQueueLock)
 {
     SetFileStream(myInputFileStream);
 }
示例#3
0
 /// <summary>
 /// Instantiates the WriteQueueManager and attaches the given FileStream
 /// </summary>
 /// <param name="myInputFileStream">the FileStream for reading and writing</param>
 /// <param name="myWriteQueueLock">hold all position which are currently not written from WriteQueueManager</param>
 public WriteQueueManager(FileStream myInputFileStream, WriteQueueLock myWriteQueueLock)
     : this(myWriteQueueLock)
 {
     // First do the normal stuff!
     SetFileStream(myInputFileStream);
 }
示例#4
0
        public override Boolean AttachStorage(String myStorageLocation)
        {
            lock (this)
            {

                if (_FileStream == null)
                {

                        _StorageLocation    = myStorageLocation;
                    var _ImageFileLocation  = GetImageFileLocation(myStorageLocation);

                    _WriteQueueLock         = new WriteQueueLock();
                    _FileStream             = new FileStream(_ImageFileLocation, FileMode.Open);
                    _ReadQueue              = new ReadQueueManager(_WriteQueueLock);
                    _WriteQueue             = new WriteQueueManager(_WriteQueueLock);

                    _ReadQueue.SetFileStream(_FileStream);
                    _WriteQueue.SetFileStream(_FileStream);

                    // Configure the ByteCache
                    if (_ByteCacheSettings == null)
                        _ByteCacheSettings = new CacheSettings()
                            {
                                TimerDueTime                 = TimeSpan.FromSeconds(3),
                                TimerPeriod                  = TimeSpan.FromSeconds(120),
                                AbsoluteExpirationTimeSpan   = TimeSpan.FromSeconds(120),
                                ExpirationType               = ExpirationTypes.Absolute
                            };

                    _ByteCache = new ByteCache("<FileStorage> " + _StorageLocation, _ByteCacheSettings);

                    _WriteQueue.NotificationDispatcher = _NotificationDispatcher;
                    _WriteQueue.OnFlushSucceeded += new FlushSucceededHandler(WriteQueue_OnFlushSucceeded);

                    return true;

                }

                return false;

            }
        }