{"id":15497204,"url":"https://github.com/jwerle/libara","last_synced_at":"2025-04-22T21:44:09.546Z","repository":{"id":74100046,"uuid":"115583450","full_name":"jwerle/libara","owner":"jwerle","description":"libara is a library for constructing random access memory interfaces. Operations are asynchronous and are provided data structures for relaying memory between functions. It is built on top of libuv (libuv \u003e= 1.x.x). It is inspired by Julian Gruber's abstract-random-access.","archived":false,"fork":false,"pushed_at":"2018-02-09T22:22:27.000Z","size":117,"stargazers_count":10,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-29T19:11:12.057Z","etag":null,"topics":["async","clib","hypercore","libuv","memory"],"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/jwerle.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","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}},"created_at":"2017-12-28T04:02:56.000Z","updated_at":"2023-05-16T12:00:09.000Z","dependencies_parsed_at":"2023-04-09T18:47:06.942Z","dependency_job_id":null,"html_url":"https://github.com/jwerle/libara","commit_stats":{"total_commits":52,"total_committers":3,"mean_commits":"17.333333333333332","dds":0.09615384615384615,"last_synced_commit":"b3dd6011c09eecff6e03f59d8443c8d2a82f2d26"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwerle%2Flibara","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwerle%2Flibara/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwerle%2Flibara/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwerle%2Flibara/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jwerle","download_url":"https://codeload.github.com/jwerle/libara/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250330416,"owners_count":21412978,"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","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":["async","clib","hypercore","libuv","memory"],"created_at":"2024-10-02T08:31:44.986Z","updated_at":"2025-04-22T21:44:09.525Z","avatar_url":"https://github.com/jwerle.png","language":"C","readme":"libara\n======\n\n`libara` is a library for constructing random access memory interfaces.\nOperations are asynchronous and are provided data structures for\nrelaying memory between functions. It is built on top of libuv\n(libuv \u003e= 1.x.x). It is inspired by [abstract-random-access](\nhttps://github.com/juliangruber/abstract-random-access).\n\n## Abstract\n\nTODO\n\n## Installation\n\nWith [clib](https://github.com/clibs/clib) do:\n\n```sh\n$ clib install jwerle/libara\n```\n\nOr from source do:\n\n```sh\n$ git clone git@github.com:jwerle/libara.git\n$ cd librara\n$ ./configure\n$ make\n$ sudo make install\n```\n\n## API\n\nTODO\n\n## Example\n\n```c\n#include \u003cara/ara.h\u003e\n#include \u003cassert.h\u003e\n#include \u003cstdlib.h\u003e\n#include \u003cstring.h\u003e\n#include \u003cstdio.h\u003e\n#include \u003cuv.h\u003e\n\nstatic ara_buffer_t ram = {0};\nstatic uv_loop_t *loop = 0;\nstatic ara_t ara = {0};\n\nvoid onopen(ara_async_req_t *req, ara_done_cb *done) {\n  static ara_async_data_t data = {0};\n  printf(\"onopen()\\n\");\n\n  data.offset = 32;\n  data.length = 16;\n  data.data = \"abcd efgh 1234 f\";\n\n  done(req);\n  ara_write(req-\u003eara, \u0026data, 0);\n}\n\nvoid onwrite(ara_async_req_t *req, ara_done_cb *done) {\n  static ara_async_data_t data = {0};\n  printf(\"onwrite()\\n\");\n\n  data.offset = req-\u003edata.offset;\n  data.length = req-\u003edata.length;\n\n  ara_buffer_write(\u0026ram, req-\u003edata.offset, req-\u003edata.length, req-\u003edata.data);\n  done(req);\n  ara_read(req-\u003eara, \u0026data, 0);\n}\n\nvoid onread(ara_async_req_t *req, ara_done_cb *done) {\n  ara_async_data_t *data = \u0026req-\u003edata;\n  ARAchar out[data-\u003elength + 1];\n\n  printf(\"onread(): offset=%d length=%d\\n\", data-\u003eoffset, data-\u003elength);\n  ara_buffer_read(\u0026ram, data-\u003eoffset, data-\u003elength, out);\n  printf(\"%s\\n\", out);\n\n  done(req);\n  ara_close(req-\u003eara, 0, 0);\n}\n\nvoid onclose(ara_async_req_t *req, ara_done_cb *done) {\n  printf(\"onclose()\\n\");\n  done(req);\n  ara_buffer_destroy(\u0026ram);\n}\n\nint\nmain(void) {\n  loop = uv_default_loop();\n\n  ara_buffer_init(\u0026ram, BUFSIZ);\n\n  assert(ara_init(\u0026ara));\n  assert(ara_set_loop(\u0026ara, loop));\n  assert(ara_set(\u0026ara, ARA_OPEN, onopen));\n  assert(ara_set(\u0026ara, ARA_CLOSE, onclose));\n  assert(ara_set(\u0026ara, ARA_READ, onread));\n  assert(ara_set(\u0026ara, ARA_WRITE, onwrite));\n  assert(ara_open(\u0026ara, 0, 0));\n\n  uv_run(loop, UV_RUN_DEFAULT);\n  uv_loop_close(loop);\n\n  return 0;\n}\n```\n\n## License\n\nMIT\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjwerle%2Flibara","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjwerle%2Flibara","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjwerle%2Flibara/lists"}