Documentation ¶
Index ¶
- Constants
- type LogicRepository
- type LogicRepositoryRedis
- func (repo *LogicRepositoryRedis) AddMapping(c context.Context, mid string, appId string, key string, server string) (err error)
- func (repo *LogicRepositoryRedis) DecGroupServer(c context.Context, appId, key, server string, gid []string) (err error)
- func (repo *LogicRepositoryRedis) DelMapping(c context.Context, mid string, appId string, key string) (has bool, err error)
- func (repo *LogicRepositoryRedis) ExpireMapping(c context.Context, mid string, appId string, key string) (has bool, err error)
- func (repo *LogicRepositoryRedis) GetMember(c context.Context, key string) (appId string, mid string, err error)
- func (repo *LogicRepositoryRedis) GetServer(c context.Context, key string) (server string, err error)
- func (repo *LogicRepositoryRedis) IncGroupServer(c context.Context, appId, key, server string, gid []string) (err error)
- func (repo *LogicRepositoryRedis) KeysByMids(c context.Context, appId string, mids []string) (ress map[string]string, olMids []string, err error)
- func (repo *LogicRepositoryRedis) ServersByGid(c context.Context, appId string, gid string) (res []string, err error)
- func (repo *LogicRepositoryRedis) ServersByGids(c context.Context, appId string, gids []string) (ress map[string][]string, err error)
- func (repo *LogicRepositoryRedis) ServersByKeys(c context.Context, keys []string) (res []string, err error)
Constants ¶
View Source
const (
MidFmt = "%s:%v" // {appId}:{uid}
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LogicRepository ¶
type LogicRepository interface { GetMember(c context.Context, key string) (appId string, mid string, err error) GetServer(c context.Context, key string) (server string, err error) AddMapping(c context.Context, mid string, appId string, key string, server string) (err error) ExpireMapping(c context.Context, mid string, appId string, key string) (has bool, err error) DelMapping(c context.Context, mid string, appId string, key string) (has bool, err error) ServersByKeys(c context.Context, keys []string) (res []string, err error) KeysByMids(c context.Context, appId string, mids []string) (ress map[string]string, olMids []string, err error) IncGroupServer(c context.Context, appId, key, server string, gid []string) (err error) DecGroupServer(c context.Context, appId, key, server string, gid []string) (err error) ServersByGid(c context.Context, appId string, gid string) (res []string, err error) ServersByGids(c context.Context, appId string, gids []string) (ress map[string][]string, err error) }
type LogicRepositoryRedis ¶
type LogicRepositoryRedis struct {
// contains filtered or unexported fields
}
func NewLogicRepositoryRedis ¶
func NewLogicRepositoryRedis(cfg config.Redis) *LogicRepositoryRedis
func (*LogicRepositoryRedis) AddMapping ¶
func (*LogicRepositoryRedis) DecGroupServer ¶
func (*LogicRepositoryRedis) DelMapping ¶
func (*LogicRepositoryRedis) ExpireMapping ¶
func (repo *LogicRepositoryRedis) ExpireMapping(c context.Context, mid string, appId string, key string) (has bool, err error)
ExpireMapping expire a mapping.
func (*LogicRepositoryRedis) IncGroupServer ¶
func (*LogicRepositoryRedis) KeysByMids ¶
func (repo *LogicRepositoryRedis) KeysByMids(c context.Context, appId string, mids []string) (ress map[string]string, olMids []string, err error)
KeysByMids get a key server by mid.
func (*LogicRepositoryRedis) ServersByGid ¶
func (repo *LogicRepositoryRedis) ServersByGid(c context.Context, appId string, gid string) (res []string, err error)
KeysByMids get a key server by mid.
func (*LogicRepositoryRedis) ServersByGids ¶
func (repo *LogicRepositoryRedis) ServersByGids(c context.Context, appId string, gids []string) (ress map[string][]string, err error)
KeysByMids key=server value=gid list
func (*LogicRepositoryRedis) ServersByKeys ¶
func (repo *LogicRepositoryRedis) ServersByKeys(c context.Context, keys []string) (res []string, err error)
ServersByKeys get a server by key.
Click to show internal directories.
Click to hide internal directories.