예제 #1
0
        public async Task <BinaryUploadStream> OpenUploadStreamAsync(string id)
        {
            var(success, stream) =
                await BinaryUploadStream.OpenAsync(_maps, _chunks, _maxChunkLenght, id, _nrwl);

            return(success ? stream : throw new MdbfsDuplicateKeyException("Document with specified ID already exists"));
        }
예제 #2
0
        public async Task <BinaryUploadStream> OpenUploadStreamAsync()
        {
            var(success, stream) =
                await BinaryUploadStream.OpenAsync(_maps, _chunks, _maxChunkLenght, null, _nrwl);

            return(success ? stream : null);
        }
예제 #3
0
 public FileUploadStream(BinaryUploadStream bus, IMongoCollection <Element> elements, Element file)
 {
     _bus         = bus;
     _elements    = elements;
     _file        = file;
     _file.ID     = bus.Id;
     _file.Opened = DateTime.Now;
 }
예제 #4
0
 public override void Flush()
 {
     if (_bus != null)
     {
         _bus.Flush();
         Element = _file;
         _elements.InsertOne(Element);
         _bus = null;
     }
 }
예제 #5
0
        public new async Task FlushAsync()
        {
            if (_bus != null)
            {
                await _bus.FlushAsync();

                await _elements.InsertOneAsync(_file);

                _bus = null;
            }
        }
예제 #6
0
 public BinaryUploadStream OpenUploadStream()
 {
     var(success, stream) =
         BinaryUploadStream.Open(_maps, _chunks, _maxChunkLenght, null, _nrwl);
     return(success ? stream : null);
 }