{"id":21206237,"url":"https://github.com/rtmigo/linecompress_kt","last_synced_at":"2026-04-29T09:03:50.408Z","repository":{"id":61915708,"uuid":"458595926","full_name":"rtmigo/linecompress_kt","owner":"rtmigo","description":"Kotlin/JVM library for storing logs","archived":false,"fork":false,"pushed_at":"2022-10-24T00:45:32.000Z","size":209,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"staging","last_synced_at":"2025-06-21T23:03:01.988Z","etag":null,"topics":["jvm","kotlin","logs"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rtmigo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-02-12T17:45:20.000Z","updated_at":"2022-02-17T00:43:45.000Z","dependencies_parsed_at":"2023-01-20T09:27:14.842Z","dependency_job_id":null,"html_url":"https://github.com/rtmigo/linecompress_kt","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/rtmigo/linecompress_kt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rtmigo%2Flinecompress_kt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rtmigo%2Flinecompress_kt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rtmigo%2Flinecompress_kt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rtmigo%2Flinecompress_kt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rtmigo","download_url":"https://codeload.github.com/rtmigo/linecompress_kt/tar.gz/refs/heads/staging","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rtmigo%2Flinecompress_kt/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32418176,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T06:29:02.080Z","status":"ssl_error","status_checked_at":"2026-04-29T06:29:00.631Z","response_time":110,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["jvm","kotlin","logs"],"created_at":"2024-11-20T20:54:57.158Z","updated_at":"2026-04-29T09:03:50.391Z","avatar_url":"https://github.com/rtmigo.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Generic badge](https://img.shields.io/badge/CI_JVM-8-blue.svg)\n![Generic badge](https://img.shields.io/badge/CI_OS-Linux_|_Windows-blue.svg)\n![JaCoCo](https://raw.github.com/rtmigo/linecompress_kt/dev_updated_by_actions/.github/badges/jacoco.svg)\n\n# [linecompress_kt](https://github.com/rtmigo/linecompress_kt#readme) (draft)\n\nKotlin/JVM library that stores text lines in GZIP-compressed files.\n\n# Install\n\n(if you use Gradle scripts in Groovy)\n\nEdit **settings.gradle**:\n\n```groovy\n// add this:\nsourceControl {\n  gitRepository(URI.create(\"https://github.com/rtmigo/linecompress_kt.git\")) {\n    producesModule(\"io.github.rtmigo:linecompress\")\n  }\n}\n```\n\nEdit **build.gradle**:\n\n```groovy\ndependencies {\n    // add this: \n    implementation(\"io.github.rtmigo:linecompress\") { version { branch = 'staging' } }\n}    \n```\n\n\u003cdetails\u003e\n  \u003csummary\u003eOr depend on particular version\u003c/summary\u003e\n\nEdit **build.gradle**:\n\n```groovy\ndependencies {\n    // add this:     \n    implementation \"io.github.rtmigo:linecompress:0.0.1\"\n}\n```\n\n(the changes to **settings.gradle** are the same as above)\n\u003c/details\u003e\n\n# Use\n\n```kotlin\nimport java.nio.file.Paths\nimport io.github.rtmigo.linecompress.LinesDir\n\nfun main() {\n    val linesDir = LinesDir(Paths.get(\"/path/to/my/logs\"))\n\n    linesDir.add(\"Log line 1\")\n    linesDir.add(\"Log line 2\")\n    linesDir.add(\"Log line 3\")\n\n    // reading from oldest to newest \n    for (line in linesDir.readLines()) {\n        println(line)\n    }\n\n    // reading from newest to oldest \n    for (line in linesDir.readLines(reverse = true)) {\n        println(line)\n    }\n}\n```\n\n# Directory structure\n\n```\n000/000/000.txt.gz \n000/000/001.txt.gz \n000/000/002.txt.gz \n...\n000/000/999.txt.gz \n000/001/000.txt.gz\n...\n000/001/233.txt.gz \n000/001/234.txt \n```\n\nThe last file is a \"buffer\". It contains lines added recently. When it gets big enough, it will be\nautomatically compressed.\n\n# Limitations\n\nBy default, a directory contains up to a billion files, each 1 megabyte in size. Thus, the maximum\ntotal storage size is **one decimal petabyte**. This is about **uncompressed data**. The space used\non disk will be smaller.\n\nBy changing the value of the `subdirs` argument, we change the maximum number of files: an increase\nin `subdirs` by one means an increase in the number of files by a thousand times.\n\nWith the default file size 1MB we get the following limits:\n\n| subdirs     | file path            | max sum size |\n|-------------|----------------------|--------------|\n| `subdirs=0` | `000.gz`             | gigabyte     |\n| `subdirs=1` | `000/000.gz`         | terabyte     |\n| `subdirs=2` | `000/000/000.gz`     | petabyte     |\n| `subdirs=3` | `000/000/000/000.gz` | exabyte      |\n\nAdjusting the limits:\n\n```kotlin\nval giga = LinesDir(Paths.get(\"/max/1_gigabyte\"), subdirs = 1)\nval peta = LinesDir(Paths.get(\"/max/1_petabyte\"))  // 2 is the default\nval exa = LinesDir(Paths.get(\"/max/1_exabyte\"), subdirs = 3)\n```\n\nThe file size can also be adjusted.\n\n```kotlin\nval peta1 = LinesDir(Paths.get(\"/max/1_petabyte\"))\n\n// setting the size of each file to 5 megabytes\nval peta5 = LinesDir(Paths.get(\"/max/5_petabytes\", bufferSize = 5 * 1000 * 1000))\n```\n\n* With larger files, we get better compression and less load on the file system\n* With smaller files, we're much more efficient at iterating through lines in reverse order. The\n  moment of compressing a .txt buffer into a .txt.gz archive is also faster\n\n# See also\n\n* [linecompress_py](https://github.com/rtmigo/linecompress_py) – Python library","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frtmigo%2Flinecompress_kt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frtmigo%2Flinecompress_kt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frtmigo%2Flinecompress_kt/lists"}