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

Delete container #37

Closed
mgeisler opened this issue Aug 28, 2014 · 3 comments
Closed

Delete container #37

mgeisler opened this issue Aug 28, 2014 · 3 comments

Comments

@mgeisler
Copy link
Owner

No description provided.

@pkit
Copy link

pkit commented Sep 11, 2014

Delete container is a very poorly defined operation in Swift.
To get consistent results you will need intermediate representation. I.e. local cache of objects in container.

@mgeisler
Copy link
Owner Author

I was wondering how this could be tricky, but then I noticed that you cannot delete a container unless it is empty. So can we not implement it like this:

while true:
    try:
        delete container
        break
    except container is not empty:
        objects = list container
        for obj in objects:
            delete obj
    except other error:
        raise error

I've so far tried to keep little to no state on the client side. I'm not 100% sure why I would need to keep extra data for this operation?

@mgeisler
Copy link
Owner Author

mgeisler commented Nov 6, 2014

@pkit I've added this feature in the most simple way possible:

  1. get list of objects in container
  2. go through list and delete them all
  3. delete container which should be empty now

This will of course fail if a new object is added while I'm deleting the old ones. I think it is okay for it to fail in that case (Swift Browser doesn't display anything sensible to the user in that case).

Will you care to expand on what problems this implementation will bring with it? I think you're implying that I'll get inconsistent results somehow?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants