当前位置: 首页>>代码示例>>Golang>>正文


Golang storagerpc.RevokeLeaseReply类代码示例

本文整理汇总了Golang中github.com/cmu440/tribbler/rpc/storagerpc.RevokeLeaseReply的典型用法代码示例。如果您正苦于以下问题:Golang RevokeLeaseReply类的具体用法?Golang RevokeLeaseReply怎么用?Golang RevokeLeaseReply使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了RevokeLeaseReply类的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
}
开发者ID:iedwardwangi,项目名称:Tribbler,代码行数:25,代码来源:libstore_impl.go

示例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
}
开发者ID:201101050424,项目名称:Tribbler,代码行数:9,代码来源:libstore_impl.go

示例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
}
开发者ID:oldady,项目名称:Tribbler,代码行数:11,代码来源:libstore_impl.go

示例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
}
开发者ID:bwoka,项目名称:p2,代码行数:13,代码来源:libstore_impl.go

示例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
}
开发者ID:jbuckman,项目名称:p2-440,代码行数:13,代码来源:libstore_impl.go

示例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
}
开发者ID:wentianqi7,项目名称:15640-distributed-systems,代码行数:15,代码来源:libstore_impl.go

示例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
}
开发者ID:aditij1,项目名称:p2aditijakkamat,代码行数:15,代码来源:libstore_impl.go

示例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
}
开发者ID:baochenhu,项目名称:p2,代码行数:8,代码来源:storagetest.go

示例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
}
开发者ID:oldady,项目名称:ds_p2,代码行数:9,代码来源:libstore_impl.go

示例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
}
开发者ID:201101050424,项目名称:Tribbler,代码行数:10,代码来源:storagetest.go

示例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
}
开发者ID:mallocanswer,项目名称:Tribbler,代码行数:20,代码来源:libstore_impl.go

示例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
}
开发者ID:thuhujin,项目名称:Tribbler,代码行数:23,代码来源:libstore_impl.go

示例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
}
开发者ID:Karthikvb,项目名称:15640_projects,代码行数:24,代码来源:libstore_impl.go


注:本文中的github.com/cmu440/tribbler/rpc/storagerpc.RevokeLeaseReply类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。