summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFerris Tseng <ferristseng@gmail.com>2017-12-09 14:57:55 -0500
committerGitHub <noreply@github.com>2017-12-09 14:57:55 -0500
commitfac1b03d287a61f6679856e954aa59c5cbf1dbca (patch)
tree3d71aa811f9355e9634987aaeaad615c3f452beb
parentb7b3d36dd384dcaa907c9e00be6355b03c53d2d4 (diff)
parent52a7388cd07b73fd2e46d143ef51fabd6fff3d1a (diff)
Merge pull request #8 from icefoxen/size-type-updates
Updated sizes in type definitions
-rw-r--r--ipfs-api/src/client.rs2
-rw-r--r--ipfs-api/src/request/ping.rs2
-rw-r--r--ipfs-api/src/response/bitswap.rs8
-rw-r--r--ipfs-api/src/response/block.rs4
-rw-r--r--ipfs-api/src/response/files.rs8
-rw-r--r--ipfs-api/src/response/object.rs12
-rw-r--r--ipfs-api/src/response/pin.rs2
-rw-r--r--ipfs-api/src/response/repo.rs4
8 files changed, 23 insertions, 19 deletions
diff --git a/ipfs-api/src/client.rs b/ipfs-api/src/client.rs
index c5fb1bd..24a78b3 100644
--- a/ipfs-api/src/client.rs
+++ b/ipfs-api/src/client.rs
@@ -1712,7 +1712,7 @@ impl IpfsClient {
pub fn ping(
&self,
peer: &str,
- count: &Option<usize>,
+ count: &Option<i32>,
) -> AsyncStreamResponse<response::PingResponse> {
self.request_stream_json(&request::Ping { peer, count }, None)
}
diff --git a/ipfs-api/src/request/ping.rs b/ipfs-api/src/request/ping.rs
index cd99e66..ef93476 100644
--- a/ipfs-api/src/request/ping.rs
+++ b/ipfs-api/src/request/ping.rs
@@ -14,7 +14,7 @@ pub struct Ping<'a, 'b> {
#[serde(rename = "arg")]
pub peer: &'a str,
- pub count: &'b Option<usize>,
+ pub count: &'b Option<i32>,
}
impl<'a, 'b> ApiRequest for Ping<'a, 'b> {
diff --git a/ipfs-api/src/response/bitswap.rs b/ipfs-api/src/response/bitswap.rs
index acfad56..6280bfb 100644
--- a/ipfs-api/src/response/bitswap.rs
+++ b/ipfs-api/src/response/bitswap.rs
@@ -23,7 +23,7 @@ pub struct BitswapLedgerResponse {
#[derive(Debug, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct BitswapStatResponse {
- pub provide_buf_len: usize,
+ pub provide_buf_len: i32,
#[serde(deserialize_with = "serde::deserialize_vec")]
pub wantlist: Vec<String>,
@@ -31,11 +31,11 @@ pub struct BitswapStatResponse {
#[serde(deserialize_with = "serde::deserialize_vec")]
pub peers: Vec<String>,
- pub blocks_received: usize,
+ pub blocks_received: u64,
pub data_received: u64,
- pub blocks_sent: usize,
+ pub blocks_sent: u64,
pub data_sent: u64,
- pub dup_blks_received: usize,
+ pub dup_blks_received: u64,
pub dup_data_received: u64,
}
diff --git a/ipfs-api/src/response/block.rs b/ipfs-api/src/response/block.rs
index d1e446a..34855e2 100644
--- a/ipfs-api/src/response/block.rs
+++ b/ipfs-api/src/response/block.rs
@@ -10,7 +10,7 @@
#[serde(rename_all = "PascalCase")]
pub struct BlockPutResponse {
pub key: String,
- pub size: usize,
+ pub size: u64,
}
@@ -26,7 +26,7 @@ pub struct BlockRmResponse {
#[serde(rename_all = "PascalCase")]
pub struct BlockStatResponse {
pub key: String,
- pub size: usize,
+ pub size: u64,
}
diff --git a/ipfs-api/src/response/files.rs b/ipfs-api/src/response/files.rs
index c0adbfb..1b073de 100644
--- a/ipfs-api/src/response/files.rs
+++ b/ipfs-api/src/response/files.rs
@@ -20,9 +20,11 @@ pub type FilesFlushResponse = ();
pub struct FilesEntry {
pub name: String,
+ // This is a protocol buffer enum type defined in https://github.com/ipfs/go-ipfs/blob/master/unixfs/pb/unixfs.proto ...
+ // So it might be some other type than u64, but certainly shouldn't be *bigger* than u64.
#[serde(rename = "Type")]
- pub typ: isize,
- pub size: i64,
+ pub typ: u64,
+ pub size: u64,
pub hash: String,
}
@@ -50,7 +52,7 @@ pub struct FilesStatResponse {
pub hash: String,
pub size: u64,
pub cumulative_size: u64,
- pub blocks: isize,
+ pub blocks: u64,
#[serde(rename = "Type")]
pub typ: String,
diff --git a/ipfs-api/src/response/object.rs b/ipfs-api/src/response/object.rs
index 5e36676..de5923c 100644
--- a/ipfs-api/src/response/object.rs
+++ b/ipfs-api/src/response/object.rs
@@ -17,7 +17,7 @@ pub type ObjectDataResponse = Vec<u8>;
#[serde(rename_all = "PascalCase")]
pub struct ObjectDiff {
#[serde(rename = "Type")]
- pub typ: isize,
+ pub typ: u64,
pub path: String,
@@ -121,11 +121,11 @@ pub struct ObjectPutResponse {
#[serde(rename_all = "PascalCase")]
pub struct ObjectStatResponse {
pub hash: String,
- pub num_links: isize,
- pub block_size: isize,
- pub links_size: isize,
- pub data_size: isize,
- pub cumulative_size: isize,
+ pub num_links: u64,
+ pub block_size: u64,
+ pub links_size: u64,
+ pub data_size: u64,
+ pub cumulative_size: u64,
}
diff --git a/ipfs-api/src/response/pin.rs b/ipfs-api/src/response/pin.rs
index e6e4192..2b8b4ef 100644
--- a/ipfs-api/src/response/pin.rs
+++ b/ipfs-api/src/response/pin.rs
@@ -16,7 +16,7 @@ pub struct PinAddResponse {
#[serde(deserialize_with = "serde::deserialize_vec")]
pub pins: Vec<String>,
- pub progress: Option<isize>,
+ pub progress: Option<i32>,
}
diff --git a/ipfs-api/src/response/repo.rs b/ipfs-api/src/response/repo.rs
index 24260c5..fb82936 100644
--- a/ipfs-api/src/response/repo.rs
+++ b/ipfs-api/src/response/repo.rs
@@ -36,11 +36,13 @@ pub struct RepoStatResponse {
}
+// Defined in go-ipfs:master core/commands/repo.go
#[derive(Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct RepoVerifyResponse {
pub message: String,
- pub progress: isize,
+ // Could technically be an i64 but this is probably safest?
+ pub progress: i32,
}