Giter VIP home page Giter VIP logo

megahttp's People

Contributors

vozhyk- avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

megahttp's Issues

Implement status page

http://localhost:8080/status/

Show some status information:

  • Current downloads
  • Memory usage
  • Accounts logged into
  • Current configuration

Support downloading files bigger than memory

Currently, megahttp allocates memory for the whole file. This will result in bad things happening when trying to download files too big to allocate.

What needs to be done is:

  • separate buffer functionality from file_cache_item into file_buffer
  • split all files into blocks
    • use a block_size parameter
    • determine which block the requested range belongs to in file_buffer when chunk requested or stored
  • rename file_cache_item -> cached_file
  • change file_buffer structure to:
    • (from buffer = vector<char>)
    • buffer = map(chunk_number -> file_buffer::block)
    • change cached_file.get_chunk to copy data instead of returning its address
      • rename to get_data
    • levels of abstraction:
      • GC should manipulate blocks
      • downloads / responses should manipulate ranges
  • garbage collector should be called on block allocation instead of file allocation
  • garbage collector should search all blocks
    • some blocks should be protected from deletion
      • protect [response_callback.position .. response_callback.download.position) (โˆ€ response_callbacks serving the file)
        • every response_callback should have its own download
          • downloads should start MEGA downloads for missing pieces and skip pieces already in cache
            • cached_files should track which ranges are downloaded and which are protected from GC
              • make a range class
          • pause downloads which have gone too far from the response (so that they don't prevent a lot of memory to be released and don't download unnecessarily)
    • (optimization for after this bug) sort blocks (to be deleted) from unused files from tail of file to head of file (instead of least-recently-used first)
  • empty (no chunks downloaded/allocated in buffer) unused cached_files should be deleted

WIP on branch big_files

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.