From e208d6980c1b3efa1827a3e12d2d1427fca597b8 Mon Sep 17 00:00:00 2001 From: ale <ale@incal.net> Date: Sun, 28 Dec 2014 11:22:20 +0000 Subject: [PATCH] add versioning to the cluster runtime data in etcd This change allows us to introduce changes to the inner workings of the cluster that break backwards compatibility, allowing a smooth transition to the new format. --- api.go | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/api.go b/api.go index 30fd0f1f..0d63f4c6 100644 --- a/api.go +++ b/api.go @@ -12,14 +12,26 @@ import ( "time" ) -var ( - MasterElectionPath = "/icecast/cluster/master" - MountPrefix = "/icecast/mounts/" - NodePrefix = "/icecast/nodes/" +const ( + // Path to the mount configuration in etcd. This should never + // change, upgrades to the configuration format should be + // backwards-compatible. + MountPrefix = "/icecast/mounts/" + + // Path for the cluster runtime data. Whenever the format of + // this data changes, the ABIVersion should be increased. A + // rolling restart of the cluster will then seamlessly cause a + // transition to the new consensus (the cluster will be + // partitioned in the meantime). + ABIVersion = "2" + MasterElectionPath = "/icecast/" + ABIVersion + "/cluster/master" + NodePrefix = "/icecast/" + ABIVersion + "/nodes/" IcecastPort = 8000 IcecastMountPrefix = "/_stream" +) +var ( ErrIsDirectory = errors.New("key is a directory") ErrIsFile = errors.New("key is a file") ) -- GitLab