Skip to content

Conversation

@vshlapakov
Copy link
Contributor

@vshlapakov vshlapakov commented Feb 28, 2017

We also agreed to move frontier slot logic to a separate entity in a similar way.

Please, review.

@vshlapakov vshlapakov self-assigned this Feb 28, 2017
@vshlapakov vshlapakov changed the base branch from master to sc1467-1 February 28, 2017 16:29
README.rst Outdated

Get an iterator to iterate through a frontier slots::

>>> frontier.iter_slots()
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe replace with iter() and list()?

Copy link
Contributor Author

@vshlapakov vshlapakov Mar 1, 2017

Choose a reason for hiding this comment

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

I had doubts about it but if we're going to use a separate entity for slots - it looks fine

return iter(self.list_slots())

def list_slots(self):
return next(self._frontiers._origin.apiget((self.key, 'list')))
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a proposal - maybe we should add another entity - Slot or FrontierSlot? Frontier.iter() will go through available slot names, Frontier.get() will get Slot object, Slot.iter() or Slot.list() will do what read() does now, Slot.delete(ids) will delete data from the slot, Frontier.delete(name) will delete whole slot

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense, I'd go with FrontierSlot

@vshlapakov
Copy link
Contributor Author

vshlapakov commented Mar 1, 2017

@chekunkov Ready for next review, I also added integration tests for frontier logic and added new cassettes to #40 (rebased it on top of the PR).

README.rst Outdated

To delete the slot ``example.com`` from the frontier::

>>> frontier.delete('example.com')
Copy link
Contributor

Choose a reason for hiding this comment

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

just realized this can be confusing - usually it's expected to call delete on the object that should be deleted. e.g. we have Job.delete() method. What if we move delete to FrontierSlot, if no arguments are passed the entier slot is removed, if ids are passed - we remove only some requests?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agree, it's bit more consistent with other classes, let's do that

origin = self._frontier._frontiers._origin
return origin.add(self._frontier.key, self.key, fps)

def iter(self, mincount=None):
Copy link
Contributor

Choose a reason for hiding this comment

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

better replace mincount with **kwargs, it's server responsibility to decide what parameters are valid or not

README.rst Outdated
To retrieve fingerprints for a given slot::

>>> fps = [req['requests'] for req in slot.iter()]
>>> fps = [req['requests'] for req in slot.q.iter()]
Copy link
Contributor

@chekunkov chekunkov Mar 1, 2017

Choose a reason for hiding this comment

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

mmm, shouldn't it be slot.f.iter() / slot.f.list()?

@chekunkov
Copy link
Contributor

After we merge this PR we will probably need to split client.py into smaller modules - 1.3k lines is a bit too much

@vshlapakov
Copy link
Contributor Author

@chekunkov I think that's it, take a look pls when you have time.

@chekunkov chekunkov merged commit 52cece9 into sc1467-1 Mar 2, 2017
@chekunkov chekunkov deleted the kumo1719 branch March 2, 2017 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants