Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exists Returns false value in Azure #9

Open
deven96 opened this issue Apr 12, 2022 · 0 comments
Open

Exists Returns false value in Azure #9

deven96 opened this issue Apr 12, 2022 · 0 comments
Assignees
Labels
azure bug Something isn't working

Comments

@deven96
Copy link
Member

deven96 commented Apr 12, 2022

let containers = self.client
            .as_blob_service_client()
            .list_containers()
            .execute().await;
        containers
            .unwrap()
            .incomplete_vector
            .iter()
            .find(|item| item.name == bucket_name)
            .is_some()

might fail if containers > 5000 as incomplete_vector will not be the full list of containers

let mut _token = None;
let mut _found = false;
loop {
    let containers = self.client
                .as_blob_service_client()
                .list_containers()
                // there should be a method in the list builder that we can pass token back to
                .next_token(_token)
                .execute().await;
   let container_vec = containers.unwrap().incomplete_vector;
    _found = container_vec.iter().any(|item| item.name == bucket_name);
   if _found || container_vec.is_complete() {
       break;
   } else {
    // obtain the token for the next batch of 5000
    _token = container_vec.token().expect("").clone().to_owned();
   }
};
_found
@deven96 deven96 added bug Something isn't working azure labels Apr 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
azure bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants