本文整理匯總了Golang中github.com/cmu440/tribbler/rpc/storagerpc.RevokeLeaseReply.Status方法的典型用法代碼示例。如果您正苦於以下問題:Golang RevokeLeaseReply.Status方法的具體用法?Golang RevokeLeaseReply.Status怎麽用?Golang RevokeLeaseReply.Status使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/cmu440/tribbler/rpc/storagerpc.RevokeLeaseReply
的用法示例。
在下文中一共展示了RevokeLeaseReply.Status方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: RevokeLease
func (ls *libstore) RevokeLease(args *storagerpc.RevokeLeaseArgs, reply *storagerpc.RevokeLeaseReply) error {
ls.sMutex.Lock()
_, ok := ls.sCache[args.Key]
if ok {
delete(ls.sCache, args.Key)
ls.sMutex.Unlock()
reply.Status = storagerpc.OK
return nil
}
ls.sMutex.Unlock()
ls.lMutex.Lock()
_, ok = ls.lCache[args.Key]
if ok {
delete(ls.lCache, args.Key)
ls.lMutex.Unlock()
reply.Status = storagerpc.OK
return nil
}
ls.lMutex.Unlock()
// Both not found
reply.Status = storagerpc.KeyNotFound
return nil
}
示例2: RevokeLease
func (ls *libstore) RevokeLease(args *storagerpc.RevokeLeaseArgs, reply *storagerpc.RevokeLeaseReply) error {
err := ls.localCache.Revoke(args.Key)
if err == nil {
reply.Status = storagerpc.OK
} else {
reply.Status = storagerpc.KeyNotFound
}
return nil
}
示例3: RevokeLease
func (ls *libstore) RevokeLease(args *storagerpc.RevokeLeaseArgs, reply *storagerpc.RevokeLeaseReply) error {
//fmt.Println("Revoke Happened!")
ok := ls.leases.Revoke(args.Key)
if ok == true {
reply.Status = storagerpc.OK
} else {
reply.Status = storagerpc.KeyNotFound
}
return nil
}
示例4: RevokeLease
func (ls *libstore) RevokeLease(args *storagerpc.RevokeLeaseArgs, reply *storagerpc.RevokeLeaseReply) error {
key := args.Key
if !ls.cacheValid[key] {
delete(ls.cacheGet, key)
delete(ls.cacheList, key)
reply.Status = storagerpc.KeyNotFound
}
ls.cacheValid[key] = false
delete(ls.cacheGet, key)
delete(ls.cacheList, key)
reply.Status = storagerpc.OK
return nil
}
示例5: RevokeLease
func (ls *libstore) RevokeLease(args *storagerpc.RevokeLeaseArgs, reply *storagerpc.RevokeLeaseReply) error {
reply.Status = storagerpc.OK
if _, ok := ls.stringCache[args.Key]; ok {
delete(ls.stringCache, args.Key)
} else if _, ok := ls.listCache[args.Key]; ok {
delete(ls.listCache, args.Key)
} else {
reply.Status = storagerpc.KeyNotFound
}
return nil
}
示例6: RevokeLease
func (ls *libstore) RevokeLease(args *storagerpc.RevokeLeaseArgs, reply *storagerpc.RevokeLeaseReply) error {
fmt.Println("RevodeLease Called:", args.Key, ls.callback)
ls.dMutex.Lock()
defer ls.dMutex.Unlock()
_, ok := ls.dataCache[args.Key]
if ok {
reply.Status = storagerpc.OK
delete(ls.dataCache, args.Key)
} else {
reply.Status = storagerpc.KeyNotFound
}
return nil
}
示例7: RevokeLease
func (ls *libstore) RevokeLease(args *storagerpc.RevokeLeaseArgs, reply *storagerpc.RevokeLeaseReply) error {
_, isInCache := ls.dataMap[args.Key]
if !isInCache {
reply.Status = storagerpc.KeyNotFound
return nil
}
ls.dataMapLock.Lock()
delete(ls.dataMap, args.Key)
ls.dataMapLock.Unlock()
reply.Status = storagerpc.OK
return nil
}
示例8: RevokeLease
func (st *storageTester) RevokeLease(args *storagerpc.RevokeLeaseArgs, reply *storagerpc.RevokeLeaseReply) error {
st.recvRevoke[args.Key] = true
st.compRevoke[args.Key] = false
time.Sleep(time.Duration(st.delay*1000) * time.Millisecond)
st.compRevoke[args.Key] = true
reply.Status = storagerpc.OK
return nil
}
示例9: RevokeLease
func (ls *libstore) RevokeLease(args *storagerpc.RevokeLeaseArgs, reply *storagerpc.RevokeLeaseReply) error {
ls.cache.Lock()
defer ls.cache.Unlock()
delete(ls.cache.c, args.Key)
reply.Status = storagerpc.OK
return nil
}
示例10: RevokeLease
func (st *storageTester) RevokeLease(args *storagerpc.RevokeLeaseArgs, reply *storagerpc.RevokeLeaseReply) error {
LOGE.Println("RevokeLease")
defer LOGE.Print("RevokeLease Finished")
st.recvRevoke[args.Key] = true
st.compRevoke[args.Key] = false
time.Sleep(time.Duration(st.delay*500) * time.Millisecond)
st.compRevoke[args.Key] = true
reply.Status = storagerpc.OK
return nil
}
示例11: RevokeLease
func (ls *libstore) RevokeLease(args *storagerpc.RevokeLeaseArgs, reply *storagerpc.RevokeLeaseReply) error {
ls.value_cache_locker.Lock()
if _, ok := ls.value_cache[args.Key]; ok {
delete(ls.value_cache, args.Key)
reply.Status = storagerpc.OK
ls.value_cache_locker.Unlock()
return nil
}
ls.value_cache_locker.Unlock()
ls.list_cache_locker.Lock()
if _, ok := ls.list_cache[args.Key]; ok {
delete(ls.list_cache, args.Key)
reply.Status = storagerpc.OK
ls.list_cache_locker.Unlock()
return nil
}
ls.list_cache_locker.Unlock()
reply.Status = storagerpc.KeyNotFound
return nil
}
示例12: RevokeLease
func (ls *libstore) RevokeLease(args *storagerpc.RevokeLeaseArgs, reply *storagerpc.RevokeLeaseReply) error {
// return errors.New("not implemented")
key := args.Key
ls.newGetMutex(key)
ls.newListMutex(key)
ls.queryGetMutex[key].Lock()
ls.queryListMutex[key].Lock()
defer ls.queryGetMutex[key].Unlock()
defer ls.queryListMutex[key].Unlock()
_, isvalue := ls.CacheValueSet[key]
_, islist := ls.CacheListSet[key]
if isvalue {
reply.Status = storagerpc.OK
delete(ls.CacheValueSet, key)
} else if islist {
reply.Status = storagerpc.OK
delete(ls.CacheListSet, key)
} else {
reply.Status = storagerpc.KeyNotFound
}
return nil
}
示例13: RevokeLease
func (ls *libstore) RevokeLease(args *storagerpc.RevokeLeaseArgs, reply *storagerpc.RevokeLeaseReply) error {
ls.initiateKeyValueMutex(args.Key)
ls.initiateKeyListMutex(args.Key)
ls.keyValueMutex[args.Key].Lock()
defer ls.keyValueMutex[args.Key].Unlock()
ls.keyListMutex[args.Key].Lock()
defer ls.keyListMutex[args.Key].Unlock()
_, okvalue := ls.keyValue[args.Key]
_, oklist := ls.keylist[args.Key]
if okvalue || oklist {
reply.Status = storagerpc.OK
if okvalue {
delete(ls.keyValue, args.Key)
} else {
delete(ls.keylist, args.Key)
}
} else {
reply.Status = storagerpc.KeyNotFound
}
return nil
}