11 Commits

Author SHA1 Message Date
Frank Schroeder
3e00e36f41 golint: Untangle if blocks with return in else 2017-04-25 09:26:13 -07:00
Frank Schroeder
5a3961f31f golint: Replace a += 1 with a++ 2017-04-25 09:26:13 -07:00
Frank Schroeder
eddb1af603 Remove duplicate constants
This patch removes duplicate internal copies of constants in the structs
package which are also defined in the api package. The api.KVOp type
with all its values for the TXN endpoint and the api.HealthXXX constants
are now used throughout the codebase.

This resulted in some circular dependencies in the testutil package
which have been resolved by copying code and constants and moving the
WaitForLeader function into a separate testrpc package.
2017-04-20 09:54:49 -07:00
Frank Schroeder
ee5b06a231 Use fmt.Fprint/Fprintf/Fprintln
Used the following rewrite rules:

gofmt -w -r 'resp.Write([]byte(fmt.Sprintf(a, b, c, d))) -> fmt.Fprintf(resp, a, b, c, d)' *.go
gofmt -w -r 'resp.Write([]byte(fmt.Sprintf(a, b, c))) -> fmt.Fprintf(resp, a, b, c)' *.go
gofmt -w -r 'resp.Write([]byte(fmt.Sprintf(a, b))) -> fmt.Fprintf(resp, a, b)'  *.go
gofmt -w -r 'resp.Write([]byte(fmt.Sprintf(a))) -> fmt.Fprint(resp, a)' *.go
gofmt -w -r 'resp.Write([]byte(a + "\n")) -> fmt.Fprintln(resp, a)' *.go
gofmt -w -r 'resp.Write([]byte(a)) -> fmt.Fprint(resp, a)' *.go
2017-04-20 09:02:59 -07:00
James Phillips
653387637a Reduces the number of operations in a transaction to 64. 2016-05-14 21:40:46 -07:00
James Phillips
570d46aa5f Adds some size limiting features to transactions to help prevent abuse. 2016-05-13 13:39:01 -07:00
James Phillips
a37bf9de56 Adds a read-only optimized path for transactions. 2016-05-13 00:34:05 -07:00
James Phillips
8a7428e508 Hoists KV processing helper functions up as static functions. 2016-05-12 16:10:06 -07:00
James Phillips
960b9d6fb6 Switches to "KV" instead of "KV" for the KV operations. 2016-05-11 10:58:27 -07:00
James Phillips
38d0f6676f Refactors TxnRequest/TxnResponse into a form that will allow non-KV ops.
This isn't needed/used yet, but it's a good hook to get in there so we
can add more atomic operations in the future. The Go API hides this detail
so that feels like a KV-specific API. The implications on the REST API are
pretty minimal.
2016-05-11 01:39:10 -07:00
James Phillips
69f58ad04a Moves txn code into a new endpoint, not specific to KV. 2016-05-10 21:58:02 -07:00