📄 request.h
字号:
};/*! * \brief Replicate RPC from meta server to chunk server. This * message is sent to a "destination" chunk server---that is, a chunk * server is told to create a copy of chunk from some source that is * already hosting the chunk. This model allows the destination to * replicate the chunk at its convenieance. */struct MetaChunkReplicate: public MetaChunkRequest { fid_t fid; //!< input: we tell the chunkserver what it is chunkId_t chunkId; //!< The chunk id to replicate seq_t chunkVersion; //!< output: the chunkservers tells us what it did ServerLocation srcLocation; //!< where to get a copy from ChunkServerPtr server; //!< "dest" on which we put a copy MetaChunkReplicate(seq_t n, ChunkServer *s, fid_t f, chunkId_t c, seq_t v, const ServerLocation &l): MetaChunkRequest(META_CHUNK_REPLICATE, n, false, NULL, s), fid(f), chunkId(c), chunkVersion(v), srcLocation(l) { } //!< generate the request string that should be sent out void request(ostringstream &os); int log(ofstream &file) const; string Show() { ostringstream os; os << "meta->chunk replicate: "; os << " fileId = " << fid; os << " chunkId = " << chunkId; os << " chunkVersion = " << chunkVersion; return os.str(); }};/*! * \brief As a chunkserver for the size of a particular chunk. We use this RPC * to compute the filesize: whenever the lease on the last chunk of the file * expires, we get the chunk's size and then determine the filesize. */struct MetaChunkSize: public MetaChunkRequest { fid_t fid; //!< input: we use the tuple <fileid, chunkid> to //!< find the entry we need. chunkId_t chunkId; //!< input: the chunk whose size we need off_t chunkSize; //!< output: the chunk size MetaChunkSize(seq_t n, ChunkServer *s, fid_t f, chunkId_t c) : MetaChunkRequest(META_CHUNK_SIZE, n, false, NULL, s), fid(f), chunkId(c), chunkSize(-1) { } //!< generate the request string that should be sent out void request(ostringstream &os); int log(ofstream &file) const; string Show() { ostringstream os; os << "meta->chunk size: "; os << " fileId = " << fid; os << " chunkId = " << chunkId; return os.str(); }};/*! * \brief Heartbeat RPC from meta server to chunk server. We can * ask the chunk server for lots of stuff; for now, we ask it * how much is available/used up. */struct MetaChunkHeartbeat: public MetaChunkRequest { MetaChunkHeartbeat(seq_t n, ChunkServer *s): MetaChunkRequest(META_CHUNK_HEARTBEAT, n, false, NULL, s) { } //!< generate the request string that should be sent out void request(ostringstream &os); int log(ofstream &file) const; string Show() { return "meta->chunk heartbeat"; }};/*! * \brief Stale chunk notification message from meta->chunk. This * tells the chunk servers the id's of stale chunks, which the chunk * server should get rid of. */struct MetaChunkStaleNotify: public MetaChunkRequest { MetaChunkStaleNotify(seq_t n, ChunkServer *s): MetaChunkRequest(META_CHUNK_STALENOTIFY, n, false, NULL, s) { } vector<chunkId_t> staleChunkIds; //!< chunk ids that are stale //!< generate the request string that should be sent out void request(ostringstream &os); int log(ofstream &file) const; string Show() { return "meta->chunk stale notify"; }};/*! * For scheduled downtime, we evacaute all the chunks on a server; when * we know that the evacuation is finished, we tell the chunkserver to retire. */struct MetaChunkRetire: public MetaChunkRequest { MetaChunkRetire(seq_t n, ChunkServer *s): MetaChunkRequest(META_CHUNK_RETIRE, n, false, NULL, s) { } int log(ofstream &file) const; //!< generate the request string that should be sent out void request(ostringstream &os); string Show() { return "chunkserver retire"; }};/*! * \brief For monitoring purposes, a client/tool can send a PING * request. In response, the server replies with the list of all * connected chunk servers and their locations as well as some state * about each of those servers. */struct MetaPing: public MetaRequest { string systemInfo; //!< result that describes system info (space etc) string servers; //!< result that contains info about chunk servers string retiringServers; //!< info about servers that are being retired string downServers; //!< info about servers that have gone down MetaPing(seq_t s): MetaRequest(META_PING, s, false) { } int log(ofstream &file) const; void response(ostringstream &os); string Show() { return "ping"; }};/*! * \brief For monitoring purposes, a client/tool can request metaserver * to provide a list of live chunkservers. */struct MetaUpServers: public MetaRequest { ostringstream stringStream; MetaUpServers(seq_t s): MetaRequest(META_UPSERVERS, s, false) { } int log(ofstream &file) const; void response(ostringstream &os); string Show() { return "upservers"; }};/*! * \brief To toggle WORM mode of metaserver a client/tool can send a * TOGGLE_WORM request. In response, the server changes its WORM state. */struct MetaToggleWORM: public MetaRequest { bool value; // !< Enable/disable WORM MetaToggleWORM(seq_t s, bool v): MetaRequest(META_TOGGLE_WORM, s, false), value(v) { } int log(ofstream &file) const; void response(ostringstream &os); string Show() { if (value) return "Toggle WORM: Enabled"; else return "Toggle WORM: Disabled"; }};/*! * \brief For monitoring purposes, a client/tool can send a STATS * request. In response, the server replies with the list of all * counters it keeps. */struct MetaStats: public MetaRequest { string stats; //!< result MetaStats(seq_t s): MetaRequest(META_STATS, s, false) { } int log(ofstream &file) const; void response(ostringstream &os); string Show() { return "stats"; }};/*! * \brief For debugging purposes, dump out the chunk->location map * to a file. */struct MetaDumpChunkToServerMap: public MetaRequest { MetaDumpChunkToServerMap(seq_t s): MetaRequest(META_DUMP_CHUNKTOSERVERMAP, s, false) { } int log(ofstream &file) const; void response(ostringstream &os); string Show() { return "dump chunk2server map"; }};/*! * \brief For monitoring purposes, a client/tool can send a OPEN FILES * request. In response, the server replies with the list of all * open files---files for which there is a valid lease */struct MetaOpenFiles: public MetaRequest { string openForRead; //!< result string openForWrite; //!< result MetaOpenFiles(seq_t s): MetaRequest(META_OPEN_FILES, s, false) { } int log(ofstream &file) const; void response(ostringstream &os); string Show() { return "open files"; }};/*! * \brief Op for handling a notify of a corrupt chunk */struct MetaChunkCorrupt: public MetaRequest { fid_t fid; //!< input chunkId_t chunkId; //!< input ChunkServerPtr server; //!< The chunkserver that sent us this message MetaChunkCorrupt(seq_t s, fid_t f, chunkId_t c): MetaRequest(META_CHUNK_CORRUPT, s, false), fid(f), chunkId(c) { } int log(ofstream &file) const; void response(ostringstream &os); string Show() { ostringstream os; os << "corrupt chunk: fid = " << fid << " chunkid = " << chunkId; return os.str(); }};/*! * \brief Op for acquiring a lease on a chunk of a file. */struct MetaLeaseAcquire: public MetaRequest { chunkId_t chunkId; //!< input LeaseType leaseType; //!< input int64_t leaseId; //!< result MetaLeaseAcquire(seq_t s, chunkId_t c): MetaRequest(META_LEASE_ACQUIRE, s, false), chunkId(c), leaseType(READ_LEASE), leaseId(-1) { } int log(ofstream &file) const; void response(ostringstream &os); string Show() { ostringstream os; os << "lease acquire: "; if (leaseType == READ_LEASE) os << "read lease "; else os << "write lease "; os << " chunkId = " << chunkId; return os.str(); }};/*! * \brief Op for renewing a lease on a chunk of a file. */struct MetaLeaseRenew: public MetaRequest { LeaseType leaseType; //!< input chunkId_t chunkId; //!< input int64_t leaseId; //!< input MetaLeaseRenew(seq_t s, LeaseType t, chunkId_t c, int64_t l): MetaRequest(META_LEASE_RENEW, s, false), leaseType(t), chunkId(c), leaseId(l) { } int log(ofstream &file) const; void response(ostringstream &os); string Show() { ostringstream os; os << "lease renew: "; if (leaseType == READ_LEASE) os << "read lease "; else os << "write lease "; os << " chunkId = " << chunkId; return os.str(); }};/*! * \brief Op for relinquishing a lease on a chunk of a file. */struct MetaLeaseRelinquish: public MetaRequest { LeaseType leaseType; //!< input chunkId_t chunkId; //!< input int64_t leaseId; //!< input MetaLeaseRelinquish(seq_t s, LeaseType t, chunkId_t c, int64_t l): MetaRequest(META_LEASE_RELINQUISH, s, false), leaseType(t), chunkId(c), leaseId(l) { } int log(ofstream &file) const; void response(ostringstream &os); string Show() { ostringstream os; os << "lease relinquish: "; if (leaseType == READ_LEASE) os << "read lease "; else os << "write lease "; os << " chunkId = " << chunkId << " leaseId = " << leaseId; return os.str(); }};/*! * \brief An internally generated op to force the cleanup of * dead leases thru the main event processing loop. */struct MetaLeaseCleanup: public MetaRequest { MetaLeaseCleanup(seq_t s, KfsCallbackObj *c): MetaRequest(META_LEASE_CLEANUP, s, false) { clnt = c; } int log(ofstream &file) const; string Show() { return "lease cleanup"; }};/*! * \brief An internally generated op to check that the degree * of replication for each chunk is satisfactory. This op goes * thru the main event processing loop. */struct MetaChunkReplicationCheck : public MetaRequest { MetaChunkReplicationCheck(seq_t s, KfsCallbackObj *c): MetaRequest(META_CHUNK_REPLICATION_CHECK, s, false) { clnt = c; } int log(ofstream &file) const; string Show() { return "chunk replication check"; }};extern int ParseCommand(char *cmdBuf, int cmdLen, MetaRequest **res);extern void initialize_request_handlers();extern void process_request();extern void submit_request(MetaRequest *r);extern void printleaves();extern void ChangeIncarnationNumber(MetaRequest *r);extern void RegisterCounters();extern void setClusterKey(const char *key);extern void setMD5SumFn(const char *md5sumFn);extern void setWORMMode(bool value);}#endif /* !defined(KFS_REQUEST_H) */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -