Skip to content

Ripple Associations

seancribbs edited this page Aug 13, 2010 · 6 revisions

Riak Associations

  1. Key Correspondence
  2. Bucket correspondence
  3. Composition (embedding)
  4. Links

Ripple Associations

  1. One
  2. Many

How these work together

  1. One
    1. Key Correspondence
    2. Inverted Bucket Correspondence
    3. Composition
    4. Links
  2. Many
    1. Bucket Correspondence
    2. Composition
    3. Links

Proxies

  1. one_key_proxy
  2. one_embedded_proxy
  3. one_bucket_proxy
  4. one_link_proxy
  5. many_embedded_proxy
  6. many_link_proxy
  7. many_bucket_proxy

Proxy Notes

  • Embedded
    • There is no belongs to embedded proxy as the embedded document is
      already aware of its parent document via methods in embedded_document.
      An embedded document cannot change its parent once it has been saved.
  • Link
    • There is also no belongs to for link proxy. It would just be a “one” relationship
      back in the other direction.
  • Key
    • Key correspondence will require a matching class to have a “one” relationship.
      This matching relationship acts as a belongs_to.
  • Bucket
    • The independent class will have to define how the bucket name will be defined (maybe sensible default, with configurable proc).
    • The dependent class will have to determine the independent instance by the bucket name (using a sensible default or configurable proc). ** Acting as the dependent class will also require modification of the bucket_name method or some other hackery to determine the bucket.

Thoughts on a proxy class method.

Ideally one_association, many_association, embedded_association, link_association
will be able to be abstracted into modules that will make most of the proxies
little more than specific implementation. This may not be possible however.

In adding the associations, we’ll be adding an integration/ripple folder
that will use a ripple_test bucket.

Syntax

  1. one :avatar
  2. one :invoice, :using => :key
  3. many :friends, :class_name => 'User'

Wish List

  1. Polymorphic associations
  2. Automatic “inverse of” assignment/updating
  3. Bucket associations

Work order

  1. One/Many Embedded Associations
  2. One/Many Linked Associations
  3. One/One Key Associations
  4. Wish list