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

Conversation

@ggodlewski
Copy link

Allow to pull recent recent containers events

@hacfi
Copy link
Contributor

hacfi commented Apr 29, 2015

👍 LGTM

Could you update the docs with an example?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That’s not really necessary but whatever.

@ubermuda
Copy link
Contributor

Is the ContainerManager really the right place for this? If I understand correctly, this has nothing to do specifically with containers, so maybe it should be in Docker?

Coding standards: we usually put a white line before and after structure blocks like fors and ifs, except before a block that begins another block. For example, the splitEvents method would look like this:

        // ...
        $currentString = '';

        for ($i = 0; $i < strlen($contents); $i++) {
            if ($contents{$i} == '{') {
                $numOfBrackets++;
            }

            if ($contents{$i} == '}') {
                $numOfBrackets--;
            }

            $currentString .= $contents{$i};

            if ($numOfBrackets == 0 ) {
                if (!empty($currentString)) {
                    $retVal[] = new Event(json_decode($currentString, true));
                }

                $currentString = '';
            }
        }
        // ...

Also, +1 for the documentation, and this will also needs tests :)

@ggodlewski
Copy link
Author

I moved it into ContainerManager because those are container events. Maybe some new EventMenager? Tell me where you want it and I'll correct it and add docs.

@ubermuda
Copy link
Contributor

ubermuda commented May 2, 2015

@ggodlewski
Copy link
Author

Yes.

@ubermuda
Copy link
Contributor

ubermuda commented May 4, 2015

Then it can also report image events:

and Docker images will report:

    untag, delete

So yeah, maybe an EventManager would make sense, maybe something based on https://github.com/symfony/EventDispatcher so that we can easily register listeners to these events, what do you think?

@ggodlewski
Copy link
Author

At the moment it uses polling. If you want to dispatch events it should use streaming. It should open /events and asynchronously react to received data converting it to events.

I might be wrong (don't know guzzle so good) but it seems to require guzzle5 with its asynchronous capabilities.

@ubermuda
Copy link
Contributor

ubermuda commented May 5, 2015

Right, I guess both polling and streaming can have their place in docker-php.

In the end, because /events can report image events, it shouldn't be in ContainerManager, but there might not be a need for an EventManager right now (you're right about the streaming, and we're already talking about switching to egeloen/ivory-http-adapter which would bring in async + psr-7 compliance, so this part should wait) so maybe you can move it to Docker\Docker and that would be fine for now, what do you think?

@ggodlewski
Copy link
Author

Hey, I put it into new place. It's not a lot of code but when async is added it will more. I don't want to change api then.
And there is a unit test now.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty line after this

@ubermuda
Copy link
Contributor

Ok that's great, ready to merge once the coding style issues are fixed!

@ubermuda
Copy link
Contributor

poke @ggodlewski, are you going to fix the CS issues? :)

@ggodlewski ggodlewski closed this Sep 28, 2015
@schmunk42
Copy link
Contributor

Why was this closed without merge? Are these changes in the code or in another PR?

@ggodlewski
Copy link
Author

As you see there were some empty lines missing and instead of just putting them he spent more time on writing comments.
I have a life. I prefer to use and contribute to another project.

schmunk42 added a commit to schmunk42/docker-php that referenced this pull request Dec 6, 2015
@schmunk42
Copy link
Contributor

@ggodlewski Thank you for the info, sad to hear the PR failed just because of code-formatting.

@ubermuda
Copy link
Contributor

ubermuda commented Dec 6, 2015

@ggodlewski sorry that you feel this way, but code formatting is important. If you do not wish to respect the work of others by complying to simple rules, that is your right and I hope you find another project to use and contribute to that will suit your needs and philosophy.

In the meantime, I would just like to point that being sarcastic and/or ironic is not necessary, and implying that your time is more valuable than that of other people here is, simply put, rude.

@docker-php docker-php locked and limited conversation to collaborators Dec 6, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants