• otl@lemmy.sdf.org
    link
    fedilink
    English
    arrow-up
    13
    ·
    1 year ago

    Devil’s advocate: what about the posts and comments I’ve made via Lemmy? They could be presented as files (like email). I could read, write and remove them. I could edit my comments with Microsoft Word or ed. I could run some machine learning processing on all my comments in a Docker container using just a bind mount like you mentioned. I could back them up to Backblaze B2 or a USB drive with the same tools.

    But I can’t. They’re in a PostgreSQL database (which I can’t query), accessible via a HTTP API. I’ve actually written a Lemmy API client, then used that to make a read-only file system interface to Lemmy (https://pkg.go.dev/olowe.co/lemmy). Using that file system I’ve written an app to access Lemmy from a weird text editing environment I use (developed at least 30 years before Lemmy was even written!): https://lemmy.sdf.org/post/1035382

    More ideas if you’re interested at https://upspin.io

    • eluvatar@programming.dev
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 year ago

      That makes sense. I think the reason why they’re not represented as files is pretty simple. Data integrity. If you want to get the comments you just query the table and as long as the DB schema is what you expect then it’ll work just fine and you don’t have to validate that the data hasn’t been corrupted (you don’t have to check that a column exists for example). But with files, every single file you need to parse and validate because another application could have screwed them up. It’s certainly possible to build this, it might be slower but computers are pretty fast these days, but it would require more work to develop to solve the problem that the database solves for you.