riak_ecto3 v0.5.0 RiakEcto3 View Source
Riak KV 2.0 adapter for Ecto 3. Works by mapping Ecto Schemas to Riak Map-CRDTs.
NOTE: To use, ensure the following has been executed on your Riak database:
riak-admin bucket-type create your_database_name '{"props":{"datatype":"map"}}'
riak-admin bucket-type activate your_database_name
Here, your_database_name refers to any name you'd like the bucket type
that RiakEcto3 will use to be called. This is the same name you should use
in your configuration.
The mix ecto.create task will also do this for you.
Supported Configuration Options:
database:Name of thebucket_typeto use for storing all data of this Repo. This should be a bucket_type that has the datatype set tomap.hostname:The hostname to connect to. Defaults tolocalhost.port:The port to connect to. Defaults to8087.
Ecto
RiakEcto3 currently does not use a pool (but this might change in the future).
Queries
RiakEcto3 only supports get.
(In the future, hopefully we support simple 2i (secondary indexes) as well)
Mix tasks
Storage
RiakEcto3 only supports the mix ecto.create task.
This task will use riak-admin locally to create an appropriate bucket-type
that uses the map CRDT.
Be aware that riak-admin does not use any connection-settings, as it expects
to be ran on the computer that (one of the nodes of) the database will reside on.
The mix ecto.drop task is not supported, because Riak has no way to
drop an existing bucket_type.
Link to this section Summary
Functions
NOTE: Currently we are not using the connection pool to keep the implementation simple.
This could be changed in a future version since Riak provides one.
Implementation of Repo.delete
Dumps datatypes so they can properly be stored in Riak
Implementation of Ecto.Adapter.ensure_all_started
Implementation of Repo.get
Initializes the connection with Riak.
Implementation of Repo.insert
TODO Properly implement
Link to this section Functions
checkout(adapter_meta, config, fun) View Source
NOTE: Currently we are not using the connection pool to keep the implementation simple.
This could be changed in a future version since Riak provides one.
delete(repo, meta, struct_or_changeset, opts) View Source
Implementation of Repo.delete
dump(struct) View Source
dumpers(primitive_type, ecto_type) View Source
Dumps datatypes so they can properly be stored in Riak
ensure_all_started(config, app_restart_type) View Source
Implementation of Ecto.Adapter.ensure_all_started
find_keys_between(repo, meta, schema_module, lower_bound, upper_bound) View Source
get(repo, meta, schema_module, id, opts) View Source
Implementation of Repo.get
Returns nil if nothing is found. Returns the structure if something was found.
Raises an ArgumentError using improperly.
init(config) View Source
Initializes the connection with Riak.
Implementation of Ecto.Adapter.init
insert(repo, meta, struct_or_changeset, opts) View Source
Implementation of Repo.insert
loaders(primitive_type, ecto_type) View Source
TODO Properly implement