Пример #1
0
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}
}
Пример #2
0
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}
}
Пример #3
0
func NewIPEngine(state pinterface.IUserState) *IPEngine {

	// Create a RedisList for storing IP adresses
	ips := simpleredis.NewList(state.Pool(), "IPs")

	ipEngine := new(IPEngine)
	ipEngine.data = ips
	ipEngine.state = state

	return ipEngine
}
Пример #4
0
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}
}