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

Add DeltaFIFO (a controller framework piece) #5473

Merged
merged 4 commits into from Mar 31, 2015

Conversation

lavalamp
Copy link
Member

Splitting off completed chunks from #5270.

// KeyOf exposes f's keyFunc, but also detects the key of a Deltas object or
// DeletedFinalStateUnknown objects.
func (f *DeltaFIFO) KeyOf(obj interface{}) (string, error) {
if d, ok := obj.(Deltas); ok {
Copy link
Contributor

Choose a reason for hiding this comment

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

perhaps a type switch here instead of two casts + check?

Copy link
Member Author

Choose a reason for hiding this comment

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

nope-- has to be done serially because the deletion marker would be stored as a delta...

@brendandburns
Copy link
Contributor

Part way done, will look more later.

@yujuhong yujuhong assigned brendandburns and unassigned yujuhong Mar 17, 2015
@yujuhong
Copy link
Contributor

Re-assigning to Brendan since he has already started reviewing (it was gonna take me a while to catch up anyway).

func (f *DeltaFIFO) Get(obj interface{}) (item interface{}, exists bool, err error) {
key, err := f.KeyOf(obj)
if err != nil {
return nil, false, fmt.Errorf("couldn't create key for object: %v", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

same, wrt masking errors

@brendandburns
Copy link
Contributor

Nothing too major.

@lavalamp
Copy link
Member Author

Will make changes and do another push when I get back next week, couldn't resist arguing a few points though. ;)


// DeltaFIFO is like FIFO, but allows you to process deletes.
//
// DeltaFIFO solves this use case:
Copy link
Member

Choose a reason for hiding this comment

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

More documentation of the model and intended usage is necessary.

Copy link
Member

Choose a reason for hiding this comment

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

This is basically a producer-consumer workqueue implementation?

@lavalamp
Copy link
Member Author

Mostly fixed. Still thinking about Get/List & thread safety.

@lavalamp lavalamp force-pushed the fix6 branch 2 times, most recently from 44ec4e7 to e5fa695 Compare March 30, 2015 23:19
@lavalamp
Copy link
Member Author

OK, I pushed a change to make sure that all slices (the Deltas objects) always only have one owner, which should resolve the potential threading problem that @brendandburns noticed. Sorry for the delay, should be ready to go now.

@brendandburns
Copy link
Contributor

Aside from moving the function up like @bgrant0607 and I requested, LGTM. Defer to Brian for final LGTM that his comments have been addressed. Move the function up and get an LGTM from @bgrant0607 and I'll merge.

--brendan

@lavalamp
Copy link
Member Author

Huh, I thought I did move that--

Oh, I see, I moved it almost all the way to the top, I thought it was useful to see the type definition first still. I don't care that much, I moved it the rest of the way. PTAL

@lavalamp
Copy link
Member Author

Travis is a flake, filed #6233

brendandburns added a commit that referenced this pull request Mar 31, 2015
Add DeltaFIFO (a controller framework piece)
@brendandburns brendandburns merged commit 313a365 into kubernetes:master Mar 31, 2015
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.

None yet

5 participants