-
Notifications
You must be signed in to change notification settings - Fork 9.8k
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 snapshot package #9118
*: add snapshot package #9118
Conversation
2b0e785
to
fe02424
Compare
Codecov Report
@@ Coverage Diff @@
## master #9118 +/- ##
==========================================
- Coverage 75.89% 75.86% -0.04%
==========================================
Files 359 361 +2
Lines 30054 30153 +99
==========================================
+ Hits 22810 22876 +66
- Misses 5650 5678 +28
- Partials 1594 1599 +5
Continue to review full report at Codecov.
|
it seems that snapshot should be a sub pkg under etcdctl? |
/cc @Quentin-M can you give it a look? is this what you want? |
That's awesome! Thank you so much! |
b61117c
to
5e7d66b
Compare
snapshot/v3_snapshot.go
Outdated
logger grpclog.LoggerV2 | ||
} | ||
|
||
func (s *v3Snapshotter) Save(ctx context.Context, cli *clientv3.Client, dbPath string) error { |
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.
the client should be part of the config i feel, not per save.
snapshot/logger.go
Outdated
) | ||
|
||
// DefaultLogger defines default snapshot logger based on "capnslog". | ||
var DefaultLogger grpclog.LoggerV2 |
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.
this probably should not belong to snapshot pkg. it is not snapshot related.
snapshot/v3_snapshot.go
Outdated
) | ||
|
||
// Snapshotter defines snapshot methods. | ||
type Snapshotter interface { |
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.
rename to Manager? so it looks like snapshot.Manager.Save/Status/Restore
snapshot/v3_snapshot.go
Outdated
} | ||
|
||
// DBStatus is the snapshot file status. | ||
type DBStatus struct { |
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.
Just Status? Hash/Revision is not db (boltdb in our case) specific, but snapshot related.
snapshot/v3_snapshot.go
Outdated
} | ||
|
||
// Config defines snapshot config. | ||
type Config struct { |
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.
we probably should kill this config struct. this is not snapshot related configuration.
snapshot/v3_snapshot.go
Outdated
return ds, nil | ||
} | ||
|
||
type revision struct { |
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.
move this to util.go?
snapshot/v3_snapshot.go
Outdated
|
||
// initIndex implements ConsistentIndexGetter so the snapshot won't block | ||
// the new raft instance by waiting for a future raft index. | ||
type initIndex int |
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.
move to util.go?
a few nits. look good to me in general. |
@xiang90 PTAL. All fixed. |
lgtm once CI gets passed. |
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
Fix #8632.
Address #9109 with tests in
snapshot
package.