Commit Graph

176 Commits (7ef6078c981dcd492004ef42a31c55016ceaa890)

Author SHA1 Message Date
Chris Goller 6484509b56 Merge pull request #403 from influxdata/bugfix/tr-singular-default-source
Make API guarantee one default source at all times
2016-11-08 11:57:13 -06:00
Tim Raymond b0860ca903 Make argument order of setRandomDefault consistent
Most of the other private CRUD methods have a consistent argument order
of a context, a source, then a transaction. setRandomDefault had two of
these args transposed, so this swaps them to be consistent with the rest
of the methods.
2016-11-08 12:29:29 -05:00
Tim Raymond d4f2434399 Make context.Context the first argument
This is the convention.
2016-11-08 12:14:06 -05:00
Tim Raymond b8e335fbee Prevent deadlocks with source default enforcement
Previously, the logic to enforce on default source relied on the
public-facing CRUD methods already provided by SourcesStore. This was
prone to deadlocks due to the possibility of acquiring a transaction
within a transaction.  This extracts the logic that was performed within
the transactions of each CRUD action and makes the private methods that
receive a *bolt.Tx.  This allows the convenience methods that enforce
default source to use this private API and provide the transaction from
its caller. This ensures that there is only ever one transaction
acquired by each expored
CRUD method.
2016-11-08 12:09:35 -05:00
Chris Goller 8d97980aad Add wheres to layouts 2016-11-07 20:35:46 -06:00
Tim Raymond 493befbdc7 Enforce default constraints on first/last source
Whenver sources are present, there should be exactly one default source.
Prior to this commit, it was possible to add the first source as a
non-default source and circumvent this invariant. This unfortunately
requires a bit of special-casing logic in s.Add and requires a query to
fetch the number of sources currently persisted.

Tests have been added to cover this as well as deleting the final
source, to ensure that there aren't any odd indexing panics that might
result from trying to find another candidate default source when
deleting.
2016-11-07 18:13:23 -05:00
Tim Raymond d03d47b9ad Extract Default source enforcement logic
Enforcing the constraint that there be exactly one default source
whenever there are sources present isn't really a concern of the
traditional CRUD methods that are provided by SourcesStore. This makes
this separation a little more explicit and provides a place to glue some
documentation onto what would otherwise be a confusing bit of business
logic in the write path of SourcesStore.
2016-11-07 18:13:23 -05:00
Tim Raymond 193765ead2 Auto-set default source on Add and Delete
Previously, when adding a new default source, it was possible to create
more than one default source, since the previous default would not be unset.

Implementing this revealed another issue where deleting the default
source would leave no default set. If the default source is deleted now,
another source is chosen to be the new default.
2016-11-07 18:13:23 -05:00
Tim Raymond 4a02ad7525 Enforce single default source on update
This ensures that there will only be on default source upon setting a
new default by unsetting the default flag on all other sources. This
only happens when the source to be updated has Default set to true to
avoid a performance hit when updating other attributes.
2016-11-07 18:13:23 -05:00
Chris Goller b274363149 Add groupby options to layouts 2016-11-07 16:31:48 -06:00
Chris Goller 73cbc4abc6 Fix bolt scoping and minor kapacitor tickscript updates 2016-11-03 22:25:41 -05:00
Chris Goller a95c998300 Update to store alert information in boltdb 2016-11-03 19:52:13 -05:00
Tim Raymond 3dc2fa9592 Add I and Name to protobufs
I and Name were added to support react-grid-layout. They were added to
the chronograf types, but not to the protobuf definitions, so the only
layouts that could make use of them were the canned variety. This allows
layouts' I and Name to be persisted as well.
2016-10-28 18:03:34 -04:00
Chris Goller 12348d72cb Refactor to remove autogenerated code. 2016-10-26 22:10:52 -05:00
Chris Goller 8911b0fd78 Update name to chronograf 2016-10-20 09:39:40 -05:00
Chris Goller f6770830f9 Update layouts to use ID generation. 2016-10-10 21:00:49 -05:00
Chris Goller c9dc1d492a Add pre-canned application layout store. 2016-10-10 20:40:16 -05:00
Chris Goller 41d6341a36 Update layout to use uuid v4 string as ID parameter. 2016-10-10 17:08:52 -05:00
Chris Goller 7aec0e93bf Add ability to to filter layouts by apps or measurements. 2016-10-06 18:31:56 -05:00
Chris Goller 21ec6cd72f Add layouts endpoint and storage 2016-10-05 23:43:13 -05:00
Chris Goller 53537041a9 Fix exploration update time; fix exploration PATCH to be RFC 7396; update exploration PATCH to return 200 and body. 2016-10-04 15:33:32 -05:00
Chris Goller 5f24c1994e Update kapacitor endpoint to be scoped to sources 2016-10-04 12:49:12 -05:00
Chris Goller ab6d177dc6 Add kapacitors endpoint (persist/proxy/rest) 2016-10-04 12:48:36 -05:00
Chris Goller 2b56cae221 Add persistence to sources and use bolt by default 2016-09-30 15:39:27 -05:00
gunnaraasen 16b79cebec Update exploration store interface to return exploration on add 2016-09-29 10:24:54 -04:00
gunnaraasen e45dbdc630 Refactor the exploration store 2016-09-29 09:38:35 -04:00