Support N distributed agents
This is the third main feature of this system. The code needs a bunch of polish, but it actually all works :) I've tested this briefly with N <= 3. Currently you have to build your own etcd cluster. It's quite easy, just run `etcd` and it will be ready. I usually run it in a throw away /tmp/ dir so that I can blow away the stored data easily.
This commit is contained in:
11
misc.go
11
misc.go
@@ -27,10 +27,21 @@ import (
|
||||
|
||||
// Similar to the GNU dirname command
|
||||
func Dirname(p string) string {
|
||||
if p == "/" {
|
||||
return ""
|
||||
}
|
||||
d, _ := path.Split(path.Clean(p))
|
||||
return d
|
||||
}
|
||||
|
||||
func Basename(p string) string {
|
||||
_, b := path.Split(path.Clean(p))
|
||||
if p[len(p)-1:] == "/" { // don't loose the tail slash
|
||||
b += "/"
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
// Split a path into an array of tokens excluding any trailing empty tokens
|
||||
func PathSplit(p string) []string {
|
||||
return strings.Split(path.Clean(p), "/")
|
||||
|
||||
Reference in New Issue
Block a user