{"id":22946716,"url":"https://github.com/aleksandarskrbic/rocks4j","last_synced_at":"2025-08-11T06:12:20.980Z","repository":{"id":45147783,"uuid":"244952418","full_name":"aleksandarskrbic/rocks4j","owner":"aleksandarskrbic","description":"KV Store for Java backed by RocksDB","archived":false,"fork":false,"pushed_at":"2022-11-16T08:28:18.000Z","size":4418,"stargazers_count":16,"open_issues_count":8,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-01T12:50:48.133Z","etag":null,"topics":["java","kv-database","kv-storage","kv-store","kvstore","rocksdb","rocksdb-4j","rocksdb-java"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aleksandarskrbic.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":"2020-03-04T16:42:44.000Z","updated_at":"2023-01-17T08:27:47.000Z","dependencies_parsed_at":"2023-01-23T02:31:01.043Z","dependency_job_id":null,"html_url":"https://github.com/aleksandarskrbic/rocks4j","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/aleksandarskrbic/rocks4j","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aleksandarskrbic%2Frocks4j","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aleksandarskrbic%2Frocks4j/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aleksandarskrbic%2Frocks4j/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aleksandarskrbic%2Frocks4j/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aleksandarskrbic","download_url":"https://codeload.github.com/aleksandarskrbic/rocks4j/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aleksandarskrbic%2Frocks4j/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269838444,"owners_count":24483200,"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-08-11T02:00:10.019Z","response_time":75,"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":["java","kv-database","kv-storage","kv-store","kvstore","rocksdb","rocksdb-4j","rocksdb-java"],"created_at":"2024-12-14T14:48:00.706Z","updated_at":"2025-08-11T06:12:20.928Z","avatar_url":"https://github.com/aleksandarskrbic.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rocks4j\n\nKV Store for Java backed by RocksDB.\n\n## Getting Started\n\n### Maven\n```java\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.github.aleksandarskrbic\u003c/groupId\u003e\n  \u003cartifactId\u003erocks4j\u003c/artifactId\u003e\n  \u003cversion\u003e1.0.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n### Gradle\n```java\ncompile \"com.github.aleksandarskrbic:rocks4j:1.0.0\"\n```\n\n## Introduction\nThe goal of this project is to provide KV store backed by RocksDB with simple Java API.\nAllow developers to quickly integrate RocksDB into the existing Java/Scala project.\nIt can be used as a local caching mechanism in microservices or just to replace huge in-memory data structures.\n\n## API\n\nThere are five available operations against KV repository:\n\n* `save(K key, V value)`\n* `findByKey(K key)`\n* `findAll()`\n* `deleteByKey(K key)`\n* `deleteAll()`\n\n## Examples\n\nSuppose you have a Java class:\n\n```java\npublic class Item {\n    private Long id;\n    private String desc;\n    \n    // constructors, getters and setters\n}\n```\n\nTo create KV repository for Item class, firstly you need to create a configuration class that accepts a path to file (where RocksDB files will be) and the name of the repository: \n\n```java\nfinal RocksDBConfiguration configuration = new RocksDBConfiguration(\"/path/to/rocksdb\", \"item\");\n```\nAfter configuration class is created, you are able to instantiate the Item Repository:\n\n```java\npublic class ItemRepository extends RocksDBKeyValueRepository\u003cLong, Item\u003e {\n\n  public ItemRepository(final RocksDBConfiguration configuration) {\n    super(configuration);\n  }\n  \n}\n```\n\n```java\nfinal ItemRepository itemRepository = new ItemRepository(configuration);\n```\n\n```java\nfinal Item item = new Item(1L, \"Desc\")\n```\n\n```java\nitemRepository.save(item.getId(), item);\nfinal Optional\u003cItem\u003e itemOptional = itemRepository.findByKey(item.getId());\nfinal Collection\u003cItem\u003e all = itemRepository.findAll();\nitemRepository.deleteByKey(item.getId());\nitemRepository.deleteAll();\n```\n\n## Note\n\nIn order to maintain flexibility, when exception related to `RocksDB` or `Serialization/Deserialization` in `RocksDBKeyValueRepository`,\nexceptions are just propagated, so it's a client's responsibility to deal with it.\nBest practice would be to override methods from `RocksDBKeyValueRepository` and \nhandle those exceptions and handle those exceptions into your repository class.\nAnother solution would be to handle\nit every time you invoke methods provided by `RocksDBKeyValueRepository` which is not recommended.\n\n### Example\n\n```java\npublic static class ItemRepository extends RocksDBKeyValueRepository\u003cLong, Item\u003e {\n\n    public ItemRepository(final RocksDBConfiguration configuration) {\n        super(configuration);\n    }\n\n    @Override\n    public void save(final Long key, final Item value) {\n        try {\n            super.save(key, value);\n        } catch (final SerializationException e) {\n            // log or handle\n        } catch (final SaveFailedException e) {\n            // log or handle\n        }\n    }\n\n    // other methods\n}\n```\n## Credits\n\nSpecial thanks to [@jovicaandric](https://github.com/jovicaandric) and [@vajda](https://github.com/vajda).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faleksandarskrbic%2Frocks4j","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faleksandarskrbic%2Frocks4j","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faleksandarskrbic%2Frocks4j/lists"}