{"id":26399381,"url":"https://github.com/adoconnection/binarystore","last_synced_at":"2025-09-04T03:36:54.833Z","repository":{"id":235460426,"uuid":"790045348","full_name":"adoconnection/BinaryStore","owner":"adoconnection","description":"NET binary serializer for flat objects of fixed length, optimized for random reads and writes","archived":false,"fork":false,"pushed_at":"2024-06-12T21:44:29.000Z","size":37,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-17T13:19:38.297Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C#","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/adoconnection.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"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}},"created_at":"2024-04-22T06:59:20.000Z","updated_at":"2024-08-19T10:49:25.000Z","dependencies_parsed_at":"2024-06-13T03:41:58.434Z","dependency_job_id":null,"html_url":"https://github.com/adoconnection/BinaryStore","commit_stats":null,"previous_names":["adoconnection/binarystore"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/adoconnection/BinaryStore","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adoconnection%2FBinaryStore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adoconnection%2FBinaryStore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adoconnection%2FBinaryStore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adoconnection%2FBinaryStore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adoconnection","download_url":"https://codeload.github.com/adoconnection/BinaryStore/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adoconnection%2FBinaryStore/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273548229,"owners_count":25125253,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-04T02:00:08.968Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":"2025-03-17T13:19:40.923Z","updated_at":"2025-09-04T03:36:54.772Z","avatar_url":"https://github.com/adoconnection.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BinaryStore\nNET binary serializer optimized for random reads/writes. \u003cbr\u003e\nDatabase replacement for telemetry/sensor data or logs.\n\n* Best works for lists of fixed length objects \n* Instant reads and writes for any position in list\n* Individual records corruption does not affect others\n* 5-10x faster writes vs NewtonsoftJson\n* 2-5x faster reads vs NewtonsoftJson\n\n## NuGet\n```\ncoming soon\n```\n\n## How come?\nTarget object must be of fixed binary length (like we know int is 4 bytes)\nGiven fixed length, we can Seek stream position to read/write any record index.\nSerialization is as fast as converting value to byte array and back.\n\n\n\n## Examples\n\n```cs\npublic record Person\n{\n    public int Id { get; set; } // 4 bytes\n    public DateTime Birthday { get; set; } // 8 bytes\n\n    [BinaryStoreRecordLength(30)] // limit attribute for strings, arrays atc\n    public string FirstName { get; set; }\n\n    [BinaryStoreRecordLength(30)]\n    public string LastName { get; set; }\n}\n```\n\n### Create store and append records\n```cs\nBinaryStore\u003cPerson\u003e binaryStore = new BinaryStore\u003cPerson\u003e(stream);\n\nbinaryStore.Append(new Person()\n{\n    Id = 1,\n    FirstName = \"FirstName 1\",\n    LastName = \"LastName 1\",\n    Birthday = new DateTime(2001, 1, 1)\n});\n\nbinaryStore.Append(new Person()\n{\n    Id = 2,\n    FirstName = \"FirstName 2\",\n    LastName = \"LastName 2\",\n    Birthday = new DateTime(2002, 2, 2)\n});\n\n```\n\n\n### Read store contents:\n```cs\nConsole.WriteLine(\"Records in store: \" + binaryStore.GetRecordsCount());\n\nfor (int i = 0; i \u003c binaryStore.GetRecordsCount(); i++)\n{\n    Console.WriteLine(i + \" - \" + binaryStore.Read(i));\n}\n```\n\n## External Lock\n\n```cs\nprivate static object LockObject = new object();\n\n//...\n\nBinaryStore\u003cPerson\u003e binaryStore = new BinaryStore\u003cPerson\u003e(stream, LockObject);\n```\n\n## Options\n\n```cs\nBinaryStore\u003cPerson\u003e binaryStore = new BinaryStore\u003cPerson\u003e(stream, builder =\u003e\n{\n    builder.BinaryAttributePropertiesOnly = true; // serialize only properties with [BinaryStoreRecord] attribute\n    builder.SeekToBeginningAtStartup = true; // goto stream 0 at stratup \n    builder.Serializers.Add(new BinaryStoreByteArraySerializer()); // add your own type serializers\n});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadoconnection%2Fbinarystore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadoconnection%2Fbinarystore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadoconnection%2Fbinarystore/lists"}