Add 'grumble ctl'.

This commit is contained in:
Mikkel Krautz 2011-05-13 15:06:54 +02:00
parent 01182d36b3
commit 41f6af2334
10 changed files with 343 additions and 34 deletions

46
ctlrpc.go Normal file
View file

@ -0,0 +1,46 @@
// Copyright (c) 2011 The Grumble Authors
// The use of this source code is goverened by a BSD-style
// license that can be found in the LICENSE-file.
package main
import (
"os"
)
type ControlRPC struct {
}
// Start a server
func (c *ControlRPC) Start(in *int, out *int) os.Error {
return nil
}
// Stop a server
func (c *ControlRPC) Stop(in *int, out *int) os.Error {
return nil
}
type ConfigValue struct {
Id int64
Key string
Value string
}
// Set a config value
func (c *ControlRPC) SetConfig(in *ConfigValue, out *ConfigValue) os.Error {
servers[in.Id].SetConfig(in.Key, in.Value)
out.Id = in.Id
out.Key = in.Key
out.Value = in.Value
return nil
}
// Get a config value
func (c *ControlRPC) GetConfig(in *ConfigValue, out *ConfigValue) os.Error {
out.Id = in.Id
out.Key = in.Key
out.Value = servers[in.Id].GetConfig(in.Key)
return nil
}