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
//! [Frugalos]クラスタ内の一つのセグメントに対応する構成要素群。
//!
//! [Frugalos]: https://github.com/frugalos/frugalos
#![warn(missing_docs)]
#![allow(clippy::new_ret_no_self)]
extern crate adler32;
extern crate byteorder;
extern crate cannyls;
extern crate cannyls_rpc;
extern crate ecpool;
extern crate fibers;
#[cfg(test)]
extern crate fibers_global;
extern crate fibers_rpc;
extern crate frugalos_core;
extern crate frugalos_mds;
extern crate frugalos_raft;
extern crate futures;
extern crate libfrugalos;
extern crate prometrics;
extern crate raftlog;
extern crate rand;
extern crate rustracing;
extern crate rustracing_jaeger;
extern crate serde;
#[macro_use]
extern crate serde_derive;
extern crate siphasher;
#[macro_use]
extern crate slog;
#[macro_use]
extern crate trackable;

pub use client::storage::{build_ec, ErasureCoder};
pub use client::Client;
pub use error::{Error, ErrorKind};
pub use service::{Service, ServiceHandle};

pub mod config;

mod client;
mod error;
mod service;
mod synchronizer;
mod test_util;
mod util;

/// クレート固有の`Result`型。
pub type Result<T> = ::std::result::Result<T, Error>;

/// オブジェクトの値。
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ObjectValue {
    /// バージョン番号。
    pub version: libfrugalos::entity::object::ObjectVersion,

    /// 中身。
    pub content: Vec<u8>,
}

/// `frugalos_segment` の設定。
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct FrugalosSegmentConfig {
    /// A configuration for a dispersed client.
    #[serde(default)]
    pub dispersed_client: config::DispersedClientConfig,
    /// A configuration for `MdsClient`.
    #[serde(default)]
    pub mds_client: config::MdsClientConfig,
}

impl Default for FrugalosSegmentConfig {
    fn default() -> Self {
        Self {
            dispersed_client: Default::default(),
            mds_client: Default::default(),
        }
    }
}