func NewWikiEngine(state pinterface.IUserState) *WikiEngine { pool := state.Pool() wikiState := new(WikiState) wikiState.pages = simpleredis.NewHashMap(pool, "pages") wikiState.pages.SelectDatabase(state.DatabaseIndex()) wikiState.pool = pool return &WikiEngine{state, wikiState} }
func NewTimeTableEngine(state pinterface.IUserState) *TimeTableEngine { pool := state.Pool() timeTableState := new(TimeTableState) timeTableState.plans = simpleredis.NewHashMap(pool, "plans") timeTableState.plans.SelectDatabase(state.DatabaseIndex()) timeTableState.pool = pool return &TimeTableEngine{state, timeTableState} }
func NewChatEngine(userState pinterface.IUserState) *ChatEngine { pool := userState.Pool() dbindex := userState.DatabaseIndex() chatState := new(ChatState) chatState.active = pinterface.NewSet(pool, "active") chatState.active.SelectDatabase(dbindex) chatState.said = pinterface.NewList(pool, "said") chatState.said.SelectDatabase(dbindex) chatState.userInfo = pinterface.NewHashMap(pool, "userInfo") // lastSeen.time is an encoded timestamp for when the user was last seen chatting chatState.userInfo.SelectDatabase(dbindex) chatState.pool = pool return &ChatEngine{userState, chatState} }