-
Notifications
You must be signed in to change notification settings - Fork 24.6k
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
Remove the Snapshot class in favor of using SnapshotInfo #18167
Conversation
The same duality exists for tasks too. |
snapshotInfoBuilder.add(new SnapshotInfo(snapshot)); | ||
} | ||
List<SnapshotInfo> snapshots = snapshotsService.currentSnapshots(request.repository()); | ||
snapshots.forEach(snapshotInfoBuilder::add); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Collections.addAll?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, changing
@nik9000 The thought for merging I can see the reverse point - that the two uses have different intents, but since I felt the intents only differed in how they are serialized for particular use cases, I went with this. I'd appreciate your thoughts, if you think this makes sense |
} | ||
|
||
static final class Fields { | ||
static final String SNAPSHOT = "snapshot"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While you are here why not remove the whole Fields
class and just use strings? That is the "new style". For things that are used in more than one place we'll typically use constants - and if those things are using in parsing the constant will typically be a ParseField, but otherwise we've started to not make these Fields
classes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
++ will do
I left some stylistic comments. I had a quick look around and I agree with you - these two classes look to be the same information just used in different contexts. I like the idea of throwing one away. I don't think I need to do another review - either make the changes I asked for or reply explaining why they aren't a good idea so I'll learn something and merge when you ready. LGTM. |
I think that having the two classes makes sense for tasks because it is clear how they are different. They have subclasses that make them wildly different - compare In this case these things are pretty much the same so I like merging them. Also in my previous comment I wrote |
@nik9000 great, thank you for the review! I implemented all the changes you mentioned. The only one that is outstanding is that |
I can live with that! I'll take incremental progress over being bogged down in changes forever any day! |
@nik9000 great, thanks for the review! |
bff7810
to
22a4575
Compare
o/e/snapshots/Snapshot and o/e/snapshots/SnapshotInfo contain the same fields and represent the same information. Snapshot was used to maintain snapshot information to the snapshot repository, while SnapshotInfo was used to represent the snapshot information as presented through the REST layer. This removes the Snapshot class and combines all uses into the SnapshotInfo class. Closes elastic#18167
22a4575
to
27c6998
Compare
o/e/snapshots/Snapshot and o/e/snapshots/SnapshotInfo contain the same
fields and represent the same information. Snapshot was used to
maintain snapshot information to the snapshot repository, while
SnapshotInfo was used to represent the snapshot information as presented
through the REST layer. This removes the Snapshot class and combines
all uses into the SnapshotInfo class.
Relates to #18156