Skip to content
This repository was archived by the owner on Oct 6, 2020. It is now read-only.

Commit efa7ce8

Browse files
committed
Merge pull request #6 from MindFlavor/candidate
Implemented put_block and exported options
2 parents 27b5160 + ae9aa6a commit efa7ce8

File tree

15 files changed

+439
-133
lines changed

15 files changed

+439
-133
lines changed

CHANGELOG.md

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,40 @@
11
# Change Log
22

3+
4+
## [0.0.7](https://github.com/MindFlavor/AzureSDKForRust/releases/tag/0.0.7) (2015-01-14)
5+
6+
**Implemented features:**
7+
* Added support for ```put_block``` in ```Blob```.
8+
* Added support for ```filter``` in ```Blob::list```. Now you can filter the blobs to find specifying the starting string.
9+
* Added support for ```timeout``` in ```Blob::list```.
10+
* Added support for ```timeout```, ```prefix``` and ```max_results``` in ```Container::list```.
11+
* Added support for ```max_results``` in ```Container::list```. Now you can limit how many containers could be returned by a single call.
12+
* Added support for ```next_marker``` in ```Container::list```. Now you can continue enumerating your containers in subsequent calls.
13+
14+
**Refactoring:**
15+
* Moved ```Container::list``` options in a separate structure (```azure::storage::container::ListContainerOptions```).
16+
* Moved ```Blob::put_page``` options in a separate structure (```azure::storage::blob::PutPageOptions```).
17+
18+
**Bugfixes:**
19+
* Corrected the format bug in ```azure::core::range::Range``` and ```azure::core::range::ba512_range::BA512Range```. Previously the string returned was
20+
formatted as ```{}/{}``` which is invalid for the ```x-ms-range``` header. Now the format is ```bytes={}-{}``` as expected. I still need to figure out if
21+
I need to change the ```FromStr``` trait too to match the change.
22+
23+
**Removed methods:**
24+
* Removed ```ListBlobOptions::new``` as it was just useless boilerplate.
25+
326
## [0.0.6](https://github.com/MindFlavor/AzureSDKForRust/releases/tag/0.0.6) (2016-01-12)
427

528
**Implemented features:**
6-
* Added support for max_results in list_blobs. Now you can limit how many blobs could be returned by a single call.
7-
* Added support for next_marker in list_blobs. Now you can continue enumerating your blobs in subsequent calls.
8-
* Added put page for page blobs.
9-
* Added clear page for page blobs.
29+
* Added support for max_results in ```Blob::list```. Now you can limit how many blobs could be returned by a single call.
30+
* Added support for next_marker in ```Blob::list```. Now you can continue enumerating your blobs in subsequent calls.
31+
* Added ```put page``` for page blobs.
32+
* Added ```clear page``` for page blobs.
1033

1134
**Refactoring:**
1235
* Added page constraints (512-bytes aligned).
13-
* Most methods moved from storage::Client to correct structs (ie storage::container::Container and storage::blob::Blob).
14-
* Moved list_blobs options in a separate structure (```azure::storage::blob::ListBlobOptions```).
36+
* Most methods moved from ```storage::Client``` to correct structs (ie ```storage::container::Container``` and ```storage::blob::Blob```).
37+
* Moved ```Blob::list``` options in a separate structure (```azure::storage::blob::ListBlobOptions```).
1538

1639
## [0.0.5](https://github.com/MindFlavor/AzureSDKForRust/releases/tag/0.0.5) (2016-01-05)
1740

Cargo.lock

Lines changed: 42 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ rust-crypto = "^0.2"
99
rustc-serialize = "*"
1010
RustyXML = "*"
1111
mime = "*"
12+
log = "0.3"
13+
env_logger = "0.3"
1214

1315
[dependencies.hyper]
1416
version = "*"

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ extern crate mime;
2424
use azure::storage::{LeaseState, LeaseStatus};
2525
use azure::storage::client::Client;
2626
use azure::storage::blob::{Blob, BlobType};
27-
use azure::storage::container::{Container, PublicAccess};
27+
use azure::storage::container::{Container, PublicAccess, LIST_CONTAINER_OPTIONS_DEFAULT};
2828

2929
use chrono::UTC;
3030

@@ -41,7 +41,7 @@ fn main() {
4141

4242

4343
// This call will list your containers.
44-
let containers = Container::list(&client).unwrap();
44+
let containers = Container::list(&client, &LIST_CONTAINER_OPTIONS_DEFAULT).unwrap();
4545
println!("{:?}", ret);
4646

4747
// This call will create a new Azure Container called "wow"
@@ -128,5 +128,7 @@ If you want to contribute please do! No formality required! :wink:
128128
|Put blob|[https://msdn.microsoft.com/en-us/library/azure/dd179451.aspx](https://msdn.microsoft.com/en-us/library/azure/dd179451.aspx)|
129129
|Put blob page|[https://msdn.microsoft.com/en-us/library/azure/dd179451.aspx](https://msdn.microsoft.com/en-us/library/azure/dd179451.aspx)|
130130
|Clear blob page|[https://msdn.microsoft.com/en-us/library/azure/dd179451.aspx](https://msdn.microsoft.com/en-us/library/azure/dd179451.aspx)|
131+
|Put block|[https://msdn.microsoft.com/en-us/library/azure/dd135726.aspx](https://msdn.microsoft.com/en-us/library/azure/dd135726.aspx)|
132+
131133
## License
132134
This project is published under [The MIT License (MIT)](LICENSE).

src/azure/core/ba512_range.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ impl BA512Range {
3131
end: end,
3232
})
3333
}
34+
35+
#[inline]
36+
pub fn len(&self) -> u64 {
37+
self.end - self.start + 1
38+
}
3439
}
3540

3641
#[derive(Debug, Clone, PartialEq)]
@@ -86,7 +91,7 @@ impl FromStr for BA512Range {
8691

8792
impl fmt::Display for BA512Range {
8893
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
89-
write!(f, "{}/{}", self.start, self.end)
94+
write!(f, "bytes={}-{}", self.start, self.end)
9095
}
9196
}
9297

@@ -135,6 +140,6 @@ mod test {
135140

136141
let txt = format!("{}", range);
137142

138-
assert_eq!(txt, "0/511");
143+
assert_eq!(txt, "bytes=0-511");
139144
}
140145
}

src/azure/core/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ header! { (XMSLeaseState, "x-ms-lease-state") => [LeaseState] }
5757
header! { (XMSLeaseDuration, "x-ms-lease-duration") => [LeaseDuration] }
5858
header! { (ETag, "ETag") => [String] }
5959
header! { (XMSRangeGetContentMD5, "x-ms-range-get-content-md5") => [bool] }
60-
60+
header! { (XMSClientRequestId, "x-ms-client-request-id") => [String] }
6161

6262
pub fn generate_authorization(h: &Headers,
6363
u: &url::Url,

src/azure/core/range.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ impl FromStr for Range {
5151

5252
impl fmt::Display for Range {
5353
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
54-
write!(f, "{}/{}", self.start, self.end)
54+
write!(f, "bytes={}-{}", self.start, self.end)
5555
}
5656
}
5757

@@ -88,6 +88,6 @@ mod test {
8888

8989
let txt = format!("{}", range);
9090

91-
assert_eq!(txt, "100/500");
91+
assert_eq!(txt, "bytes=100-500");
9292
}
9393
}

src/azure/storage/blob/list_blob_options.rs

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ pub struct ListBlobOptions {
66
pub include_uncommittedblobs: bool,
77
pub include_copy: bool,
88
pub next_marker: Option<String>,
9+
pub prefix: Option<String>,
10+
pub timeout: Option<u64>,
911
}
1012

1113
pub const LIST_BLOB_OPTIONS_DEFAULT: ListBlobOptions = ListBlobOptions {
@@ -15,29 +17,8 @@ pub const LIST_BLOB_OPTIONS_DEFAULT: ListBlobOptions = ListBlobOptions {
1517
include_uncommittedblobs: false,
1618
include_copy: false,
1719
next_marker: None,
20+
prefix: None,
21+
timeout: None,
1822
};
1923

20-
impl ListBlobOptions {
21-
pub fn new(max_results: u32,
22-
include_snapshots: bool,
23-
include_metadata: bool,
24-
include_uncommittedblobs: bool,
25-
include_copy: bool,
26-
next_marker: Option<&str>)
27-
-> ListBlobOptions {
28-
29-
let nm = match next_marker {
30-
Some(s) => Some(s.to_owned()),
31-
None => None,
32-
};
33-
34-
ListBlobOptions {
35-
max_results: max_results,
36-
include_snapshots: include_snapshots,
37-
include_metadata: include_metadata,
38-
include_uncommittedblobs: include_uncommittedblobs,
39-
include_copy: include_copy,
40-
next_marker: nm,
41-
}
42-
}
43-
}
24+
impl ListBlobOptions {}

0 commit comments

Comments
 (0)