This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC7LeTtPBluCl0jSWtrvkn5MivdXIatdvrVhntWq5v6ZOfngO93W1TTCUNEbF0I+Rts9yvnsB6fRvG4SUeS/37Wu/TQQG/QTZ+eBb7whdZnf/0rc2Gon6RlKjr93GDZpnxAoRiZoz1JyMKve388TX7yqPNGqcxBZKFuWH37XZNXmy9jVvJ9JzuamyzGkiSPJ7Kzae1/ciO23uyUj7hilHdAb6Ryk7YWUedv5jfoyaE+DbYX5uj4LszzuI+rF/f+mdqh2jJH85YE1Ydf7RdbDvlE+elP6RQVpnmR0zsGh1yxNoYjSI9kQLmGy8HUleHRGGV0+evzy2elFqaYUqLxD5jp [email protected] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"flag" | |
"fmt" | |
"net" | |
"os" | |
"sync" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
s := srv.NewFileSrv(root) | |
s.Dotu = true | |
if *fldebug { | |
s.Debuglevel = 1 | |
} | |
s.Start(s) | |
if err := s.StartNetListener("tcp", *flfsaddr); err != nil { | |
glog.Errorf("listener failed to start (%v)", err) | |
os.Exit(1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*** jobd.go ***/ | |
// mkjobfs creates the static portion of the jobd file hierarchy: the 'clone' | |
// file, and the 'jobs' directory at the root of the hierarchy. | |
func mkjobfs() (*srv.File, error) { | |
var err error | |
user := p.OsUsers.Uid2User(os.Geteuid()) | |
root := new(srv.File) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func main() { | |
// argument handling and initialization | |
root, err := mkjobfs() | |
if err != nil { | |
os.Exit(1) | |
} | |
// job database management |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*** clone.go ***/ | |
type clonefile struct { | |
srv.File | |
} | |
// Write handles writes to the clone file by attempting to parse the data being | |
// written into a job definition and if successful adding the corresponding job | |
// to the jobs directory. | |
func (k *clonefile) Write(fid *srv.FFid, data []byte, offset uint64) (int, error) { | |
glog.V(4).Infof("Entering clonefile.Write(%v, %v, %v)", fid, data, offset) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*** job.go ***/ | |
type jobdef struct { | |
name string | |
schedule string | |
cmd string | |
state string | |
} | |
type jobreader func() []byte | |
type jobwriter func([]byte) (int, error) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*** job.go ***/ | |
// Read handles read operations on a jobfile using its associated reader. | |
func (jf jobfile) Read(fid *srv.FFid, buf []byte, offset uint64) (int, error) { | |
glog.V(4).Infof("Entering jobfile.Read(%v, %v, %)", fid, buf, offset) | |
defer glog.V(4).Infof("Exiting jobfile.Read(%v, %v, %v)", fid, buf, offset) | |
cont := jf.reader() | |
if offset > uint64(len(cont)) { | |
return 0, nil |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*** job.go ***/ | |
// run executes the command associated with a job according to its schedule and | |
// records the results until it is told to stop. | |
func (j *job) run() { | |
j.history.Value = fmt.Sprintf("%s:started\n", time.Now().String()) | |
j.history = j.history.Next() | |
for { | |
now := time.Now() | |
e, err := cronexpr.Parse(j.defn.schedule) | |
if err != nil { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
core@db01 ~ $ ping 10.240.169.79 | |
PING 10.240.169.79 (10.240.169.79) 56(84) bytes of data. | |
64 bytes from 10.240.169.79: icmp_seq=1 ttl=64 time=0.849 ms | |
64 bytes from 10.240.169.79: icmp_seq=2 ttl=64 time=0.404 ms | |
^C | |
--- 10.240.169.79 ping statistics --- | |
2 packets transmitted, 2 received, 0% packet loss, time 1000ms | |
rtt min/avg/max/mdev = 0.404/0.626/0.849/0.223 ms | |
core@db01 ~ $ export ETCDCTL_PEERS="http://10.240.169.79:4001" | |
core@db01 ~ $ etcdctl --debug set /tmp/foo "bar" |
OlderNewer