{"id":16061834,"url":"https://github.com/watson1978/ilios","last_synced_at":"2025-08-31T21:31:35.824Z","repository":{"id":194284474,"uuid":"689971811","full_name":"Watson1978/ilios","owner":"Watson1978","description":"Cassandra driver written by C language for Ruby","archived":false,"fork":false,"pushed_at":"2024-12-27T15:50:47.000Z","size":170,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-12-27T16:32:47.333Z","etag":null,"topics":["c","cassandra","ruby"],"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/Watson1978.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2023-09-11T09:33:19.000Z","updated_at":"2024-12-27T15:50:48.000Z","dependencies_parsed_at":"2024-02-13T00:28:36.811Z","dependency_job_id":"d08e4647-8dd9-4611-9df9-5cd4f17e5c9e","html_url":"https://github.com/Watson1978/ilios","commit_stats":null,"previous_names":["watson1978/ilios"],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Watson1978%2Filios","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Watson1978%2Filios/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Watson1978%2Filios/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Watson1978%2Filios/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Watson1978","download_url":"https://codeload.github.com/Watson1978/ilios/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":231514980,"owners_count":18388404,"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":["c","cassandra","ruby"],"created_at":"2024-10-09T04:20:43.426Z","updated_at":"2024-12-28T12:48:21.538Z","avatar_url":"https://github.com/Watson1978.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ilios\n\n[![Gem Version](https://badge.fury.io/rb/ilios.svg)](https://badge.fury.io/rb/ilios)\n[![CI](https://github.com/Watson1978/ilios/actions/workflows/CI.yml/badge.svg)](https://github.com/Watson1978/ilios/actions/workflows/CI.yml)\n\nIlios that Cassandra driver written by C language for Ruby using [DataStax C/C++ Driver](https://github.com/datastax/cpp-driver).\n\n## Installation\n\nInstall the gem and add to the application's Gemfile by executing:\n\n```sh\n$ bundle add ilios\n```\n\nIf bundler is not being used to manage dependencies, install the gem by executing:\n\n```sh\n$ gem install ilios\n```\n\nThis gem's installer will install the DataStax C/C++ Driver to the appropriate location automatically.\nHowever, if you prefer to install the DataStax C/C++ Driver manually, you can do so by executing:\n\n```sh\n$ bundle config set --local build.ilios --with-libuv-dir=/path/to/libuv-installed-dir\n$ bundle config set --local build.ilios --with-cassandra-driver-dir=/path/to/cassandra-cpp-driver-installed-dir\n$ bundle add ilios\n```\n\nor\n\n```sh\n$ gem install ilios -- --with-libuv-dir=/path/to/libuv-installed-dir --with-cassandra-driver-dir=/path/to/cassandra-cpp-driver-installed-dir\n```\n\n## Requirements\n\n- cmake (in order to build the DataStax C/C++ Driver and libuv)\n- C/C++ compiler\n- install_name_tool (macOS only)\n\n## Supported\n\n- Ruby 3.1 or later\n- Cassandra 3.0 or later\n- Linux and macOS platform\n\n## Example\n### Basic usage\n\nCreate the keyspace in advance using the `cqlsh` command.\n\n```cql\nCREATE KEYSPACE IF NOT EXISTS ilios\nWITH REPLICATION = {\n  'class' : 'SimpleStrategy',\n  'replication_factor' : 1\n};\n```\n\nThen, you can run the following code.\n\n```ruby\nrequire 'ilios'\n\ncluster = Ilios::Cassandra::Cluster.new\ncluster.keyspace('ilios')\ncluster.hosts(['127.0.0.1'])\nsession = cluster.connect\n\n# Create the table\nstatement = session.prepare(\u003c\u003c~CQL)\n  CREATE TABLE IF NOT EXISTS ilios.example (\n    id bigint,\n    message text,\n    created_at timestamp,\n    PRIMARY KEY (id)\n  ) WITH compaction = { 'class' : 'LeveledCompactionStrategy' }\n  AND gc_grace_seconds = 691200;\nCQL\nsession.execute(statement)\n\n# Insert the records\nstatement = session.prepare(\u003c\u003c~CQL)\n  INSERT INTO ilios.example (\n    id,\n    message,\n    created_at\n  ) VALUES (?, ?, ?)\nCQL\n\n100.times do |i|\n  statement.bind({\n    id: i,\n    message: 'Hello World',\n    created_at: Time.now,\n  })\n  session.execute(statement)\nend\n\n# Select the records\nstatement = session.prepare(\u003c\u003c~CQL)\n  SELECT * FROM ilios.example\nCQL\nstatement.idempotent = true\nstatement.page_size = 25\nresult = session.execute(statement)\nresult.each do |row|\n  p row\nend\n\nwhile(result.next_page)\n  result.each do |row|\n    p row\n  end\nend\n```\n\n### Synchronous API\n`Ilios::Cassandra::Session#prepare` and `Ilios::Cassandra::Session#execute` are provided as synchronous API.\n\n```ruby\nstatement = session.prepare(\u003c\u003c~CQL)\n  SELECT * FROM ilios.example\nCQL\nresult = session.execute(statement)\n```\n\n### Asynchronous API\n`Ilios::Cassandra::Session#prepare_async` and `Ilios::Cassandra::Session#execute_async` are provided as asynchronous API.\n\n```ruby\nprepare_future = session.prepare_async(\u003c\u003c~CQL)\n  INSERT INTO ilios.example (\n    id,\n    message,\n    created_at\n  ) VALUES (?, ?, ?)\nCQL\n\nprepare_future.on_success { |statement|\n  futures = []\n\n  10.times do |i|\n    statement.bind({\n      id: i,\n      message: 'Hello World',\n      created_at: Time.now,\n    })\n    result_future = session.execute_async(statement)\n    result_future.on_success { |result|\n      p result\n      p \"success\"\n    }\n    result_future.on_failure {\n      p \"fail\"\n    }\n\n    futures \u003c\u003c result_future\n  end\n  futures.each(\u0026:await)\n}\n\nprepare_future.await\n```\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/Watson1978/ilios.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwatson1978%2Filios","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwatson1978%2Filios","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwatson1978%2Filios/lists"}