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

Implement windows lockfile #1662

Merged
merged 1 commit into from
Jul 12, 2023
Merged

Conversation

mikenorgate
Copy link
Contributor

This is an implementation of lockfile for Windows, it includes a refactor of the Linux code to remove duplication

Signed-off-by: Mike Norgate [email protected]

@mikenorgate mikenorgate force-pushed the windows-upstream branch 4 times, most recently from 841c869 to 5130df0 Compare July 5, 2023 10:46
@rhatdan
Copy link
Member

rhatdan commented Jul 5, 2023

Copy link
Member

@giuseppe giuseppe left a comment

Choose a reason for hiding this comment

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

LGTM

pkg/lockfile/lockfile_windows.go Outdated Show resolved Hide resolved
@n1hility
Copy link
Member

n1hility commented Jul 6, 2023

i only have one comment/suggestion here and its not a showstopper imo

Copy link
Member

@n1hility n1hility left a comment

Choose a reason for hiding this comment

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

Thanks! LGTM

pkg/lockfile/lockfile_windows.go Outdated Show resolved Hide resolved
pkg/lockfile/lockfile_windows.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@mtrmac mtrmac left a comment

Choose a reason for hiding this comment

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

Now a full review.

I think the unlockHandle and the test parts need addressing; the rest is completely non-blocking subjective aesthetics.

pkg/lockfile/lockfile_test.go Outdated Show resolved Hide resolved
pkg/lockfile/lockfile_test.go Outdated Show resolved Hide resolved
pkg/lockfile/lockfile_test.go Outdated Show resolved Hide resolved
pkg/lockfile/lockfile_test.go Outdated Show resolved Hide resolved
pkg/lockfile/lockfile.go Outdated Show resolved Hide resolved
pkg/lockfile/lockfile.go Outdated Show resolved Hide resolved
pkg/lockfile/lockfile.go Outdated Show resolved Hide resolved
@mikenorgate
Copy link
Contributor Author

@mtrmac I've made some updates based on your comments

Copy link
Collaborator

@mtrmac mtrmac left a comment

Choose a reason for hiding this comment

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

Thanks!

LGTM, there are just a few more opportunities to use the new enum instead of a bool.

rwMutex: &sync.RWMutex{},
stateMutex: &sync.Mutex{},
lw: newLastWrite(), // For compatibility, the first call of .Modified() will always report a change.
lockType: lType,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Note to self:

  • Isn’t this field only used if locked? So it doesn’t actually need to be set here.
  • Actually locked and lockType could be combined.

Something to clean up later…

Copy link
Collaborator

Choose a reason for hiding this comment

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

  • Actually locked and lockType could be combined.

On second thought, that might not be worthwhile, e.g. some of the lock functions would need to deal with the “unlocked” value.

pkg/lockfile/lockfile.go Outdated Show resolved Hide resolved
pkg/lockfile/lockfile.go Outdated Show resolved Hide resolved
pkg/lockfile/lockfile.go Outdated Show resolved Hide resolved
@TomSweeneyRedHat
Copy link
Member

@mikenorgate looks like you need to rebase this.

Copy link
Collaborator

@mtrmac mtrmac left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks!

pkg/lockfile/lastwrite.go Outdated Show resolved Hide resolved
Signed-off-by: Mike Norgate <[email protected]>
@mtrmac
Copy link
Collaborator

mtrmac commented Jul 12, 2023

Thanks again!

@mtrmac mtrmac merged commit c929d20 into containers:main Jul 12, 2023
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.

6 participants