38 Commits

Author SHA1 Message Date
Jonathan Boulle
f1ed69e883 *: switch to line comments for copyright
Build tags are not compatible with block comments.
Also adds copyright header to a few places it was missing.
2015-01-26 09:53:30 -08:00
Yicheng Qin
e8698b0e42 docs: update errorcode.md 2015-01-15 13:23:24 -08:00
Yicheng Qin
295fa1ca99 error: deprecate unused error code 2015-01-15 11:49:41 -08:00
Yicheng Qin
b9544d32b6 error: remove unused Message func 2015-01-13 10:40:06 -08:00
Brandon Philips
5fbef59dbc error: use application/json as the content-type
Fixes #1584
2014-11-04 12:08:18 -08:00
Xiang Li
d0604c7d5c error: write->writeTo 2014-10-27 15:32:36 -07:00
Jonathan Boulle
7a4d42166b *: add license header to all source files 2014-10-17 15:41:22 -07:00
Jonathan Boulle
e2d01eff35 etcdserver: switch to using etcd.Error 2014-09-10 15:46:13 -07:00
Yicheng Qin
db4c5e0eaa fix(server/v2): set correct content-type for etcdError response
"net/http".Error reset the content type, so we get rid of it and
write our own one.
2014-05-29 14:18:50 -07:00
Yicheng Qin
baadf63912 feat: implement standby mode
Change log:
1. PeerServer
- estimate initial mode from its log through removedInLog variable
- refactor FindCluster to return the estimation
- refactor Start to call FindCluster explicitly
- move raftServer start and cluster init from FindCluster to Start
- remove stopNotify from PeerServer because it is not used anymore
2. Etcd
- refactor Run logic to fit the specification
3. ClusterConfig
- rename promoteDelay to removeDelay for better naming
- add SyncClusterInterval field to ClusterConfig
- commit command to set default cluster config when cluster is created
- store cluster config info into key space for consistency
- reload cluster config when reboot
4. add StandbyServer
5. Error
- remove unused EcodePromoteError
2014-05-09 01:56:55 -07:00
Yicheng Qin
4e14604e5c refactor(server): add Client struct
This is used to send request to web API.
It will do this behavior a lot in standby mode, so I abstract this
struct first.
2014-05-07 11:46:15 -07:00
Yicheng Qin
fa54866e99 Revert "Merge pull request #631 from metaflow/fix-delete-key-as-directory"
This reverts commit b87972713e17fb815bfe42f25a63f94f232007e2, reversing
changes made to bd8d45ce28d6f9ddb9c5164f58aca8f9a6359f7b.
2014-04-21 17:55:44 -07:00
Mikhail Goncharov
7cebc3999a api(delete) now you get an error trying to delete files a directory (http.StatusForbidden) 2014-04-21 19:50:57 +07:00
Yicheng Qin
0c95e1eabb feat(peer_server): forbid rejoining with different name
Or it will confuse the cluster, especially the heartbeat between nodes.
2014-04-17 15:46:33 -07:00
Yicheng Qin
67600603c5 chore: rename proxy mode to standby mode
It makes the name more reasonable.
2014-04-17 08:04:42 -07:00
Cenk Alti
303a3096d4 refactor(errors): use map literal syntax
Error strings align better this way.
2014-03-25 20:17:21 -07:00
Ben Johnson
fe4dee03ab Minor fixes. 2014-03-04 09:29:44 -07:00
Ben Johnson
c8d6b26dfd Add auto-demotion after peer inactivity. 2014-03-03 11:15:05 -07:00
Ben Johnson
1d961b8e56 Add proxy mode. 2014-02-22 15:02:20 -07:00
Brandon Philips
1b00c449a5 Revert "Better error message when setting values on directories"
This reverts commit d13dd50d5107b10eaeda734d971cd4512cb4a304.
2014-01-23 11:22:11 -08:00
Kelsey Hightower
d13dd50d51 Better error message when setting values on directories
Without this commit etcd returns the following error message when
setting values on directories:

    {
      "errorCode":102,
      "message":"Not a file",
      "cause":"/postgres",
      "index":2
    }

While the above error message is accurate it's not very descriptive.
This commit adds a new error code/message which better describes why the
write operation failed. etcd now returns the following:

    {
      "errorCode":109,
      "message":"Cannot set value on directory",
      "cause":"/postgres",
      "index":2
    }
2014-01-22 23:02:33 -08:00
Ben Johnson
cde184fdbf Fix mod/lock and mod/leader return error codes. 2014-01-14 07:57:30 -07:00
Chris Shoemaker
d89fa131ab feat(v2/errors): Use more appropriate HTTP status codes for error cases.
This commits adds test coverage for all the error and non-error cases
described below, but only the behavior of the 403, 404 and 412 cases
are changing in this commit.

When setting a key results in a new resource, we asset an HTTP status
code of 201 (aka "Created").

When attempting to get a resource that doesn't exist, we assert an
HTTP status code of 404 (aka "Not Found").

When attempting to delete a directory without dir=true, or a non-empty
directory without recursive=true, but the request is otherwise valid,
we assert an HTTP status code of 403 (aka "Forbidden").

When a precondition (e.g. specified by prevIndex, or prevValue) is not
met, but the request is otherwise syntactically valid, we assert an
HTTP status code of 412 (aka "Precondition Failed").  However,
prevExist is handled slightly differently.  If prevExist=false fails,
then this is treated like a failed precondition, so it should use
PreconditionFailed.  But, if prevExist=true fails, then this is
treated like other requests that require the existence of the
resource, and uses NotFound if the resource doesn't exist.

We continue to assert an HTTP status code of 400 when the request is
syntactically invalid (e.g. when prevIndex=bad_index).
2013-12-21 21:39:19 -05:00
Chris Shoemaker
39fb266776 fix(error.go): fix typo in comment 2013-12-21 21:39:19 -05:00
Xiang Li
636dad190e refactor(error.go) error messages 2013-12-05 17:50:20 -05:00
Xiang Li
40d297be66 feat add dir_flag 2013-12-05 17:10:37 -05:00
Xiang Li
6252037376 fix root should be rdonly 2013-12-01 18:01:24 -05:00
Ben Johnson
cba2611c68 Renamed configuration parameters. 2013-11-15 00:13:32 -05:00
Xiang Li
5abbaf59e3 Merge pull request #292 from xiangli-cmu/fix-ttl
WIP: fix ttl
2013-11-11 21:30:32 -08:00
Xiang Li
6156d5c790 refactor separate etcd index from raft index 2013-11-09 17:55:54 -08:00
Brandon Philips
6a074d4f6f chore(*.go): add copyright notice 2013-11-08 14:04:15 -08:00
Xiang Li
baaaf24f70 (feat) v1 apt backward support 2013-10-06 11:23:52 -07:00
Xiang Li
512dede9ce finish todo 2013-10-02 22:15:12 -07:00
Xiang Li
da83ee223b clean up from yifan 2013-09-28 16:26:19 -07:00
Hongchao Deng
effc8285f2 New error-system for Etcd with docs 2013-09-08 18:46:16 -04:00
Xiang Li
227d79e2bf support testandset 2013-09-05 15:38:22 -04:00
Xiang Li
329f8c4fa3 init filesystem 2013-09-03 14:30:42 -04:00
Xiang Li
cf2d6888c2 add error package 2013-08-17 20:41:15 -07:00