Coder Social home page Coder Social logo

gifs's People

Contributors

tangentfoxy avatar

Watchers

 avatar  avatar  avatar

gifs's Issues

Redo

  • Start over with the latest API.
  • Make the system capable of writing files across multiple drives if needed.
  • Optimization modes, one that tries to fill disks, one that tries to keep disks empty, one that tries to keep files from going across multiple disks? Not exactly sure about that.
  • Stripe disks? :P This is mostly an idea as a joke? This is a package symbol: ๐Ÿ“ฆ
  • Ultimately I want plug n play disk handling.
  • It would be cool to support automatic file duplication for backups. Imagine being able to easily hot-swap when needed and not lose anything.
  • Remember lume.uuid? Use that for identifying files and disks, instead of the numbering system I was using? Maybe that should be optional. Numbers saves disk space, hashes keep things from conflicting. IDK.
  • What about compressed file systems? Or file compression offered by the filesystem?

YAY FEATURE CREEP! :D

API list

Until I can figure out how to process events properly, every method in the API should first call a method to check if a drive has been plugged in, or a drive removed (or if the tree exists). If a drive has been removed, the whole directory tree needs to be rebuilt (add a function to make this unneeded if possible! call a function before removing a drive to remove its entries). If a drive has been added, its contents need to be added to the tree. Note that removing or adding a drive also needs to re-calculate free space of the system.

Internal

  • something to loop through a loaded tree
  • the function(s) needed above
  • something to save or load a tree

Note that free space and used space are not stored. Instead, when a disk is loaded, they are calculated and saved temporarily for each disk (as well as a master free/used space). The file size of the index for each disk is part of this calculation, plus 1024 bytes assumed for expansion of the index file.

  • any time a file is updated, moved, deleted, whatever, the index should be updated, and free space and such re-calculated!
  • make sure to account for a trailing slash on a directory name (but not a file name! also don't allow files to be written with a trailing slash!)
  • account for allowing forward or backward slashes ONLY if fs supports it

From fs API

  • list(string path)
    • for loop through loaded table to find if specified path is directory, return its contents in an alphabetically ordered table (ex: {"abc", "abd", "bed"}), else return empty table
  • exists(string path)
    • for loop through loaded table, find if specified file or directory exists, return true/false
  • isDir(string path)
    • for loop through, find if directory, return true/false (if not exist, return false)
    • note: probably want to change this to return true unless a file exists there, because any directory can exist anywhere as far as GIFS is concerned
  • isReadOnly(string path)
    • (mostly) dummy fn for API compatibility, returns false unless path is root ("" or "/"), in which case, true (see API docs for CC)
  • getName(string path)
    • passes straight through to fs API (we do not need to change it)
  • getDrive(string path)
    • uses raw() to get actual file location, then passes to fs API to find what drive it is on
  • getSize(string path)
    • uses raw() to get actual file location, then passes to fs API
  • getFreeSpace(string path)
    • doesn't actually accept an argument, returns a pre-calculated free space (any time we write data or accept or remove a disk, the total free space is calculated!)
  • makeDir(string path)
    • for loop through table, creating entries if needed, and eventually making an empty directory where specified (or, if I go through with the other idea, nothing happens, dummy fn)
    • note: this isn't recommended(?), as GIFS doesn't care about directories, any directory exists as far as it is concerned, because anything can exist anywhere at any time (I might change this, I have to consider which disks empty directories are stored on...)
  • move(string from, string to)
    • check that the first exists, check that the second doesn't exist, then move the first to the second (if checks fail, error? need to verify that we're supposed to error here)
    • remember to update files on physical disk(s) and update free space (actually, it shouldn't need an update)
  • copy(string from, string to)
    • works just like move, except the original is kept intact (implement this first and extend it to make move!)
    • remember to update files on physical disk(s) and update free space!
  • delete(string path)
    • if exists, delete, else, nothing
    • note: remember that we need to delete the files on the disk and update free space!
  • combine(string basePath, string localPath)
    • passes straight through to fs, we don't need to care about it
  • open(string path, string mode)
  • find(string wildcard)
  • getDir(string path)
    • assuming this doesn't need to care about existence, pass straight through!
    • else, return the directory of the specified dir/path (this is the other component to getName basically)
  • fs.complete(string file/directory, string parent folder, [bool include files], [bool include slashes])
    • returns table completion list
    • DO NOT IMPLEMENT IN v0.1

Additional

  • raw(string path)
    • for loop through to find specified directory/file, return its actual location as a string (this is for compatibility with other APIs if needed)
    • returns nil if the raw path can't be found (or if the file is a GIFS composite file when I create that concept..note that such files need to be allowed to be used in the rest of the API, therefore, some care should be made in each fn involving files to recognize and change how they behave)

disk uuid

function lume.uuid()
  local fn = function(x)
    local r = math_random(16) - 1
    r = (x == "x") and (r + 1) or (r % 4) + 9
    return ("0123456789abcdef"):sub(r, r)
  end
  return (("xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"):gsub("[xy]", fn))
end

from lume

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.