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

Migrate DiskManager to Kotlin #334

Merged
merged 7 commits into from
May 2, 2024

Conversation

breedx-splk
Copy link
Contributor

So this started as a change to limit the coupling to the global ServiceManager. Initially it was just going to be a refactor, but it seemed to make sense to leverage some of the kotlin language features in the process. Because the SimpleTemporaryFileProvider was right next door, I picked that up as well.

@breedx-splk breedx-splk requested a review from a team May 1, 2024 17:46
Comment on lines +21 to +23
@get:Throws(IOException::class)
val signalsBufferDir: File
get() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this is fairly idiomatic these days....but I'm happy to be talked out of this style/syntax if it is important to anyone.

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 fair enough, considering that Kotlin allows you to access getter methods as if they were class fields later on, it seems like the question of defining them like this vs regular getters boils down to personal preferences really. I've seen custom accessors widely used for cases where the get() or set() body is quite small, like this one, although it does seem a bit strange to me to see them as big as the get() in maxFolderSize for example.

Regarding my personal preferences, I find it easier to read and quickly set apart in my mind what parts in a class hold business logic vs what others only store things in memory by using regular methods and fields, although it's probably a matter of getting used to different styles, so it's not the end of the world for me to use either approach.

@breedx-splk breedx-splk merged commit 8b2c667 into open-telemetry:main May 2, 2024
3 checks passed
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.

2 participants