package object import ( "citrons.xyz/talk/proto" "citrons.xyz/talk/server/session" ) type Object interface { SendRequest(session.Request) } type World struct { objects map[string]Object } func NewWorld() *World { return &World {make(map[string]Object)} } func (w *World) GetObject(id string) Object { return w.objects[id] } func (w *World) PutObject(id string, o Object) { w.objects[id] = o } func (w *World) RemoveObject(id string) { w.objects[id] = nil } func (w *World) NewObject(o Object) string { id := proto.GenId() w.PutObject(id, o) return id }