Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use RadosClient OSDC

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article introduces the relevant knowledge of "how to use RadosClient OSDC". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

RadosClient.hclass librados::RadosClient: public Dispatcher / / inherits from Dispatcher (messaging class) {public: using Dispatcher::cct; md_config_t * conf; / / configuration file private: enum {DISCONNECTED, CONNECTING, CONNECTED,} state; / / Network connection status MonClient monclient / / monc Messenger * messenger; / / Network messaging Interface uint64_t instance_id; / / functions of the related message distribution Dispatcher class rewrite bool _ dispatch (Message * m); bool ms_dispatch (Message * m); bool ms_get_authorizer (int dest_type, AuthAuthorizer * * authorizer, bool force_new); void ms_handle_connect (Connection * con); bool ms_handle_reset (Connection * con) Void ms_handle_remote_reset (Connection * con); Objecter * objecter; / / Osdc module for sending encapsulated OP messages Mutex lock; Cond cond; SafeTimer timer; / / timer int refcnt; version_t log_last_version; rados_log_callback_t log_cb; void * log_cb_arg; string log_watch; int wait_for_osdmap (); public: Finisher finisher / / callback function class explicit RadosClient (CephContext * cct_); ~ RadosClient (); int ping_monitor (string mon_id, string * result); int connect (); / / connect void shutdown (); int watch_flush (); int async_watch_flush (AioCompletionImpl * c); uint64_t get_instance_id (); int wait_for_latest_osdmap () / / create ioctx int create_ioctx (const char * name, IoCtxImpl * * io) based on pool name or id; int create_ioctx (int64_t, IoCtxImpl * * io); int get_fsid (std::string * s); / / pool related operations int64_t lookup_pool (const char * name); bool pool_requires_alignment (int64_t pool_id); int pool_requires_alignment2 (int64_t pool_id, bool * requires) Uint64_t pool_required_alignment (int64_t pool_id); int pool_required_alignment2 (int64_t pool_id, uint64_t * alignment); int pool_get_auid (uint64_t pool_id, unsigned long long * auid); int pool_get_name (uint64_t pool_id, std::string * auid); int pool_list (std::list& ls); int get_pool_stats (std::list& ls, map& result) Int get_fs_stats (ceph_statfs& result); / *-1 was set as the default value and monitor will pickup the right crush rule with below order: a) the first ruleset in crush ruleset c) error out if no value find * / / create pool synchronously and create pool int pool_create asynchronously (string& name, unsigned long long auid=0, int16_t crush_rule=-1) Int pool_create_async (string& name, PoolAsyncCompletionImpl * c, unsigned long long auid=0, int16_t crush_rule=-1); int pool_get_base_tier (int64_t pool_id, int64_t* base_tier); / / synchronous and asynchronous deletion int pool_delete (const char * name); int pool_delete_async (const char * name, PoolAsyncCompletionImpl * c); int blacklist_add (const string& client_address, uint32_t expire_seconds) / / Mon command processing, call monclient.start_mon_command to send commands to Mon processing int mon_command (const vector& cmd, const bufferlist & inbl, bufferlist * outbl, string * outs); int mon_command (int rank, const vector& cmd, const bufferlist & inbl, bufferlist * outbl, string * outs) Int mon_command (string name, const vector& cmd, const bufferlist& inbl, bufferlist * outbl, string * outs); / / OSD command processing, objector- > osd_command sends commands to OSD processing int osd_command (int osd, vector& cmd, const bufferlist& inbl, bufferlist * poutbl, string * prs) / / PG command processing, objector- > pg_command send commands to PG processing int pg_command (pg_t pgid, vector& cmd, const bufferlist& inbl, bufferlist * poutbl, string * prs); void handle_log (MLog * m); int monitor_log (const string& level, rados_log_callback_t cb, void * arg); void get (); bool put (); void blacklist_self (bool set);} Connect () connects int librados::RadosClient::connect () {common_init_finish (cct); int err; / / already connected? If (state = = CONNECTING) return-EINPROGRESS; if (state = = CONNECTED) return-EISCONN; state = CONNECTING; / / get monmap err = monclient.build_initial_monmap (); / / get initialized Monitor if (err) through configuration file

< 0) goto out; err = -ENOMEM; messenger = Messenger::create_client_messenger(cct, "radosclient"); //创建通信模块 if (!messenger) goto out; // require OSDREPLYMUX feature. this means we will fail to talk to // old servers. this is necessary because otherwise we won't know // how to decompose the reply data into its consituent pieces. messenger->

< true if we are directed at base_pgid, not base_oid // 直接的 pgid pg_t base_pgid; ///< explciti pg target, if any pg_t pgid; ///< last pg we mapped to unsigned pg_num; ///< last pg_num we mapped to unsigned pg_num_mask; ///< last pg_num_mask we mapped to // 启动的osd vector up; ///< set of up osds for last pg we mapped to // acting osd vector acting; ///< set of acting osds for last pg we mapped to // primary int up_primary; ///< primary for last pg we mapped to based on the up set int acting_primary; ///< primary for last pg we mapped to based on the /// acting set // pool 大小 int size; ///< the size of the pool when were were last mapped // pool 最小size int min_size; ///< the min size of the pool when were were last mapped // 是否按位排序 bool sort_bitwise; ///< whether the hobject_t sort order is bitwise // 是否副本 bool used_replica; bool paused; int osd; ///< the final target osd, or -1 }; 操作 struct Op : public RefCountedObject { OSDSession *session; // session 连接 int incarnation; op_target_t target; // 操作目标 ConnectionRef con; // for rx buffer only uint64_t features; // explicitly specified op features vector ops; // 操作集合 snapid_t snapid; SnapContext snapc; ceph::real_time mtime; bufferlist *outbl; vector out_bl; vector out_handler; vector out_rval; int priority; Context *onack, *oncommit; uint64_t ontimeout; Context *oncommit_sync; // used internally by watch/notify ceph_tid_t tid; eversion_t replay_version; // for op replay int attempts; version_t *objver; epoch_t *reply_epoch; ceph::mono_time stamp; epoch_t map_dne_bound; bool budgeted; /// true if we should resend this message on failure bool should_resend; /// true if the throttle budget is get/put on a series of OPs, /// instead of per OP basis, when this flag is set, the budget is /// acquired before sending the very first OP of the series and /// released upon receiving the last OP reply. bool ctx_budgeted; int *data_offset; epoch_t last_force_resend; osd_reqid_t reqid; // explicitly setting reqid };分片 Striper扩展 ObjectExtent 记录分片信息 class ObjectExtent { public: object_t oid; // object id uint64_t objectno; // 序号 uint64_t offset; // in object object内偏移 uint64_t length; // in object 分片长度 uint64_t truncate_size; // in object object_locator_t oloc; // object locator (pool etc) pool位置 vector buffer_extents; // off ->

Len. Extents in buffer being mapped (may be fragmented bc of striping!)}; this is the end of the content of "how to use RadosClient OSDC". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report