mirror of https://github.com/apache/jclouds.git
Merge branch 'fix-list-blobs' of https://github.com/joodie/jclouds
* 'fix-list-blobs' of https://github.com/joodie/jclouds: make prefix optional for blobstore/list-blobs make blobstore/list-blobs actually lazy
This commit is contained in:
commit
c352895ae2
|
@ -148,8 +148,10 @@ Options can also be specified for extension modules
|
|||
|
||||
(defn- list-blobs-chunk [container prefix #^BlobStore blobstore & [marker]]
|
||||
(apply list-container blobstore container
|
||||
:in-directory prefix (when (string? marker)
|
||||
[:after-marker marker])))
|
||||
(concat (when prefix
|
||||
[:in-directory prefix])
|
||||
(when (string? marker)
|
||||
[:after-marker marker]))))
|
||||
|
||||
(defn- list-blobs-chunks [container prefix #^BlobStore blobstore marker]
|
||||
(when marker
|
||||
|
@ -158,10 +160,19 @@ Options can also be specified for extension modules
|
|||
(list-blobs-chunks container prefix blobstore
|
||||
(.getNextMarker chunk)))))))
|
||||
|
||||
(defn- concat-elements
|
||||
"Make a lazy concatenation of the lazy sequences contained in coll. Lazily evaluates coll.
|
||||
Note: (apply concat coll) or (lazy-cat coll) are not lazy wrt coll itself."
|
||||
[coll]
|
||||
(if-let [s (seq coll)]
|
||||
(lazy-seq (concat (first s) (concat-elements (next s))))))
|
||||
|
||||
(defn list-blobs
|
||||
"Returns a lazy seq of all blobs in the given container."
|
||||
([container prefix #^BlobStore blobstore]
|
||||
(apply concat (list-blobs-chunks container prefix blobstore :start))))
|
||||
(concat-elements (list-blobs-chunks container prefix blobstore :start)))
|
||||
([container #^BlobStore blobstore]
|
||||
(list-blobs container nil blobstore)))
|
||||
|
||||
(defn locations
|
||||
"Retrieve the available container locations for the blobstore context."
|
||||
|
|
Loading…
Reference in New Issue