亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專(zhuān)輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? layoutmanager.h

?? nandflash文件系統(tǒng)源代碼
?? H
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
//---------------------------------------------------------- -*- Mode: C++ -*-// $Id: LayoutManager.h 214 2008-11-05 22:15:43Z sriramsrao $ //// Created 2006/06/06// Author: Sriram Rao//// Copyright 2008 Quantcast Corp.// Copyright 2006-2008 Kosmix Corp.//// This file is part of Kosmos File System (KFS).//// Licensed under the Apache License, Version 2.0// (the "License"); you may not use this file except in compliance with// the License. You may obtain a copy of the License at//// http://www.apache.org/licenses/LICENSE-2.0//// Unless required by applicable law or agreed to in writing, software// distributed under the License is distributed on an "AS IS" BASIS,// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or// implied. See the License for the specific language governing// permissions and limitations under the License.//// \file LayoutManager.h// \brief Layout manager is responsible for laying out chunks on chunk// servers.  Model is that, when a chunkserver connects to the meta// server, the layout manager gets notified; the layout manager then// uses the chunk server for data placement.////----------------------------------------------------------------------------#ifndef META_LAYOUTMANAGER_H#define META_LAYOUTMANAGER_H#include <map>#include <tr1/unordered_map>#include <vector>#include <set>#include <sstream>#include "kfstypes.h"#include "meta.h"#include "queue.h"#include "ChunkServer.h"#include "LeaseCleaner.h"#include "ChunkReplicator.h"#include "libkfsIO/Counter.h"namespace KFS{	///	/// For disk space utilization balancing, we say that a server	/// is "under utilized" if is below XXX% full; we say that a server	/// is "over utilized" if it is above YYY% full.  For rebalancing, we	/// move data from servers that are over-utilized to servers that are	/// under-utilized.  These #'s are intentionally set conservatively; we	/// don't want the system to constantly move stuff between nodes when	/// there isn't much to be gained by it.	///	const float MIN_SERVER_SPACE_UTIL_THRESHOLD = 0.3;	const float MAX_SERVER_SPACE_UTIL_THRESHOLD = 0.9;	/// Model for leases: metaserver assigns write leases to chunkservers;	/// clients/chunkservers can grab read lease on a chunk at any time.	/// The server will typically renew unexpired leases whenever asked.	/// As long as the lease is valid, server promises not to chnage	/// the lease's version # (also, chunk won't disappear as long as	/// lease is valid).	struct LeaseInfo {		LeaseInfo(LeaseType t, int64_t i): leaseType(t), leaseId(i)		{			time(&expires);			// default lease time of 1 min			expires += LEASE_INTERVAL_SECS;		}		LeaseInfo(LeaseType t, int64_t i, ChunkServerPtr &c):			leaseType(t), leaseId(i), chunkServer(c)		{			time(&expires);			// default lease time of 1 min			expires += LEASE_INTERVAL_SECS;		}		static bool IsValidLease(const LeaseInfo &l)		{			time_t now = time(0);			return now <= l.expires;		}		static bool IsValidWriteLease(const LeaseInfo &l)		{			return (l.leaseType == WRITE_LEASE) &&				IsValidLease(l);		}		LeaseType leaseType;		int64_t leaseId;		// set for a write lease		ChunkServerPtr chunkServer;		time_t expires;	};	// Given a chunk-id, where is stored and who has the lease(s)	struct ChunkPlacementInfo {		ChunkPlacementInfo() :			fid(-1), ongoingReplications(0) { }		// For cross-validation, we store the fid here.  This		// is also useful during re-replication: given a chunk, we		// can get its fid and from all the attributes of the file		fid_t fid;		/// is this chunk being (re) replicated now?  if so, how many		int ongoingReplications;		std::vector<ChunkServerPtr> chunkServers;		std::vector<LeaseInfo> chunkLeases;	};	// To support rack-aware placement, we need an estimate of how much	// space is available on each given rack.  Once the set of candidate	// racks are ordered, we walk down the sorted list to pick the	// desired # of servers.  For ordering purposes, we track how much space	// each machine on the rack exports and how much space we have parceled	// out; this gives us an estimate of availble space (we are	// over-counting because the space we parcel out may not be fully used).	class RackInfo {		uint32_t mRackId;		uint64_t mTotalSpace;		uint64_t mAllocSpace;		// set of servers on this rack		std::vector<ChunkServerPtr> mServers;	public:		RackInfo(int id) : mRackId(id), mTotalSpace(0), mAllocSpace(0) { }		inline uint32_t id() const {			return mRackId;		}		void clear() {			mTotalSpace = mAllocSpace = 0;		}		void addServer(ChunkServerPtr &s) {			mTotalSpace += s->GetTotalSpace();			mAllocSpace += s->GetUsedSpace();			mServers.push_back(s);		}		void removeServer(ChunkServer *server) {			std::vector <ChunkServerPtr>::iterator iter;			iter = find_if(mServers.begin(), mServers.end(),					ChunkServerMatcher(server));			if (iter == mServers.end())				return;			mTotalSpace -= server->GetTotalSpace();			mAllocSpace -= server->GetUsedSpace();			mServers.erase(iter);		}		void computeSpace() {			clear();			for(std::vector<ChunkServerPtr>::iterator iter = mServers.begin();				iter != mServers.end(); iter++) {				ChunkServerPtr s = *iter;				mTotalSpace += s->GetTotalSpace();				mAllocSpace += s->GetUsedSpace();			}		}		const std::vector<ChunkServerPtr> &getServers() {			return mServers;		}		uint64_t availableSpace() const {			if (mTotalSpace < mAllocSpace)				// paranoia...				return 0;			return mTotalSpace - mAllocSpace;		}		// want to sort in decreasing order so that racks with more		// space are at the head of list (and so, a node from them will		// get chosen).		bool operator < (const RackInfo &other) const {			uint64_t mine;			mine = availableSpace();			if (mine == 0)				return false;			return mine < other.availableSpace();		}	};	// Functor to enable matching of a rack-id with a RackInfo	class RackMatcher {		uint32_t id;	public:		RackMatcher(uint32_t rackId) : id(rackId) { }		bool operator()(const RackInfo &rack) const {			return rack.id() == id;		}	};	// chunkid to server(s) map	typedef std::map <chunkId_t, ChunkPlacementInfo > CSMap;	typedef std::map <chunkId_t, ChunkPlacementInfo >::const_iterator CSMapConstIter;	typedef std::map <chunkId_t, ChunkPlacementInfo >::iterator CSMapIter;#if 0	typedef std::tr1::unordered_map <chunkId_t, ChunkPlacementInfo > CSMap;	typedef std::tr1::unordered_map <chunkId_t, ChunkPlacementInfo >::const_iterator CSMapConstIter;	typedef std::tr1::unordered_map <chunkId_t, ChunkPlacementInfo >::iterator CSMapIter;#endif	// candidate set of chunks whose replication needs checking	typedef std::set <chunkId_t> CRCandidateSet;	typedef std::set <chunkId_t>::iterator CRCandidateSetIter;	//	// For maintenance reasons, we'd like to schedule downtime for a server.	// When the server is taken down, a promise is made---the server will go	// down now and come back up by a specified time. During this window, we	// are willing to tolerate reduced # of copies for a block.  Now, if the	// server doesn't come up by the promised time, the metaserver will	// initiate re-replication of blocks on that node.  This ability allows	// us to schedule downtime on a node without having to incur the	// overhead of re-replication.	//	struct HibernatingServerInfo_t {		// the server we put in hibernation		ServerLocation location;		// the blocks on this server		CRCandidateSet blocks;		// when is it likely to wake up		time_t sleepEndTime;	};        ///        /// LayoutManager is responsible for write allocation:        /// it determines where to place a chunk based on metrics such as,        /// which server has the most space, etc.  Will eventually be        /// extend this model to include replication.        ///        /// Allocating space for a chunk is a 3-way communication:        ///  1. Client sends a request to the meta server for        /// allocation        ///  2. Meta server picks a chunkserver to hold the chunk and        /// then sends an RPC to that chunkserver to create a chunk.        ///  3. The chunkserver creates a chunk and replies to the        /// meta server's RPC.        ///  4. Finally, the metaserver logs the allocation request        /// and then replies to the client.        ///        /// In this model, the layout manager picks the chunkserver        /// location and queues the RPC to the chunkserver.  All the        /// communication is handled by a thread in NetDispatcher        /// which picks up the RPC request and sends it on its merry way.        ///	class LayoutManager {	public:		LayoutManager();		virtual ~LayoutManager() { }                /// A new chunk server has joined and sent a HELLO message.                /// Use it to configure information about that server                /// @param[in] r  The MetaHello request sent by the                /// new chunk server.		void AddNewServer(MetaHello *r);                /// Our connection to a chunkserver went down.  So,                /// for all chunks hosted on this server, update the                /// mapping table to indicate that we can't                /// get to the data.                /// @param[in] server  The server that is down		void ServerDown(ChunkServer *server);		/// A server is being taken down: if downtime is > 0, it is a		/// value in seconds that specifies the time interval within		/// which the server will connect back.  If it doesn't connect		/// within that interval, the server is assumed to be down and		/// re-replication will start.		int RetireServer(const ServerLocation &loc, int downtime);                /// Allocate space to hold a chunk on some                /// chunkserver.                /// @param[in] r The request associated with the                /// write-allocation call.                /// @retval 0 on success; -1 on failure		int AllocateChunk(MetaAllocate *r);		/// A chunkid has been previously allocated.  The caller		/// is trying to grab the write lease on the chunk. If a valid		/// lease exists, we return it; otherwise, we assign a new lease,		/// bump the version # for the chunk and notify the caller.		///                /// @param[in] r The request associated with the                /// write-allocation call.		/// @param[out] isNewLease  True if a new lease has been		/// issued, which tells the caller that a version # bump		/// for the chunk has been done.                /// @retval status code		int GetChunkWriteLease(MetaAllocate *r, bool &isNewLease);                /// Delete a chunk on the server that holds it.                /// @param[in] chunkId The id of the chunk being deleted		void DeleteChunk(chunkId_t chunkId);                /// A chunkserver is notifying us that a chunk it has is		/// corrupt; so update our tables to reflect that the chunk isn't		/// hosted on that chunkserver any more; re-replication will take		/// care of recovering that chunk.                /// @param[in] r  The request that describes the corrupted chunk		void ChunkCorrupt(MetaChunkCorrupt *r);                /// Truncate a chunk to the desired size on the server that holds it.                /// @param[in] chunkId The id of the chunk being                /// truncated		/// @param[in] sz    The size to which the should be                /// truncated to.		void TruncateChunk(chunkId_t chunkId, off_t sz);		/// Handlers to acquire and renew leases.  Unexpired leases		/// will typically be renewed.		int GetChunkReadLease(MetaLeaseAcquire *r);		int LeaseRenew(MetaLeaseRenew *r);		/// Handler to let a lease owner relinquish a lease.		int LeaseRelinquish(MetaLeaseRelinquish *r);		/// Is a valid lease issued on any of the chunks in the		/// vector of MetaChunkInfo's?		bool IsValidLeaseIssued(const std::vector <MetaChunkInfo *> &c);                /// Add a mapping from chunkId -> server.                /// @param[in] chunkId  chunkId that has been stored                /// on server c                /// @param[in] fid  fileId associated with this chunk.                /// @param[in] c   server that stores chunk chunkId.                ///   If c == NULL, then, we update the table to                /// reflect chunk allocation; whenever chunk servers                /// start up and tell us what chunks they have, we                /// line things up and see which chunk is stored where.		void AddChunkToServerMapping(chunkId_t chunkId, fid_t fid, ChunkServer *c);		/// Remove the mappings for a chunk.                /// @param[in] chunkId  chunkId for which mapping needs to be nuked.		void RemoveChunkToServerMapping(chunkId_t chunkId);

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩电影一区| 亚洲人午夜精品天堂一二香蕉| 欧美丰满少妇xxxbbb| 欧美在线三级电影| 欧美三级中文字幕在线观看| 欧美曰成人黄网| 欧美日韩国产天堂| 欧美一级欧美一级在线播放| 日韩一区二区三区四区| 日韩欧美国产麻豆| 久久蜜臀中文字幕| 国产欧美日韩视频一区二区| 国产午夜精品一区二区三区视频| 欧美激情一区二区三区全黄| 国产精品伦理一区二区| 亚洲视频在线观看三级| 一区二区三区蜜桃| 性做久久久久久免费观看| 天天综合色天天| 久久国产免费看| 高清成人在线观看| 91黄色免费观看| 欧美日韩精品一区视频| 日韩午夜激情免费电影| 久久综合色之久久综合| 国产精品传媒入口麻豆| 一区av在线播放| 日韩不卡一二三区| 国产成人av一区二区三区在线观看| 国产成人精品1024| 欧美亚洲国产一区在线观看网站| 欧美日韩国产影片| 久久精品欧美一区二区三区不卡 | 中文字幕精品一区二区精品绿巨人 | 日本免费在线视频不卡一不卡二| 麻豆视频观看网址久久| 成人av网站在线观看| 欧美亚洲图片小说| 久久久噜噜噜久久中文字幕色伊伊| 国产精品美日韩| 天堂蜜桃91精品| 国产成人自拍网| 91电影在线观看| 日韩免费高清av| 亚洲另类在线制服丝袜| 美女在线观看视频一区二区| 成人深夜视频在线观看| 欧美精品久久天天躁| 日本一区二区三区免费乱视频| 亚洲一区二区在线免费看| 精品一区精品二区高清| 色综合久久综合网97色综合| 日韩午夜在线影院| 一区二区三区在线视频观看| 激情综合色综合久久| 91久久人澡人人添人人爽欧美 | 一区二区三区四区乱视频| 美女视频黄久久| 欧美在线观看视频在线| 久久久精品综合| av男人天堂一区| 日韩免费电影网站| 亚洲国产另类av| k8久久久一区二区三区| 日韩免费观看高清完整版| 亚洲蜜桃精久久久久久久| 国产一区二区女| 91精品国产麻豆国产自产在线 | 久久亚洲精品国产精品紫薇| 亚洲午夜国产一区99re久久| 国产91丝袜在线播放| 日韩欧美一级片| 亚洲一区二区三区爽爽爽爽爽| 福利电影一区二区三区| 日韩三级在线免费观看| 午夜免费久久看| 色综合亚洲欧洲| 国产免费成人在线视频| 久久超级碰视频| 欧美电影影音先锋| 亚洲一区二区三区在线看| av福利精品导航| 欧美国产97人人爽人人喊| 激情欧美一区二区| 欧美一区二区视频观看视频| 亚洲一级二级在线| 91福利在线导航| 亚洲欧美日韩小说| 91一区一区三区| 中文av字幕一区| 国产不卡高清在线观看视频| 精品91自产拍在线观看一区| 免费成人av资源网| 91精品欧美久久久久久动漫| 午夜国产不卡在线观看视频| 精品视频一区二区三区免费| 亚洲亚洲精品在线观看| 在线观看视频一区二区| 一区二区欧美国产| 在线观看欧美黄色| 亚洲最新视频在线播放| 在线免费观看视频一区| 亚洲自拍都市欧美小说| 欧美性大战久久久久久久蜜臀| 一区二区高清免费观看影视大全| 91免费国产在线观看| 一区二区三区四区av| 欧美做爰猛烈大尺度电影无法无天| 亚洲黄网站在线观看| 91激情五月电影| 天天操天天干天天综合网| 在线综合亚洲欧美在线视频| 奇米色777欧美一区二区| 日韩欧美国产精品一区| 国产在线精品免费| 国产午夜亚洲精品羞羞网站| 成人天堂资源www在线| 亚洲人成网站色在线观看| 欧美无砖专区一中文字| 日韩成人一区二区| 精品三级在线观看| 成人美女视频在线看| 亚洲视频一区二区免费在线观看| 91黄视频在线| 免费成人在线观看视频| 久久久久国产精品麻豆ai换脸 | 91精品国产综合久久婷婷香蕉| 蜜臀91精品一区二区三区| 久久人人超碰精品| av电影在线观看一区| 亚洲成人一二三| 精品国产一区二区精华| 波多野结衣亚洲| 午夜久久福利影院| 26uuu久久天堂性欧美| www.欧美色图| 午夜精品久久久久久久99樱桃 | 一区二区三区四区视频精品免费| 欧美电影在线免费观看| 国产精品一级片| 亚洲精品乱码久久久久久久久| 91精品国产综合久久久蜜臀图片| 国产一区二区三区四| 自拍偷拍亚洲综合| 日韩三级免费观看| heyzo一本久久综合| 亚洲成人精品一区二区| wwwwxxxxx欧美| 欧洲精品视频在线观看| 精品一区二区三区在线视频| 亚洲天堂福利av| 日韩视频123| 色综合色综合色综合| 国内不卡的二区三区中文字幕| 日韩伦理av电影| 亚洲精品在线免费播放| 色呦呦国产精品| 精品一二三四区| 亚洲一区二区三区视频在线播放| 精品免费一区二区三区| 在线看国产日韩| 国产成人精品三级麻豆| 日本欧美大码aⅴ在线播放| 亚洲欧美综合色| 日韩精品一区二区三区视频播放| 91蝌蚪porny九色| 国产一区二区三区四区五区美女 | 久久久美女艺术照精彩视频福利播放| 91福利在线导航| 国产69精品久久99不卡| 日本少妇一区二区| 亚洲精品亚洲人成人网在线播放| 久久综合999| 51精品秘密在线观看| 色综合色综合色综合色综合色综合| 狠狠狠色丁香婷婷综合激情 | 日韩av不卡一区二区| 亚洲欧洲性图库| 国产视频一区二区在线观看| 欧美巨大另类极品videosbest| 不卡的电影网站| 国产一区二区精品久久| 日韩成人午夜电影| 亚洲香蕉伊在人在线观| 国产精品激情偷乱一区二区∴| xf在线a精品一区二区视频网站| 欧美三电影在线| 色欧美乱欧美15图片| 99国产一区二区三精品乱码| 国产成人激情av| 韩国欧美一区二区| 久草这里只有精品视频| 日韩精品一卡二卡三卡四卡无卡| 夜夜夜精品看看| 亚洲免费观看高清在线观看| 中文字幕中文在线不卡住| 中文字幕成人在线观看| 国产欧美精品在线观看| 久久久久久久久久久久电影| 精品国产第一区二区三区观看体验|