Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support for multiple collections #7

Closed
steveyen opened this issue Dec 30, 2016 · 2 comments
Closed

support for multiple collections #7

steveyen opened this issue Dec 30, 2016 · 2 comments

Comments

@steveyen
Copy link
Member

steveyen commented Dec 30, 2016

Users can currently fake out multiple collections by explicitly adding a short collection name prefix to each of their keys. However, such a trick is suboptimal as it repeats a prefix for every key-val item.

Instead, a proposal to support multiple collections natively in moss would be by introducing a few additional methods to the API, so that we remain backwards compatible for current moss users.

The idea is that the current Collection in moss now logically becomes a "top-most" collection of an optional hierarchy of child collections.

To the Batch interface, the proposal is to add the methods...

NewChildCollectionBatch(childCollectionName string, hints) (Batch, error)

DelChildCollection(childCollectionName string) error

When a batch is executed, the entire hierarchy of a top-level batch and its batches for any child collections will be committed atomically.

Removing a child collection takes precedence over adding more child collection mutations.

To the Snapshot interface, the proposal is to add the methods...

ChildCollectionNames() ([]string, error)

ChildCollectionSnapshot(childCollectionName string) (Snapshot, error)

And, that's it.

The proposed API allows for deeply nested child collections of child collections, but the initial implementation might just return an error if the user tries to have deep nesting.

@hisundar
Copy link
Contributor

Implementation as per design above up for review here
http://review.couchbase.org/#/c/72254

ns-codereview pushed a commit that referenced this issue Feb 27, 2017
Implementations of Collection & Snapshot interfaces
now have recursive maps of childCollections & childSnapshots
respectively. These process new child batches from incoming
batches and apply all operations recursively on to
child collections.
Background operations of merger & persister are child
collection aware and recursively process the same.
+Incarnation numbers to handle fast collection recreation.
Implmentation as per design detailed here
#7

Change-Id: I2c30217a88813e7cf01ed1181d56472131d1c473
Reviewed-on: http://review.couchbase.org/72254
Reviewed-by: Steve Yen <steve.yen@gmail.com>
Tested-by: Sundararaman Sridharan <sundar@couchbase.com>
@steveyen
Copy link
Member Author

steveyen commented Mar 1, 2017

@hisundar improvement for this went in -- thanks Sundar!

@steveyen steveyen closed this as completed Mar 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants