Documentation
¶
Index ¶
- Constants
- Variables
- func CkLogedUser(ckcode string) (ili *IsLoginInfo, ok bool)
- func MergePower(p1, p2, p3 UserPower) UserPower
- func StartSystem()
- func StorageChanSequence()
- type AsyncCacheFullTextIndex
- func (acf *AsyncCacheFullTextIndex) AsyncCache()
- func (acf *AsyncCacheFullTextIndex) Insert(mode, hashid, htype string)
- func (acf *AsyncCacheFullTextIndex) InsertWord(word string)
- func (acf *AsyncCacheFullTextIndex) Search(key_word, htype string, uid uint16) (hashid []string, key_count uint64)
- func (acf *AsyncCacheFullTextIndex) SearchString(key_word, htype string, uid uint16) (hashids string, key_count uint64)
- type GlobalResourceLock
- func (grl *GlobalResourceLock) CheckLock(uid, rid, pid string, ltype uint8) (err error)
- func (grl *GlobalResourceLock) Clean()
- func (grl *GlobalResourceLock) Lock(userid string, resourceid string, locktype uint8) (processid string, err error)
- func (grl *GlobalResourceLock) TryLock(userid string, resourceid string, locktype uint8) (processid string, err error)
- func (grl *GlobalResourceLock) Unlock(resourceid, processid string) (err error)
- func (grl *GlobalResourceLock) Uptime(resourceid, processid string) (err error)
- type GlobalResourceLockStruct
- type GlobalResourceLockUser
- type StorageInfo
Constants ¶
View Source
const StorageSequenceNum = 999 //存储内序列目录的最大值
Variables ¶
View Source
var DbConn *sql.DB //数据库连接
View Source
var ErrLog *log.Logger //错误日志
View Source
var GlobalRelativePath string //全局相对路径
View Source
var LogInfo *log.Logger //日志
View Source
var ServerConfig *goconfig.ConfigFile //配置文件
View Source
var StorageArray []StorageInfo //存储盘位置
View Source
var StorageChan = make(chan StorageInfo, 5)
View Source
var UserLoginStatus *UserIsLogin //登录用户表
Functions ¶
func CkLogedUser ¶
ckLogedUser 检查已经登录的用户是否存在,或者是否登录超时
func MergePower ¶
func MergePower(p1, p2, p3 UserPower) UserPower
mergePower 根据Unit、Group、User中的权限合并出最大值
func StartSystem ¶
func StartSystem()
func StorageChanSequence ¶
func StorageChanSequence()
Types ¶
type AsyncCacheFullTextIndex ¶
type AsyncCacheFullTextIndex struct { Del chan acftiAid Up chan acftiAid KeyWord chan string }
正式
var SearchCache *AsyncCacheFullTextIndex //搜索缓存
func NewAsyncCachFullTextIndex ¶
func NewAsyncCachFullTextIndex(modewait int64) *AsyncCacheFullTextIndex
NewAsyncCachFullTextIndex 新建异步缓存全文索引
func (*AsyncCacheFullTextIndex) AsyncCache ¶
func (acf *AsyncCacheFullTextIndex) AsyncCache()
AsyncCache 异步缓存
func (*AsyncCacheFullTextIndex) Insert ¶
func (acf *AsyncCacheFullTextIndex) Insert(mode, hashid, htype string)
Insert 插入一条待处理数据
func (*AsyncCacheFullTextIndex) InsertWord ¶
func (acf *AsyncCacheFullTextIndex) InsertWord(word string)
InsertWord 插入个待处理关键词
func (*AsyncCacheFullTextIndex) Search ¶
func (acf *AsyncCacheFullTextIndex) Search(key_word, htype string, uid uint16) (hashid []string, key_count uint64)
Search 执行搜索
func (*AsyncCacheFullTextIndex) SearchString ¶
func (acf *AsyncCacheFullTextIndex) SearchString(key_word, htype string, uid uint16) (hashids string, key_count uint64)
SearchString 返回一个逗号分割的字符串
type GlobalResourceLock ¶
type GlobalResourceLock struct {
// contains filtered or unexported fields
}
var GlobalLock *GlobalResourceLock //全局资源锁
func NewGlobalResourceLock ¶
func NewGlobalResourceLock() *GlobalResourceLock
func (*GlobalResourceLock) CheckLock ¶
func (grl *GlobalResourceLock) CheckLock(uid, rid, pid string, ltype uint8) (err error)
CheckLock 检查锁状态是否正确
func (*GlobalResourceLock) Clean ¶
func (grl *GlobalResourceLock) Clean()
Clean 清理已经过期的条目,实际清理的过期时间是设置的两倍
func (*GlobalResourceLock) Lock ¶
func (grl *GlobalResourceLock) Lock(userid string, resourceid string, locktype uint8) (processid string, err error)
Lock 添加一个锁 1. 查看资源是否已经有锁 2. 如果有锁则看是读锁还是写锁,如果是写锁,则看是否已经超时,如果不超时则退回,如果超时则修改添加 3. 如果是读锁,而自己也是读锁,则把自己加到读锁序列 4. 如果是读锁,而自己是写锁,则遍历读锁看是否全部超时,如果全部超时就删除读锁新建写锁 5. 如果资源没有锁,则添加锁 6. 最终返回进程hashid
func (*GlobalResourceLock) TryLock ¶
func (grl *GlobalResourceLock) TryLock(userid string, resourceid string, locktype uint8) (processid string, err error)
TryLock 尝试加锁10次,每次停顿1秒钟,如果10次都不成功则返回错误
func (*GlobalResourceLock) Unlock ¶
func (grl *GlobalResourceLock) Unlock(resourceid, processid string) (err error)
Unlock 解锁
func (*GlobalResourceLock) Uptime ¶
func (grl *GlobalResourceLock) Uptime(resourceid, processid string) (err error)
Uptime 更新时间
type GlobalResourceLockStruct ¶
type GlobalResourceLockStruct struct { ReadProcess map[string]*GlobalResourceLockUser //string为进程hashid WriteProcess string //写锁的进程hashid WriteUser *GlobalResourceLockUser LockType uint8 // 加锁类型:1写,2读 }
type GlobalResourceLockUser ¶
Click to show internal directories.
Click to hide internal directories.