func GhostRun(opt *Options) Server { s := Server{ opt: opt, storage: ghost.GetStorage(), } log.Printf("Starting Ghost server on %s", s.opt.GetAddr()) s.handle() return s }
func GhostRun(opt *Options) Server { s := Server{ bufpool: util.NewBufpool(), opt: opt, storage: ghost.GetStorage(), logger: getLogger(opt.GetLogfileName()), } log.Printf("Starting Ghost server on %s", s.opt.GetAddr()) s.handle() return s }
func obtainCollection() *ghost.Collection { return ghost.GetStorage().GetCollection("main") }
package server import ( "testing" "github.com/alexyer/ghost/ghost" "github.com/alexyer/ghost/protocol" ) var ( storage = ghost.GetStorage() c = &client{ Server: &Server{storage: storage}, collection: storage.GetCollection("main"), } ) func testCmd(cmd *protocol.Command) ([]string, error) { return c.execCmd(cmd) } func TestPingCmd(t *testing.T) { cmdId := protocol.CommandId_PING result, err := c.execCmd(&protocol.Command{CommandId: &cmdId}) if result[0] != "Pong!" { t.Errorf("Ping: wrong result: %v, %v", result, err) } } func TestSetCmd(t *testing.T) {