eregs / regulations-core

An engine that supplies the API that allows users to read regulations and their various layers.
Creative Commons Zero v1.0 Universal
17 stars 27 forks source link

More flexible layer storage #43

Closed cmc333333 closed 8 years ago

cmc333333 commented 8 years ago

Layers currently have distinct fields for the label of the regulation component they are referencing as well as the version of that regulation. As we'd like to start creating layers for other entities (namely, preambles), this generalizes that conception to a single "reference" string which includes both version and label when referring to regulations.

Read and write interfaces for the layer model also needed to be updated. See individual changesets for a more in-depth story. Note that there's nothing here to prevent a namespace collision; we're keeping relatively closely with the key-value storage approach.

Should resolve eregs/notice-and-comment#17

jmcarp commented 8 years ago

I'm guessing this isn't an issue, but could preamble labels ever conflict with regulation versions, so that the delete in bulk_put would unintentionally delete unrelated layer records?

cmc333333 commented 8 years ago

This is handled okay on the insertion side (in practice, the namespaces are different), but you bring up a great point about the "startswith" deletion. Preambles could delete reg data (if both share the same document number). It'd make more sense to namespace everything (e.g. "cfr:version:label" for regs and "preamble:label" for preambles).

This isn't an issue we'll encounter for a bit, however (we won't have a document number until at least next sprint). I think we're okay to make an issue but get this PR in now.