示例#1
0
// Make StorageTester CacheRPC-able
func (st *StorageTester) RevokeLease(args *storageproto.RevokeLeaseArgs, reply *storageproto.RevokeLeaseReply) error {
	//fmt.Printf("Revoke Msg received %s\n", args.Key)
	st.recv_revoke[args.Key] = true
	st.comp_revoke[args.Key] = false
	time.Sleep(time.Duration(st.delay*1000) * time.Millisecond)
	st.comp_revoke[args.Key] = true
	reply.Status = storageproto.OK
	return nil
}
示例#2
0
// RevokeLease
// parameters:
// - args: refer to storageproto.RevokeLeaseArgs
// - reply: refer to storageproto.RevokeLeaseReply
// return:
// - error
// function:
// - set the revoked tag of corresponding entry
func (ls *Libstore) RevokeLease(args *storageproto.RevokeLeaseArgs, reply *storageproto.RevokeLeaseReply) error {
	// Revoke lease
	ls.cacheLock.RLock()
	cacheEntry := ls.cacheMap[args.Key]
	if cacheEntry != nil {
		cacheEntry.revoked = true
	}
	ls.cacheLock.RUnlock()
	reply.Status = storageproto.OK
	return nil
}