mirror of https://github.com/qwc/backive.git
Some comments for own sake and some event handler stubs
This commit is contained in:
parent
c5c3b88ce7
commit
ccac2606b3
|
@ -7,8 +7,19 @@ import (
|
|||
)
|
||||
|
||||
func main() {
|
||||
// TODO: do proper signal handling!
|
||||
fmt.Println("vim-go")
|
||||
// load config
|
||||
// find and load config
|
||||
config.Load()
|
||||
|
||||
// init scheduler and check for next needed runs?
|
||||
|
||||
// start event loop
|
||||
// accept event
|
||||
// find associated device and it's backups
|
||||
// mount device
|
||||
// run backups, one after another if multiple
|
||||
// unmount device
|
||||
// end loop
|
||||
|
||||
}
|
||||
|
|
|
@ -1 +1,37 @@
|
|||
package events
|
||||
|
||||
import "net"
|
||||
|
||||
var ls net.Listener
|
||||
var done <-chan struct{}
|
||||
|
||||
func Init(socketPath string) {
|
||||
ls, err = net.Listen(socketPath)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
func RunLoop() {
|
||||
for {
|
||||
go func() {
|
||||
process()
|
||||
}()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func process() {
|
||||
client, err = ls.Accept()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
//TODO: rewrite to be safe regarding buffer length
|
||||
buf := make([]byte, 2048)
|
||||
nr, err := client.Read(buf)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
data := buf[0:nr]
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue