{"id":36823832,"url":"https://github.com/scanoss/ldb","last_synced_at":"2026-01-12T14:02:51.527Z","repository":{"id":44132581,"uuid":"279106221","full_name":"scanoss/ldb","owner":"scanoss","description":"SCANOSS LDB (Linked-list database)","archived":false,"fork":false,"pushed_at":"2025-10-22T11:03:16.000Z","size":819,"stargazers_count":13,"open_issues_count":0,"forks_count":8,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-10-22T13:09:40.444Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/scanoss.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSES/GPL-2.0-only.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2020-07-12T16:42:06.000Z","updated_at":"2025-10-22T11:03:20.000Z","dependencies_parsed_at":"2022-09-22T11:03:36.091Z","dependency_job_id":"4bac9868-25c9-41e5-b370-cc6123443f0e","html_url":"https://github.com/scanoss/ldb","commit_stats":null,"previous_names":[],"tags_count":27,"template":false,"template_full_name":null,"purl":"pkg:github/scanoss/ldb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scanoss%2Fldb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scanoss%2Fldb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scanoss%2Fldb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scanoss%2Fldb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/scanoss","download_url":"https://codeload.github.com/scanoss/ldb/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scanoss%2Fldb/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28340234,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T12:22:26.515Z","status":"ssl_error","status_checked_at":"2026-01-12T12:22:10.856Z","response_time":98,"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":[],"created_at":"2026-01-12T14:02:51.288Z","updated_at":"2026-01-12T14:02:51.429Z","avatar_url":"https://github.com/scanoss.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LDB Database\n\nThe LDB (Linked-list database) is a headless database management system focused in single-key, read-only application on vast amounts of data, while maintaining a minimal footprint and keeping system calls to a bare minimum. Information is structured using linked lists. \n\n# Build and Install\n\n## Prerequisites\nBuilding LDB requires libgcrypt and zlib. Make sure packages `zlib1g-dev` and `libgcrypt-dev` are installed.\n\n## Build\nRun `make all` to build the shell binary and the shared library.\n\n## Install\nRun `make install` to copy the binary to `/usr/bin`, the shared library to `/usr/lib` and the header to `/usr/include`.\n\n## Run test\nRun `./run_test.sh` to test the ldb binary.\n\n# Features\n\nSome of the features of the LDB are:\n \n* Single, fixed size, numeric key (32-bit)\n* Single-field records\n* Larger keys also are supported by storing exceeded data keys in the data record.\n* No indexing: Mapping\n* Data tables define either fixed or variable-length data records\n* Read-only\n* Database updates are performed in a single-threaded, non-disruptive batch operation\n* Zlib data compression\n* Data records are organized in a linked list\n* C library for native development\n* LDB shell allows interaction with external languages\n\n## LDB Shell Commands\n\n```\ncreate database DBNAME\n    Creates an empty database\n\ncreate table DBNAME/TABLENAME keylen N reclen N\n    Creates an empty table in the given database with\n    the specified key length (\u003e= 4) and record length (0=variable)\n\nshow databases\n    Lists databases\n\nshow tables from DBNAME\n    Lists tables from given database\n\nbulk insert DBNAME/TABLENAME from PATH with (CONFIG)\n    Imports data from PATH into the specified db/table. If PATH is a directory, its files will be recursively imported.\n    TABLENAME is optional and will be derived from the directory name's file if not specified.\n\n    (CONFIG) is a configuration string with the following format:\n        (FILE_DEL=1/0,KEYS=N,MZ=1/0,WFP=1/0,OVERWRITE=1/0,SORT=1/0,FIELDS=N,VALIDATE_FIELDS=1/0,VALIDATE_VERSION=1/0,VERBOSE=1/0,COLLATE=1/0,MAX_RECORD=N,TMP_PATH=/path/to/tmp)\n        \n        Where 1/0 represents \"true\" / \"false\", and N is an integer.\n        FILE_DEL: Delete file after importation is completed.\n        KEYS: Number of binary keys in the CSV file.\n        MZ: MZ file indicator.\n        WFP: WFP file indicator.\n        OVERWRITE: Overwrite the destination table. (Default: 0).\n        SORT: Sort the tuples during the import process. (Default: 1).\n        FIELDS: Number of CSV fields.\n        VALIDATE_FIELDS: Check field quantity during importation. (Default: 1).\n        VALIDATE_VERSION: Validate version.json.(Default: 1).\n        VERBOSE: Enable verbose mode. (Default: 0).\n        THREADS: Define the number of threads to be used during the importation process. Defaul value: half of system available.\n        COLLATE: Perform collation after import, removing data larger than MAX_RECORD bytes. (Default: 0).\n        MAX_RECORD: Maximum record size in bytes (Default value: 2048).\n        MAX_RAM_PERCENT: limit the system RAM usage during collate process. Default value: 50.\n        TMP_PATH: Path to the folder used for temporary files (default: /tmp).\n\nbulk insert DBNAME/TABLENAME from PATH\n    Imports data from PATH into the specified db/table. If PATH is a directory, its files will be recursively imported.\n    The configuration will be retrieved from the \"db.conf\" file located at \"/etc/local/scanoss/ldb/\". A default configuration file will be created if it doesn't exist.\n\ninsert into DBNAME/TABLENAME key KEY hex DATA\n    Inserts data (hex) into given db/table for the given hex key\n\ninsert into DBNAME/TABLENAME key KEY ascii DATA\n    Inserts data (ASCII) into db/table for the given hex key\n\nselect from DBNAME/TABLENAME key KEY\n    Retrieves all records from db/table for the given hex key (hexdump output)\n\nselect from DBNAME/TABLENAME key KEY ascii\n    Retrieves all records from db/table for the given hex key (ascii output)\n\nselect from DBNAME/TABLENAME key KEY csv hex N\n    Retrieves all records from db/table for the given hex key (csv output, with first N bytes in hex)\n\ndelete from DBNAME/TABLENAME max LENGTH keys KEY_LIST\n    Deletes all records for the given comma separated hex key list from the db/table. Max record length expected\n\ndelete from DBNAME/TABLENAME record CSV_RECORD\\n\"\n\tDeletes the specific CSV record from the specified table. Some field of the CSV may be skippet from the comparation using '*'\n\tExample: delete from db/url record key,madler,*,2.4,20171227,zlib,pkg:github/madler/pigz,https://github.com/madler/pigz/archive/v2.4.zip\n\tAll the records matching the all the csv's field with exception of the second thirdone will be removed.\n\ndelete from DBNAME/TABLENAME records from PATH\\\n\tSimilar to the previous command, but the records (may be more than one) will be loaded from a csv file in PATH.\n\ncollate DBNAME/TABLENAME max LENGTH\n    Collates all lists in a table, removing duplicates and records greater than LENGTH bytes\n\nmerge DBNAME/TABLENAME1 into DBNAME/TABLENAME2 max LENGTH\n    Merges tables erasing tablename1 when done. Tables must have the same configuration\n\nunlink list from DBNAME/TABLENAME key KEY\n    Unlinks the given list (32-bit KEY) from the sector map\n\ndump DBNAME/TABLENAME hex N\n    Dumps table contents with first N bytes in hex\n\ndump keys from DBNAME/TABLENAME [sector N]\n    Dumps a unique list of existing keys\n```\n## Other Uses\n\n### Update Database\n```bash\nldb -u [--update] path -n[--name] db_name -c[--collate]\n```\nCreate or update an existing database from \"path.\" If \"db_name\" is not specified, \"oss\" will be used by default. If the \"--collate\" option is present, each table will be collated during the importation process.\n\n### Process Commands from File\n```bash\nldb -f [filename]\n```\nProcess a list of commands from a file named \"filename.\"q\n\n# Using the shell\n\nThe following example explains how to create a database, a table, a record, and querying that record.\n\n```\n$ echo \"create database test\" | ldb\nOK\n$ echo \"create table test/table1 keylen 16 reclen variable\" | ldb\nOK\n$ echo \"insert into test/table1 key 26e3a3bd01585cde84408f01fe981f6a ascii THIS_IS_A_TEST\" | ldb\n$ echo \"select from test/table1 key 26e3a3bd01585cde84408f01fe981f6a\" | ldb\n0000  544849535f49535f415f54455354      THIS_IS_A_TEST  \n$ echo \"select from test/table1 key 26e3a3bd01585cde84408f01fe981f6a ascii\" | ldb\nTHIS_IS_A_TEST\n```\n\n# License\n\nThe LDB is released under the GPL 2.0 license. See the LICENSE file for more infomation.\n \nCopyright (C) 2018-2020 SCANOSS.COM\nhttp://scanoss.com\n\n\n\n\n\n\n\n\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscanoss%2Fldb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscanoss%2Fldb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscanoss%2Fldb/lists"}