Type Definition ceph_rust::error::RadosResult
+
+ [−]
+
+ [src]
+type RadosResult<T> = Result<T, RadosError>;
diff --git a/docs/COPYRIGHT.txt b/docs/COPYRIGHT.txt index 8773ce6..c69861a 100644 --- a/docs/COPYRIGHT.txt +++ b/docs/COPYRIGHT.txt @@ -27,11 +27,6 @@ included, and carry their own copyright notices and license terms: Licensed under the SIL Open Font License, Version 1.1. See Heuristica-LICENSE.txt. -* jQuery (jquery-2.1.4.min.js): - - Copyright 2005, 2015 jQuery Foundation, Inc. - Licensed under the MIT license (see LICENSE-MIT.txt). - * rustdoc.css, main.js, and playpen.js: Copyright 2015 The Rust Developers. diff --git a/docs/ceph_rust/error/RadosResult.t.html b/docs/ceph_rust/error/RadosResult.t.html new file mode 100644 index 0000000..9ed93ac --- /dev/null +++ b/docs/ceph_rust/error/RadosResult.t.html @@ -0,0 +1,10 @@ + + +
+ + + +Redirecting to type.RadosResult.html...
+ + + \ No newline at end of file diff --git a/docs/ceph_rust/error/enum.RadosError.html b/docs/ceph_rust/error/enum.RadosError.html index bca3c1a..facb009 100644 --- a/docs/ceph_rust/error/enum.RadosError.html +++ b/docs/ceph_rust/error/enum.RadosError.html @@ -9,6 +9,7 @@type RadosResult<T> = Result<T, RadosError>;
1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 23 + 24 + 25 + 26 + 27 + 28 + 29 + 30 + 31 + 32 + 33 + 34 + 35 + 36 + 37 + 38 + 39 + 40 + 41 + 42 + 43 + 44 + 45 + 46 + 47 + 48 + 49 + 50 + 51 + 52 + 53 + 54 + 55 + 56 + 57 + 58 + 59 + 60 + 61 + 62 + 63 + 64 + 65 + 66 + 67 + 68 + 69 + 70 + 71 + 72 + 73 + 74 + 75 + 76 + 77 + 78 + 79 + 80 + 81 + 82 + 83 + 84 + 85 + 86 + 87 + 88 + 89 + 90 + 91 + 92 + 93 + 94 + 95 + 96 + 97 + 98 + 99 +100 +101 +102 +103 +104 +105 +106 +107 +108 +109 +110 +111 +
+// Copyright 2017 LambdaStack All rights reserved. +// +// 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. + +use std::{str, fmt}; +use std::error::Error as StdError; +use std::ffi::{IntoStringError, NulError}; +use std::io::Error; +use std::string::FromUtf8Error; + +use uuid::ParseError; + +/// Custom error handling for the library +#[derive(Debug)] +pub enum RadosError { + FromUtf8Error(FromUtf8Error), + NulError(NulError), + Error(String), + IoError(Error), + IntoStringError(IntoStringError), + ParseError(ParseError), +} + +pub type RadosResult<T> = Result<T, RadosError>; + +impl fmt::Display for RadosError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.write_str(self.description()) + } +} + +impl StdError for RadosError { + fn description(&self) -> &str { + match *self { + RadosError::FromUtf8Error(ref e) => e.description(), + RadosError::NulError(ref e) => e.description(), + RadosError::Error(ref e) => &e, + RadosError::IoError(ref e) => e.description(), + RadosError::IntoStringError(ref e) => e.description(), + RadosError::ParseError(ref e) => e.description(), + } + } + fn cause(&self) -> Option<&StdError> { + match *self { + RadosError::FromUtf8Error(ref e) => e.cause(), + RadosError::NulError(ref e) => e.cause(), + RadosError::Error(_) => None, + RadosError::IoError(ref e) => e.cause(), + RadosError::IntoStringError(ref e) => e.cause(), + RadosError::ParseError(ref e) => e.cause(), + } + } +} + +impl RadosError { + /// Create a new RadosError with a String message + pub fn new(err: String) -> RadosError { + RadosError::Error(err) + } + + /// Convert a RadosError into a String representation. + pub fn to_string(&self) -> String { + match *self { + RadosError::FromUtf8Error(ref err) => err.utf8_error().to_string(), + RadosError::NulError(ref err) => err.description().to_string(), + RadosError::Error(ref err) => err.to_string(), + RadosError::IoError(ref err) => err.description().to_string(), + RadosError::IntoStringError(ref err) => err.description().to_string(), + RadosError::ParseError(_) => "Uuid parse error".to_string(), + } + } +} + +impl From<ParseError> for RadosError { + fn from(err: ParseError) -> RadosError { + RadosError::ParseError(err) + } +} + + +impl From<NulError> for RadosError { + fn from(err: NulError) -> RadosError { + RadosError::NulError(err) + } +} + +impl From<FromUtf8Error> for RadosError { + fn from(err: FromUtf8Error) -> RadosError { + RadosError::FromUtf8Error(err) + } +} +impl From<IntoStringError> for RadosError { + fn from(err: IntoStringError) -> RadosError { + RadosError::IntoStringError(err) + } +} +impl From<Error> for RadosError { + fn from(err: Error) -> RadosError { + RadosError::IoError(err) + } +} ++
1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +
+// Copyright 2017 LambdaStack All rights reserved. +// +// 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. + +use std::str; + +use rustc_serialize::json::*; + +use JsonData; +// use JsonValue; + +/// First json call that takes a JSON formatted string and converts it to JsonData object that can +/// then be traversed using `json_find` via the key path. +pub fn json_data(json_str: &str) -> Option<JsonData> { + match Json::from_str(json_str) { + Ok(json_data) => { + Some(json_data) + }, + Err(_) => { + None + } + } + +} + +/// Looks for the parent object first and then the 'child' object. If the parent object is None +/// then it only looks for the 'child' object. The parent object is used for situations where there +/// may be 'child' objects with the same name. +pub fn json_find(json_data: JsonData, keys: &[&str]) -> Option<JsonData> { + json_data.find_path(keys).cloned() +} + +/// More specific String cast of an individual JsonData object. +pub fn json_as_string(json_data: &JsonData) -> String { + json_data.as_string().unwrap_or("").to_string() +} ++
1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +
+// Copyright 2016 LambdaStack All rights reserved. +// +// 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. + +// NOTE: This attribute only needs to be set once. +#![doc(html_logo_url = "https://lambdastackio.github.io/static/images/lambdastack-200x200.png", + html_favicon_url = "https://lambdastackio.github.io/static/images/favicon.ico", + html_root_url = "https://lambdastackio.github.io/aws-sdk-rust/ceph-rust/ceph_rust/index.html")] + +//! Ceph-rust is a thin layer over the librados C interface. A little higher abstraction layer will +//! be coming next that will encapsulate all of the "C" specific features so that only pure Rust will be needed. +//! +//! Only works on Linux +//! The documentation for librados can be found: +//! http://docs.ceph.com/docs/master/rados/api/librados/ +//! +//! By default Ceph names librados as the following for the given platforms: +//! Hammer release: +//! RHEL/CentOS: +//! /usr/lib64/librados.so.2.0.0 +//! +//! Ubuntu: +//! /usr/lib/librados.so.2.0.0 +//! +//! You will need to do a symlink of the above link to the following: +//! RHEL/CentOS: +//! sudo ln -s /usr/lib64/librados.so.2.0.0 /usr/lib64/librados.so +//! +//! Ubuntu: +//! sudo ln -s /usr/lib/librados.so.2.0.0 /usr/lib/librados.so +//! +//! NOTE: If someone know of another way for Rust to find the librados file then please issue +//! a PR for it. Thanks! +//! +//! See the /examples/ceph.rs for how to use the library. + +#[macro_use] +extern crate bitflags; +extern crate byteorder; +extern crate libc; +#[macro_use] +extern crate nom; +extern crate uuid; +extern crate rustc_serialize; + +pub mod rados; +pub mod ceph; +pub mod utils; +pub mod admin_sockets; +pub mod json; +pub mod error; +pub mod status; + +pub type JsonData = rustc_serialize::json::Json; +pub type JsonValue = rustc_serialize::json::Json; +// pub type JsonError = Error; ++
1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 23 + 24 + 25 + 26 + 27 + 28 + 29 + 30 + 31 + 32 + 33 + 34 + 35 + 36 + 37 + 38 + 39 + 40 + 41 + 42 + 43 + 44 + 45 + 46 + 47 + 48 + 49 + 50 + 51 + 52 + 53 + 54 + 55 + 56 + 57 + 58 + 59 + 60 + 61 + 62 + 63 + 64 + 65 + 66 + 67 + 68 + 69 + 70 + 71 + 72 + 73 + 74 + 75 + 76 + 77 + 78 + 79 + 80 + 81 + 82 + 83 + 84 + 85 + 86 + 87 + 88 + 89 + 90 + 91 + 92 + 93 + 94 + 95 + 96 + 97 + 98 + 99 +100 +101 +102 +103 +104 +105 +106 +107 +108 +109 +110 +111 +112 +113 +114 +115 +116 +117 +118 +119 +120 +121 +122 +123 +124 +125 +126 +127 +128 +129 +130 +131 +132 +133 +134 +135 +136 +137 +138 +139 +140 +141 +142 +143 +144 +145 +146 +147 +148 +149 +150 +151 +152 +153 +154 +155 +156 +157 +158 +159 +160 +161 +162 +163 +164 +165 +166 +167 +168 +169 +170 +171 +172 +173 +174 +175 +176 +177 +178 +179 +180 +181 +182 +183 +184 +185 +186 +187 +188 +189 +190 +191 +192 +193 +194 +195 +196 +197 +198 +199 +200 +201 +202 +203 +204 +205 +206 +207 +208 +209 +210 +211 +212 +213 +214 +215 +216 +217 +218 +219 +220 +221 +222 +223 +224 +225 +226 +227 +228 +229 +230 +231 +232 +233 +234 +235 +236 +237 +238 +239 +240 +241 +242 +243 +244 +245 +246 +247 +248 +249 +250 +251 +252 +253 +254 +255 +256 +257 +258 +259 +260 +261 +262 +263 +264 +265 +266 +267 +268 +269 +270 +271 +272 +273 +274 +275 +276 +277 +278 +279 +280 +281 +282 +283 +284 +285 +286 +287 +288 +289 +290 +291 +292 +293 +294 +295 +296 +297 +298 +299 +300 +301 +302 +303 +304 +305 +306 +307 +308 +309 +310 +311 +312 +313 +314 +315 +316 +317 +318 +319 +320 +321 +322 +323 +324 +325 +326 +327 +328 +329 +330 +331 +332 +333 +334 +335 +336 +337 +338 +339 +340 +341 +342 +343 +344 +345 +346 +347 +348 +349 +350 +351 +352 +353 +354 +355 +356 +357 +358 +359 +360 +361 +362 +363 +364 +365 +366 +367 +368 +369 +370 +371 +372 +373 +374 +375 +376 +377 +378 +379 +380 +381 +382 +383 +384 +385 +386 +387 +388 +389 +390 +391 +392 +393 +394 +395 +396 +397 +398 +399 +400 +401 +402 +403 +404 +405 +406 +407 +408 +409 +410 +411 +412 +413 +414 +415 +416 +417 +418 +419 +420 +421 +422 +423 +424 +425 +426 +427 +428 +429 +430 +431 +432 +433 +434 +435 +436 +437 +438 +439 +440 +441 +442 +443 +444 +445 +446 +447 +448 +449 +450 +451 +452 +453 +454 +455 +456 +457 +458 +459 +460 +461 +462 +463 +464 +465 +466 +467 +468 +469 +470 +471 +472 +473 +474 +475 +476 +477 +478 +479 +480 +481 +482 +483 +484 +485 +486 +487 +488 +489 +490 +491 +492 +493 +494 +495 +496 +497 +498 +499 +500 +501 +502 +503 +504 +505 +506 +507 +508 +509 +510 +511 +512 +513 +514 +515 +516 +517 +518 +519 +520 +521 +522 +523 +524 +525 +526 +527 +528 +529 +530 +531 +532 +533 +534 +535 +536 +537 +538 +539 +540 +541 +542 +543 +544 +545 +546 +547 +548 +549 +550 +551 +552 +553 +554 +555 +556 +557 +558 +559 +560 +561 +562 +563 +564 +565 +566 +567 +568 +569 +570 +571 +572 +573 +574 +575 +576 +577 +578 +579 +580 +581 +582 +583 +584 +585 +586 +587 +588 +589 +590 +591 +592 +593 +594 +595 +596 +597 +598 +599 +600 +601 +602 +603 +604 +605 +606 +607 +608 +609 +610 +611 +612 +613 +614 +615 +616 +617 +618 +
+// Copyright 2017 LambdaStack All rights reserved. +// +// 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. + +// Portions from Chris Holcombe +// The MIT License (MIT) +// +// Copyright (c) 2015 Chris Holcombe +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#![allow(non_camel_case_types)] +#![allow(unused_imports)] + +extern crate libc; + +use self::libc::{int64_t, size_t, ssize_t, time_t, timeval, uint32_t, uint64_t, uint8_t}; + +bitflags! { + pub flags AllocFlags: u32 { + const LIBRADOS_OP_FLAG_EXCL = 1, + const LIBRADOS_OP_FLAG_FAILOK = 2, + const LIBRADOS_OP_FLAG_FADVISE_RANDOM = 4, + const LIBRADOS_OP_FLAG_FADVISE_SEQUENTIAL = 8, + const LIBRADOS_OP_FLAG_FADVISE_WILLNEED = 16, + const LIBRADOS_OP_FLAG_FADVISE_DONTNEED = 32, + const LIBRADOS_OP_FLAG_FADVISE_NOCACHE = 64, + } +} +impl AllocFlags { + pub fn clear(&mut self) { + self.bits = 0; // The `bits` field can be accessed from within the + // same module where the `bitflags!` macro was invoked. + } +} + +bitflags! { + pub flags XattrFlags: u32 { + const LIBRADOS_CMPXATTR_OP_EQ = 1, + const LIBRADOS_CMPXATTR_OP_NE = 2, + const LIBRADOS_CMPXATTR_OP_GT = 3, + const LIBRADOS_CMPXATTR_OP_GTE = 4, + const LIBRADOS_CMPXATTR_OP_LT = 5, + const LIBRADOS_CMPXATTR_OP_LTE = 6, + } +} +impl XattrFlags { + pub fn clear(&mut self) { + self.bits = 0; // The `bits` field can be accessed from within the + // same module where the `bitflags!` macro was invoked. + } +} + +// Flags for rados_read_op_operate(), rados_write_op_operate(), rados_aio_read_op_operate(), +// and rados_aio_write_op_operate() +bitflags! { + pub flags OperationFlags: u32 { + const LIBRADOS_OPERATION_NOFLAG= 0, + const LIBRADOS_OPERATION_BALANCE_READS= 1, + const LIBRADOS_OPERATION_LOCALIZE_READS= 2, + const LIBRADOS_OPERATION_ORDER_READS_WRITES= 4, + const LIBRADOS_OPERATION_IGNORE_CACHE= 8, + const LIBRADOS_OPERATION_SKIPRWLOCKS= 16, + const LIBRADOS_OPERATION_IGNORE_OVERLAY= 32, + } +} + +impl OperationFlags { + pub fn clear(&mut self) { + self.bits = 0; // The `bits` field can be accessed from within the + // same module where the `bitflags!` macro was invoked. + } +} + +pub type rados_t = *mut ::libc::c_void; +pub type rados_config_t = *mut ::libc::c_void; +pub type rados_ioctx_t = *mut ::libc::c_void; +pub type rados_list_ctx_t = *mut ::libc::c_void; +pub type rados_snap_t = uint64_t; +pub type rados_xattrs_iter_t = *mut ::libc::c_void; +pub type rados_omap_iter_t = *mut ::libc::c_void; + +#[repr(C)] +#[derive(Copy, Debug)] +pub struct Struct_rados_pool_stat_t { + pub num_bytes: uint64_t, + pub num_kb: uint64_t, + pub num_objects: uint64_t, + pub num_object_clones: uint64_t, + pub num_object_copies: uint64_t, + pub num_objects_missing_on_primary: uint64_t, + pub num_objects_unfound: uint64_t, + pub num_objects_degraded: uint64_t, + pub num_rd: uint64_t, + pub num_rd_kb: uint64_t, + pub num_wr: uint64_t, + pub num_wr_kb: uint64_t, +} + +impl ::std::clone::Clone for Struct_rados_pool_stat_t { + fn clone(&self) -> Self { + *self + } +} + +impl ::std::default::Default for Struct_rados_pool_stat_t { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} + +#[repr(C)] +#[derive(Copy,Debug)] +pub struct Struct_rados_cluster_stat_t { + pub kb: uint64_t, + pub kb_used: uint64_t, + pub kb_avail: uint64_t, + pub num_objects: uint64_t, +} + +impl ::std::clone::Clone for Struct_rados_cluster_stat_t { + fn clone(&self) -> Self { + *self + } +} + +impl ::std::default::Default for Struct_rados_cluster_stat_t { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} + +pub type rados_write_op_t = *mut ::libc::c_void; + +pub type rados_read_op_t = *mut ::libc::c_void; + +pub type rados_completion_t = *mut ::libc::c_void; + +pub type rados_callback_t = ::std::option::Option<extern "C" fn(cb: rados_completion_t, arg: *mut ::libc::c_void) + -> ()>; + +pub type rados_watchcb_t = ::std::option::Option<extern "C" fn(opcode: uint8_t, + ver: uint64_t, + arg: *mut ::libc::c_void) + -> ()>; + +pub type rados_watchcb2_t = ::std::option::Option<extern "C" fn(arg: *mut ::libc::c_void, + notify_id: uint64_t, + handle: uint64_t, + notifier_id: uint64_t, + data: *mut ::libc::c_void, + data_len: size_t) + -> ()>; + +pub type rados_watcherrcb_t = ::std::option::Option<extern "C" fn(pre: *mut ::libc::c_void, + cookie: uint64_t, + err: ::libc::c_int) + -> ()>; + +pub type rados_log_callback_t = ::std::option::Option<extern "C" fn(arg: *mut ::libc::c_void, + line: *const ::libc::c_char, + who: *const ::libc::c_char, + sec: uint64_t, + nsec: uint64_t, + seq: uint64_t, + level: *const ::libc::c_char, + msg: *const ::libc::c_char) + -> ()>; + +#[cfg(target_os = "linux")] +#[link(name = "rados", kind="dylib")] +extern "C" { + pub fn rados_version(major: *mut ::libc::c_int, minor: *mut ::libc::c_int, extra: *mut ::libc::c_int) -> (); + + pub fn rados_create(cluster: *mut rados_t, id: *const ::libc::c_char) -> ::libc::c_int; + + pub fn rados_create2(pcluster: *mut rados_t, clustername: *const ::libc::c_char, name: *const ::libc::c_char, + flags: uint64_t) + -> ::libc::c_int; + + pub fn rados_create_with_context(cluster: *mut rados_t, cct: rados_config_t) -> ::libc::c_int; + + pub fn rados_ping_monitor(cluster: rados_t, mon_id: *const ::libc::c_char, outstr: *mut *mut ::libc::c_char, + outstrlen: *mut size_t) + -> ::libc::c_int; + + pub fn rados_connect(cluster: rados_t) -> ::libc::c_int; + + pub fn rados_shutdown(cluster: rados_t) -> (); + + pub fn rados_conf_read_file(cluster: rados_t, path: *const ::libc::c_char) -> ::libc::c_int; + + pub fn rados_conf_parse_argv(cluster: rados_t, argc: ::libc::c_int, argv: *mut *const ::libc::c_char) + -> ::libc::c_int; + + pub fn rados_conf_parse_argv_remainder(cluster: rados_t, argc: ::libc::c_int, argv: *mut *const ::libc::c_char, + remargv: *mut *const ::libc::c_char) + -> ::libc::c_int; + + pub fn rados_conf_parse_env(cluster: rados_t, var: *const ::libc::c_char) -> ::libc::c_int; + + pub fn rados_conf_set(cluster: rados_t, option: *const ::libc::c_char, value: *const ::libc::c_char) + -> ::libc::c_int; + + pub fn rados_conf_get(cluster: rados_t, option: *const ::libc::c_char, buf: *mut ::libc::c_char, len: size_t) + -> ::libc::c_int; + + pub fn rados_cluster_stat(cluster: rados_t, result: *mut Struct_rados_cluster_stat_t) -> ::libc::c_int; + + /// The Ceph documentation states that the return value of 0 means success but actually + /// a value < 0 is an error and a value > 0 is the length which should be 36. + /// + pub fn rados_cluster_fsid(cluster: rados_t, buf: *mut ::libc::c_char, len: size_t) -> ::libc::c_int; + + pub fn rados_wait_for_latest_osdmap(cluster: rados_t) -> ::libc::c_int; + + pub fn rados_pool_list(cluster: rados_t, buf: *mut ::libc::c_char, len: size_t) -> ::libc::c_int; + + pub fn rados_cct(cluster: rados_t) -> rados_config_t; + + pub fn rados_get_instance_id(cluster: rados_t) -> uint64_t; + + pub fn rados_ioctx_create(cluster: rados_t, pool_name: *const ::libc::c_char, ioctx: *mut rados_ioctx_t) + -> ::libc::c_int; + + pub fn rados_ioctx_create2(cluster: rados_t, pool_id: int64_t, ioctx: *mut rados_ioctx_t) -> ::libc::c_int; + + pub fn rados_ioctx_destroy(io: rados_ioctx_t) -> (); + + pub fn rados_ioctx_cct(io: rados_ioctx_t) -> rados_config_t; + + pub fn rados_ioctx_get_cluster(io: rados_ioctx_t) -> rados_t; + + pub fn rados_ioctx_pool_stat(io: rados_ioctx_t, stats: *mut Struct_rados_pool_stat_t) -> ::libc::c_int; + + pub fn rados_pool_lookup(cluster: rados_t, pool_name: *const ::libc::c_char) -> int64_t; + + pub fn rados_pool_reverse_lookup(cluster: rados_t, id: int64_t, buf: *mut ::libc::c_char, maxlen: size_t) + -> ::libc::c_int; + + /// Returns -17 if pool already exists. + pub fn rados_pool_create(cluster: rados_t, pool_name: *const ::libc::c_char) -> ::libc::c_int; + + pub fn rados_pool_create_with_auid(cluster: rados_t, pool_name: *const ::libc::c_char, auid: uint64_t) + -> ::libc::c_int; + + pub fn rados_pool_create_with_crush_rule(cluster: rados_t, pool_name: *const ::libc::c_char, + crush_rule_num: uint8_t) + -> ::libc::c_int; + + pub fn rados_pool_create_with_all(cluster: rados_t, pool_name: *const ::libc::c_char, auid: uint64_t, + crush_rule_num: uint8_t) + -> ::libc::c_int; + + pub fn rados_pool_get_base_tier(cluster: rados_t, pool: int64_t, base_tier: *mut int64_t) -> ::libc::c_int; + + pub fn rados_pool_delete(cluster: rados_t, pool_name: *const ::libc::c_char) -> ::libc::c_int; + + pub fn rados_ioctx_pool_set_auid(io: rados_ioctx_t, auid: uint64_t) -> ::libc::c_int; + + pub fn rados_ioctx_pool_get_auid(io: rados_ioctx_t, auid: *mut uint64_t) -> ::libc::c_int; + + pub fn rados_ioctx_pool_requires_alignment(io: rados_ioctx_t) -> ::libc::c_int; + + pub fn rados_ioctx_pool_required_alignment(io: rados_ioctx_t) -> uint64_t; + + pub fn rados_ioctx_get_id(io: rados_ioctx_t) -> int64_t; + + pub fn rados_ioctx_get_pool_name(io: rados_ioctx_t, buf: *mut ::libc::c_char, maxlen: ::libc::c_uint) + -> ::libc::c_int; + + pub fn rados_ioctx_locator_set_key(io: rados_ioctx_t, key: *const ::libc::c_char) -> (); + + pub fn rados_ioctx_set_namespace(io: rados_ioctx_t, nspace: *const ::libc::c_char) -> (); + + pub fn rados_nobjects_list_open(io: rados_ioctx_t, ctx: *mut rados_list_ctx_t) -> ::libc::c_int; + + pub fn rados_nobjects_list_get_pg_hash_position(ctx: rados_list_ctx_t) -> uint32_t; + + pub fn rados_nobjects_list_seek(ctx: rados_list_ctx_t, pos: uint32_t) -> uint32_t; + + pub fn rados_nobjects_list_next(ctx: rados_list_ctx_t, entry: *mut *mut *const ::libc::c_char, + key: *mut *mut *const ::libc::c_char, nspace: *mut *mut *const ::libc::c_char) + -> ::libc::c_int; + + pub fn rados_nobjects_list_close(ctx: rados_list_ctx_t) -> (); + + pub fn rados_objects_list_open(io: rados_ioctx_t, ctx: *mut rados_list_ctx_t) -> ::libc::c_int; + + pub fn rados_objects_list_get_pg_hash_position(ctx: rados_list_ctx_t) -> uint32_t; + + pub fn rados_objects_list_seek(ctx: rados_list_ctx_t, pos: uint32_t) -> uint32_t; + + pub fn rados_objects_list_next(ctx: rados_list_ctx_t, entry: *mut *const ::libc::c_char, + key: *mut *const ::libc::c_char) + -> ::libc::c_int; + + pub fn rados_objects_list_close(ctx: rados_list_ctx_t) -> (); + + pub fn rados_ioctx_snap_create(io: rados_ioctx_t, snapname: *const ::libc::c_char) -> ::libc::c_int; + + pub fn rados_ioctx_snap_remove(io: rados_ioctx_t, snapname: *const ::libc::c_char) -> ::libc::c_int; + + pub fn rados_ioctx_snap_rollback(io: rados_ioctx_t, oid: *const ::libc::c_char, snapname: *const ::libc::c_char) + -> ::libc::c_int; + // Deprecated: Use rados_ioctx_snap_rollback() instead + pub fn rados_rollback(io: rados_ioctx_t, oid: *const ::libc::c_char, snapname: *const ::libc::c_char) + -> ::libc::c_int; + + pub fn rados_ioctx_snap_set_read(io: rados_ioctx_t, snap: rados_snap_t) -> (); + + pub fn rados_ioctx_selfmanaged_snap_create(io: rados_ioctx_t, snapid: *mut rados_snap_t) -> ::libc::c_int; + + pub fn rados_ioctx_selfmanaged_snap_remove(io: rados_ioctx_t, snapid: rados_snap_t) -> ::libc::c_int; + + pub fn rados_ioctx_selfmanaged_snap_rollback(io: rados_ioctx_t, oid: *const ::libc::c_char, snapid: rados_snap_t) + -> ::libc::c_int; + + pub fn rados_ioctx_selfmanaged_snap_set_write_ctx(io: rados_ioctx_t, seq: rados_snap_t, snaps: *mut rados_snap_t, + num_snaps: ::libc::c_int) + -> ::libc::c_int; + + pub fn rados_ioctx_snap_list(io: rados_ioctx_t, snaps: *mut rados_snap_t, maxlen: ::libc::c_int) -> ::libc::c_int; + + pub fn rados_ioctx_snap_lookup(io: rados_ioctx_t, name: *const ::libc::c_char, id: *mut rados_snap_t) + -> ::libc::c_int; + + pub fn rados_ioctx_snap_get_name(io: rados_ioctx_t, id: rados_snap_t, name: *mut ::libc::c_char, + maxlen: ::libc::c_int) + -> ::libc::c_int; + + pub fn rados_ioctx_snap_get_stamp(io: rados_ioctx_t, id: rados_snap_t, t: *mut time_t) -> ::libc::c_int; + + pub fn rados_get_last_version(io: rados_ioctx_t) -> uint64_t; + + pub fn rados_write(io: rados_ioctx_t, oid: *const ::libc::c_char, buf: *const ::libc::c_char, len: size_t, + off: uint64_t) + -> ::libc::c_int; + + pub fn rados_write_full(io: rados_ioctx_t, oid: *const ::libc::c_char, buf: *const ::libc::c_char, len: size_t) + -> ::libc::c_int; + + pub fn rados_clone_range(io: rados_ioctx_t, dst: *const ::libc::c_char, dst_off: uint64_t, + src: *const ::libc::c_char, src_off: uint64_t, len: size_t) + -> ::libc::c_int; + + pub fn rados_append(io: rados_ioctx_t, oid: *const ::libc::c_char, buf: *const ::libc::c_char, len: size_t) + -> ::libc::c_int; + + pub fn rados_read(io: rados_ioctx_t, oid: *const ::libc::c_char, buf: *mut ::libc::c_char, len: size_t, + off: uint64_t) + -> ::libc::c_int; + + pub fn rados_remove(io: rados_ioctx_t, oid: *const ::libc::c_char) -> ::libc::c_int; + + pub fn rados_trunc(io: rados_ioctx_t, oid: *const ::libc::c_char, size: uint64_t) -> ::libc::c_int; + + pub fn rados_getxattr(io: rados_ioctx_t, o: *const ::libc::c_char, name: *const ::libc::c_char, + buf: *mut ::libc::c_char, len: size_t) + -> ::libc::c_int; + + pub fn rados_setxattr(io: rados_ioctx_t, o: *const ::libc::c_char, name: *const ::libc::c_char, + buf: *const ::libc::c_char, len: size_t) + -> ::libc::c_int; + + pub fn rados_rmxattr(io: rados_ioctx_t, o: *const ::libc::c_char, name: *const ::libc::c_char) -> ::libc::c_int; + + pub fn rados_getxattrs(io: rados_ioctx_t, oid: *const ::libc::c_char, iter: *mut rados_xattrs_iter_t) + -> ::libc::c_int; + + pub fn rados_getxattrs_next(iter: rados_xattrs_iter_t, name: *mut *const ::libc::c_char, + val: *mut *const ::libc::c_char, len: *mut size_t) + -> ::libc::c_int; + + pub fn rados_getxattrs_end(iter: rados_xattrs_iter_t) -> (); + + pub fn rados_omap_get_next(iter: rados_omap_iter_t, key: *mut *mut ::libc::c_char, val: *mut *mut ::libc::c_char, + len: *mut size_t) + -> ::libc::c_int; + + pub fn rados_omap_get_end(iter: rados_omap_iter_t) -> (); + + pub fn rados_stat(io: rados_ioctx_t, o: *const ::libc::c_char, psize: *mut uint64_t, pmtime: *mut time_t) + -> ::libc::c_int; + + pub fn rados_tmap_update(io: rados_ioctx_t, o: *const ::libc::c_char, cmdbuf: *const ::libc::c_char, + cmdbuflen: size_t) + -> ::libc::c_int; + + pub fn rados_tmap_put(io: rados_ioctx_t, o: *const ::libc::c_char, buf: *const ::libc::c_char, buflen: size_t) + -> ::libc::c_int; + + pub fn rados_tmap_get(io: rados_ioctx_t, o: *const ::libc::c_char, buf: *mut ::libc::c_char, buflen: size_t) + -> ::libc::c_int; + + pub fn rados_exec(io: rados_ioctx_t, oid: *const ::libc::c_char, cls: *const ::libc::c_char, + method: *const ::libc::c_char, in_buf: *const ::libc::c_char, in_len: size_t, + buf: *mut ::libc::c_char, out_len: size_t) + -> ::libc::c_int; + + pub fn rados_aio_create_completion(cb_arg: *mut ::libc::c_void, cb_complete: rados_callback_t, + cb_safe: rados_callback_t, pc: *mut rados_completion_t) + -> ::libc::c_int; + pub fn rados_aio_wait_for_complete(c: rados_completion_t) -> ::libc::c_int; + pub fn rados_aio_wait_for_safe(c: rados_completion_t) -> ::libc::c_int; + pub fn rados_aio_is_complete(c: rados_completion_t) -> ::libc::c_int; + pub fn rados_aio_is_safe(c: rados_completion_t) -> ::libc::c_int; + pub fn rados_aio_wait_for_complete_and_cb(c: rados_completion_t) -> ::libc::c_int; + pub fn rados_aio_wait_for_safe_and_cb(c: rados_completion_t) -> ::libc::c_int; + pub fn rados_aio_is_complete_and_cb(c: rados_completion_t) -> ::libc::c_int; + pub fn rados_aio_is_safe_and_cb(c: rados_completion_t) -> ::libc::c_int; + pub fn rados_aio_get_return_value(c: rados_completion_t) -> ::libc::c_int; + pub fn rados_aio_release(c: rados_completion_t) -> (); + pub fn rados_aio_write(io: rados_ioctx_t, oid: *const ::libc::c_char, completion: rados_completion_t, + buf: *const ::libc::c_char, len: size_t, off: uint64_t) + -> ::libc::c_int; + pub fn rados_aio_append(io: rados_ioctx_t, oid: *const ::libc::c_char, completion: rados_completion_t, + buf: *const ::libc::c_char, len: size_t) + -> ::libc::c_int; + pub fn rados_aio_write_full(io: rados_ioctx_t, oid: *const ::libc::c_char, completion: rados_completion_t, + buf: *const ::libc::c_char, len: size_t) + -> ::libc::c_int; + pub fn rados_aio_remove(io: rados_ioctx_t, oid: *const ::libc::c_char, completion: rados_completion_t) + -> ::libc::c_int; + pub fn rados_aio_read(io: rados_ioctx_t, oid: *const ::libc::c_char, completion: rados_completion_t, + buf: *mut ::libc::c_char, len: size_t, off: uint64_t) + -> ::libc::c_int; + pub fn rados_aio_flush(io: rados_ioctx_t) -> ::libc::c_int; + pub fn rados_aio_flush_async(io: rados_ioctx_t, completion: rados_completion_t) -> ::libc::c_int; + pub fn rados_aio_stat(io: rados_ioctx_t, o: *const ::libc::c_char, completion: rados_completion_t, + psize: *mut uint64_t, pmtime: *mut time_t) + -> ::libc::c_int; + pub fn rados_aio_cancel(io: rados_ioctx_t, completion: rados_completion_t) -> ::libc::c_int; + pub fn rados_watch(io: rados_ioctx_t, o: *const ::libc::c_char, ver: uint64_t, cookie: *mut uint64_t, + watchcb: rados_watchcb_t, arg: *mut ::libc::c_void) + -> ::libc::c_int; + pub fn rados_watch2(io: rados_ioctx_t, o: *const ::libc::c_char, cookie: *mut uint64_t, + watchcb: rados_watchcb2_t, watcherrcb: rados_watcherrcb_t, arg: *mut ::libc::c_void) + -> ::libc::c_int; + pub fn rados_watch_check(io: rados_ioctx_t, cookie: uint64_t) -> ::libc::c_int; + pub fn rados_unwatch(io: rados_ioctx_t, o: *const ::libc::c_char, cookie: uint64_t) -> ::libc::c_int; + pub fn rados_unwatch2(io: rados_ioctx_t, cookie: uint64_t) -> ::libc::c_int; + pub fn rados_notify(io: rados_ioctx_t, o: *const ::libc::c_char, ver: uint64_t, buf: *const ::libc::c_char, + buf_len: ::libc::c_int) + -> ::libc::c_int; + pub fn rados_notify2(io: rados_ioctx_t, o: *const ::libc::c_char, buf: *const ::libc::c_char, + buf_len: ::libc::c_int, timeout_ms: uint64_t, reply_buffer: *mut *mut ::libc::c_char, + reply_buffer_len: *mut size_t) + -> ::libc::c_int; + pub fn rados_notify_ack(io: rados_ioctx_t, o: *const ::libc::c_char, notify_id: uint64_t, cookie: uint64_t, + buf: *const ::libc::c_char, buf_len: ::libc::c_int) + -> ::libc::c_int; + pub fn rados_watch_flush(cluster: rados_t) -> ::libc::c_int; + pub fn rados_set_alloc_hint(io: rados_ioctx_t, o: *const ::libc::c_char, expected_object_size: uint64_t, + expected_write_size: uint64_t) + -> ::libc::c_int; + pub fn rados_create_write_op() -> rados_write_op_t; + pub fn rados_release_write_op(write_op: rados_write_op_t) -> (); + pub fn rados_write_op_set_flags(write_op: rados_write_op_t, flags: ::libc::c_int) -> (); + pub fn rados_write_op_assert_exists(write_op: rados_write_op_t) -> (); + pub fn rados_write_op_assert_version(write_op: rados_write_op_t, ver: uint64_t) -> (); + pub fn rados_write_op_cmpxattr(write_op: rados_write_op_t, name: *const ::libc::c_char, + comparison_operator: uint8_t, value: *const ::libc::c_char, value_len: size_t) + -> (); + pub fn rados_write_op_omap_cmp(write_op: rados_write_op_t, key: *const ::libc::c_char, + comparison_operator: uint8_t, val: *const ::libc::c_char, val_len: size_t, + prval: *mut ::libc::c_int) + -> (); + pub fn rados_write_op_setxattr(write_op: rados_write_op_t, name: *const ::libc::c_char, + value: *const ::libc::c_char, value_len: size_t) + -> (); + pub fn rados_write_op_rmxattr(write_op: rados_write_op_t, name: *const ::libc::c_char) -> (); + pub fn rados_write_op_create(write_op: rados_write_op_t, exclusive: ::libc::c_int, + category: *const ::libc::c_char) + -> (); + pub fn rados_write_op_write(write_op: rados_write_op_t, buffer: *const ::libc::c_char, len: size_t, + offset: uint64_t) + -> (); + pub fn rados_write_op_write_full(write_op: rados_write_op_t, buffer: *const ::libc::c_char, len: size_t) -> (); + pub fn rados_write_op_append(write_op: rados_write_op_t, buffer: *const ::libc::c_char, len: size_t) -> (); + pub fn rados_write_op_remove(write_op: rados_write_op_t) -> (); + pub fn rados_write_op_truncate(write_op: rados_write_op_t, offset: uint64_t) -> (); + pub fn rados_write_op_zero(write_op: rados_write_op_t, offset: uint64_t, len: uint64_t) -> (); + pub fn rados_write_op_exec(write_op: rados_write_op_t, cls: *const ::libc::c_char, method: *const ::libc::c_char, + in_buf: *const ::libc::c_char, in_len: size_t, prval: *mut ::libc::c_int) + -> (); + pub fn rados_write_op_omap_set(write_op: rados_write_op_t, keys: *const *const ::libc::c_char, + vals: *const *const ::libc::c_char, lens: *const size_t, num: size_t) + -> (); + pub fn rados_write_op_omap_rm_keys(write_op: rados_write_op_t, keys: *const *const ::libc::c_char, + keys_len: size_t) + -> (); + pub fn rados_write_op_omap_clear(write_op: rados_write_op_t) -> (); + pub fn rados_write_op_set_alloc_hint(write_op: rados_write_op_t, expected_object_size: uint64_t, + expected_write_size: uint64_t) + -> (); + pub fn rados_write_op_operate(write_op: rados_write_op_t, io: rados_ioctx_t, oid: *const ::libc::c_char, + mtime: *mut time_t, flags: ::libc::c_int) + -> ::libc::c_int; + pub fn rados_aio_write_op_operate(write_op: rados_write_op_t, io: rados_ioctx_t, completion: rados_completion_t, + oid: *const ::libc::c_char, mtime: *mut time_t, flags: ::libc::c_int) + -> ::libc::c_int; + pub fn rados_create_read_op() -> rados_read_op_t; + pub fn rados_release_read_op(read_op: rados_read_op_t) -> (); + pub fn rados_read_op_set_flags(read_op: rados_read_op_t, flags: ::libc::c_int) -> (); + pub fn rados_read_op_assert_exists(read_op: rados_read_op_t) -> (); + pub fn rados_read_op_assert_version(write_op: rados_read_op_t, ver: uint64_t) -> (); + pub fn rados_read_op_cmpxattr(read_op: rados_read_op_t, name: *const ::libc::c_char, + comparison_operator: uint8_t, value: *const ::libc::c_char, value_len: size_t) + -> (); + pub fn rados_read_op_getxattrs(read_op: rados_read_op_t, iter: *mut rados_xattrs_iter_t, + prval: *mut ::libc::c_int) + -> (); + pub fn rados_read_op_omap_cmp(read_op: rados_read_op_t, key: *const ::libc::c_char, comparison_operator: uint8_t, + val: *const ::libc::c_char, val_len: size_t, prval: *mut ::libc::c_int) + -> (); + pub fn rados_read_op_stat(read_op: rados_read_op_t, psize: *mut uint64_t, pmtime: *mut time_t, + prval: *mut ::libc::c_int) + -> (); + pub fn rados_read_op_read(read_op: rados_read_op_t, offset: uint64_t, len: size_t, buf: *mut ::libc::c_char, + bytes_read: *mut size_t, prval: *mut ::libc::c_int) + -> (); + pub fn rados_read_op_exec(read_op: rados_read_op_t, cls: *const ::libc::c_char, method: *const ::libc::c_char, + in_buf: *const ::libc::c_char, in_len: size_t, out_buf: *mut *mut ::libc::c_char, + out_len: *mut size_t, prval: *mut ::libc::c_int) + -> (); + pub fn rados_read_op_exec_user_buf(read_op: rados_read_op_t, cls: *const ::libc::c_char, + method: *const ::libc::c_char, in_buf: *const ::libc::c_char, in_len: size_t, + out_buf: *mut ::libc::c_char, out_len: size_t, used_len: *mut size_t, + prval: *mut ::libc::c_int) + -> (); + pub fn rados_read_op_omap_get_vals(read_op: rados_read_op_t, start_after: *const ::libc::c_char, + filter_prefix: *const ::libc::c_char, max_return: uint64_t, + iter: *mut rados_omap_iter_t, prval: *mut ::libc::c_int) + -> (); + pub fn rados_read_op_omap_get_keys(read_op: rados_read_op_t, start_after: *const ::libc::c_char, + max_return: uint64_t, iter: *mut rados_omap_iter_t, prval: *mut ::libc::c_int) + -> (); + pub fn rados_read_op_omap_get_vals_by_keys(read_op: rados_read_op_t, keys: *const *const ::libc::c_char, + keys_len: size_t, iter: *mut rados_omap_iter_t, + prval: *mut ::libc::c_int) + -> (); + pub fn rados_read_op_operate(read_op: rados_read_op_t, io: rados_ioctx_t, oid: *const ::libc::c_char, + flags: ::libc::c_int) + -> ::libc::c_int; + pub fn rados_aio_read_op_operate(read_op: rados_read_op_t, io: rados_ioctx_t, completion: rados_completion_t, + oid: *const ::libc::c_char, flags: ::libc::c_int) + -> ::libc::c_int; + pub fn rados_lock_exclusive(io: rados_ioctx_t, o: *const ::libc::c_char, name: *const ::libc::c_char, + cookie: *const ::libc::c_char, desc: *const ::libc::c_char, duration: *mut timeval, + flags: uint8_t) + -> ::libc::c_int; + pub fn rados_lock_shared(io: rados_ioctx_t, o: *const ::libc::c_char, name: *const ::libc::c_char, + cookie: *const ::libc::c_char, tag: *const ::libc::c_char, desc: *const ::libc::c_char, + duration: *mut timeval, flags: uint8_t) + -> ::libc::c_int; + pub fn rados_unlock(io: rados_ioctx_t, o: *const ::libc::c_char, name: *const ::libc::c_char, + cookie: *const ::libc::c_char) + -> ::libc::c_int; + pub fn rados_list_lockers(io: rados_ioctx_t, o: *const ::libc::c_char, name: *const ::libc::c_char, + exclusive: *mut ::libc::c_int, tag: *mut ::libc::c_char, tag_len: *mut size_t, + clients: *mut ::libc::c_char, clients_len: *mut size_t, cookies: *mut ::libc::c_char, + cookies_len: *mut size_t, addrs: *mut ::libc::c_char, addrs_len: *mut size_t) + -> ssize_t; + pub fn rados_break_lock(io: rados_ioctx_t, o: *const ::libc::c_char, name: *const ::libc::c_char, + client: *const ::libc::c_char, cookie: *const ::libc::c_char) + -> ::libc::c_int; + pub fn rados_blacklist_add(cluster: rados_t, client_address: *mut ::libc::c_char, expire_seconds: uint32_t) + -> ::libc::c_int; + pub fn rados_mon_command(cluster: rados_t, cmd: *mut *const ::libc::c_char, cmdlen: size_t, + inbuf: *const ::libc::c_char, inbuflen: size_t, outbuf: *mut *mut ::libc::c_char, + outbuflen: *mut size_t, outs: *mut *mut ::libc::c_char, outslen: *mut size_t) + -> ::libc::c_int; + pub fn rados_mon_command_target(cluster: rados_t, name: *const ::libc::c_char, cmd: *mut *const ::libc::c_char, + cmdlen: size_t, inbuf: *const ::libc::c_char, inbuflen: size_t, + outbuf: *mut *mut ::libc::c_char, outbuflen: *mut size_t, + outs: *mut *mut ::libc::c_char, outslen: *mut size_t) + -> ::libc::c_int; + pub fn rados_buffer_free(buf: *mut ::libc::c_char) -> (); + pub fn rados_osd_command(cluster: rados_t, osdid: ::libc::c_int, cmd: *mut *const ::libc::c_char, cmdlen: size_t, + inbuf: *const ::libc::c_char, inbuflen: size_t, outbuf: *mut *mut ::libc::c_char, + outbuflen: *mut size_t, outs: *mut *mut ::libc::c_char, outslen: *mut size_t) + -> ::libc::c_int; + pub fn rados_pg_command(cluster: rados_t, pgstr: *const ::libc::c_char, cmd: *mut *const ::libc::c_char, + cmdlen: size_t, inbuf: *const ::libc::c_char, inbuflen: size_t, + outbuf: *mut *mut ::libc::c_char, outbuflen: *mut size_t, outs: *mut *mut ::libc::c_char, + outslen: *mut size_t) + -> ::libc::c_int; + pub fn rados_monitor_log(cluster: rados_t, level: *const ::libc::c_char, cb: rados_log_callback_t, + arg: *mut ::libc::c_void) + -> ::libc::c_int; +} ++
1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 23 + 24 + 25 + 26 + 27 + 28 + 29 + 30 + 31 + 32 + 33 + 34 + 35 + 36 + 37 + 38 + 39 + 40 + 41 + 42 + 43 + 44 + 45 + 46 + 47 + 48 + 49 + 50 + 51 + 52 + 53 + 54 + 55 + 56 + 57 + 58 + 59 + 60 + 61 + 62 + 63 + 64 + 65 + 66 + 67 + 68 + 69 + 70 + 71 + 72 + 73 + 74 + 75 + 76 + 77 + 78 + 79 + 80 + 81 + 82 + 83 + 84 + 85 + 86 + 87 + 88 + 89 + 90 + 91 + 92 + 93 + 94 + 95 + 96 + 97 + 98 + 99 +100 +101 +102 +103 +104 +105 +106 +107 +108 +109 +110 +111 +112 +113 +114 +115 +116 +117 +118 +119 +120 +121 +122 +123 +124 +125 +126 +127 +128 +129 +130 +131 +132 +133 +134 +135 +136 +137 +138 +139 +140 +141 +142 +143 +144 +145 +146 +147 +148 +149 +150 +151 +152 +153 +154 +155 +156 +157 +158 +
+// Copyright 2017 LambdaStack All rights reserved. +// +// 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. + +#[derive(RustcDecodable, RustcEncodable)] +pub struct CephStatus { + health: CephStatusHealth, + fsid: String, + election_epoch: u32, + quorum: Vec<u32>, + quorum_names: Vec<String>, + monmap: CephStatusMonMap, + osdmap: CephStatusOSDMapH, + pgmap: CephStatusPGMap, + mdsmap: CephStatusMDSMap, +} + +#[derive(RustcDecodable, RustcEncodable)] +pub struct CephStatusHealth { + health: CephStatusHealth2, + timechecks: CephStatusHealthTimeChecks, + summary: Vec<CephStatusHealthSummary>, + overall_status: String, + detail: Vec<CephStatusHealthDetail>, +} + +#[derive(RustcDecodable, RustcEncodable)] +pub struct CephStatusHealth2 { + health: Vec<CephStatusHealthServices>, +} + +#[derive(RustcDecodable, RustcEncodable)] +pub struct CephStatusHealthServices { + mons: Vec<CephStatusHealthServicesMon>, +} + +#[derive(RustcDecodable, RustcEncodable)] +pub struct CephStatusHealthServicesMon { + name: String, + kb_total: u32, + kb_used: u32, + kb_avail: u32, + avail_percent: u16, + last_updated: String, + store_stats: CephStatusHealthServicesMonStats, + health: String, +} + +#[derive(RustcDecodable, RustcEncodable)] +pub struct CephStatusHealthServicesMonStats { + bytes_total: u64, + bytes_sst: u64, + bytes_log: u64, + bytes_misc: u64, + last_updated: String, +} + +#[derive(RustcDecodable, RustcEncodable)] +pub struct CephStatusHealthTimeChecks { + epoch: u32, + round: u32, + round_status: String, + mons: Vec<CephStatusHealthMons>, +} + +#[derive(RustcDecodable, RustcEncodable)] +pub struct CephStatusHealthMons { + name: String, + skew: f32, + latency: f32, + health: String, +} + +#[derive(RustcDecodable, RustcEncodable)] +pub struct CephStatusHealthSummary { + severity: String, + summary: String, +} + +#[derive(RustcDecodable, RustcEncodable)] +pub struct CephStatusHealthDetail { + dummy: String, +} + +#[derive(RustcDecodable, RustcEncodable)] +pub struct CephStatusMonMap { + epoch: u32, + fsid: String, + modified: String, + created: String, + mons: Vec<CephStatusMonRank>, +} + +#[derive(RustcDecodable, RustcEncodable)] +pub struct CephStatusMonRank { + rank: u16, + name: String, + addr: String, +} + +#[derive(RustcDecodable, RustcEncodable)] +pub struct CephStatusOSDMapH { + osdmap: CephStatusOSDMapL, +} + +#[derive(RustcDecodable, RustcEncodable)] +pub struct CephStatusOSDMapL { + epoch: u32, + num_osds: u32, + num_up_osds: u32, + num_in_osds: u32, + full: bool, + nearfull: bool, + num_remapped_pgs: u32, +} + +#[derive(RustcDecodable, RustcEncodable)] +pub struct CephStatusPGMap { + pgs_by_state: Vec<CephStatusPGState>, + version: u32, + num_pgs: u32, + data_bytes: u64, + bytes_used: u64, + bytes_avail: u64, + bytes_total: u64, +} + +#[derive(RustcDecodable, RustcEncodable)] +pub struct CephStatusPGState { + state_name: String, + count: u32, +} + +#[derive(RustcDecodable, RustcEncodable)] +pub struct CephStatusMDSMap { + epoch: u32, + up: u32, + _in: u32, + max: u32, + by_rank: Vec<CephStatusMDSRank>, +} + +#[derive(RustcDecodable, RustcEncodable)] +pub struct CephStatusMDSRank { + rank: u16, + name: String, + addr: String, +} ++
1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +
+// Copyright 2017 LambdaStack All rights reserved. +// +// 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. + +use std::io::Result; + +use std::process::{Command, Output}; + +/// run_cli - pass in a String of a normal command line +/// +/// The function will split the options into words to supply to the low_level std::process::Command +/// which returns Result<(Output)> +/// # Example +/// +/// ``` +/// run_cli("ps aux"); +/// ``` + +// NOTE: Add Into so a "" can also be passed in... +pub fn run_cli(cmd_line: &str) -> Result<(Output)> { + let output = try!(Command::new("sh").arg("-c").arg(cmd_line).output()); + Ok(output) +} ++