-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue # 55 CloudTableClient should use Iterator instead of Iterable.
Signed-off-by: Joe Giardino <joegiard@microsoft.com>
- Loading branch information
Joe Giardino
committed
May 1, 2012
1 parent
fad32f6
commit 0f84dbb
Showing
8 changed files
with
155 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
...rosoft/windowsazure/services/core/storage/utils/implementation/LazySegmentedIterable.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/** | ||
* Copyright 2011 Microsoft Corporation | ||
* | ||
* 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. | ||
*/ | ||
package com.microsoft.windowsazure.services.core.storage.utils.implementation; | ||
|
||
import java.util.Iterator; | ||
|
||
import com.microsoft.windowsazure.services.core.storage.OperationContext; | ||
import com.microsoft.windowsazure.services.core.storage.ResultSegment; | ||
import com.microsoft.windowsazure.services.core.storage.RetryPolicyFactory; | ||
|
||
/** | ||
* RESERVED FOR INTERNAL USE. Provides a lazy iterator which will retrieve the next segment of a result as the iterator | ||
* is consumed | ||
* | ||
* @param <CLIENT_TYPE> | ||
* The service client type | ||
* @param <PARENT_TYPE> | ||
* The type of the parent object, i.e. CloudBlobClient for ListContainers etc. | ||
* @param <ENTITY_TYPE> | ||
* The type of the objects the resulting iterable objects | ||
*/ | ||
public final class LazySegmentedIterable<CLIENT_TYPE, PARENT_TYPE, ENTITY_TYPE> implements Iterable<ENTITY_TYPE> { | ||
/** | ||
* Holds the service client associated with the operations. | ||
*/ | ||
private final CLIENT_TYPE client; | ||
|
||
/** | ||
* Holds a reference to the parent object, i.e. CloudBlobContainer for list blobs. | ||
*/ | ||
private final PARENT_TYPE parentObject; | ||
|
||
/** | ||
* Holds the reference to the RetryPolicyFactory object. | ||
*/ | ||
private final RetryPolicyFactory policyFactory; | ||
|
||
/** | ||
* Holds the SegmentedStorageOperation which is used to retrieve the next segment of results. | ||
*/ | ||
private final SegmentedStorageOperation<CLIENT_TYPE, PARENT_TYPE, ResultSegment<ENTITY_TYPE>> segmentGenerator; | ||
|
||
/** | ||
* Holds an object used to track the execution of the operation | ||
*/ | ||
private final OperationContext opContext; | ||
|
||
public LazySegmentedIterable( | ||
final SegmentedStorageOperation<CLIENT_TYPE, PARENT_TYPE, ResultSegment<ENTITY_TYPE>> segmentGenerator, | ||
final CLIENT_TYPE client, final PARENT_TYPE parent, final RetryPolicyFactory policyFactory, | ||
final OperationContext opContext) { | ||
this.segmentGenerator = segmentGenerator; | ||
this.parentObject = parent; | ||
this.opContext = opContext; | ||
this.policyFactory = policyFactory; | ||
this.client = client; | ||
} | ||
|
||
@Override | ||
public Iterator<ENTITY_TYPE> iterator() { | ||
return new LazySegmentedIterator<CLIENT_TYPE, PARENT_TYPE, ENTITY_TYPE>(this.segmentGenerator, this.client, | ||
this.parentObject, this.policyFactory, this.opContext); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters