-
Notifications
You must be signed in to change notification settings - Fork 66
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
SendSnapshot incremental stream #59
base: master
Are you sure you want to change the base?
Conversation
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.
needs gofmting too
zfs.go
Outdated
@@ -67,6 +67,17 @@ const ( | |||
Renamed | |||
) | |||
|
|||
// SendFlag is the options flag passed to SendSnapshot and SendSnapshotIncremental | |||
type SendFlag 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.
this should probably be int64
zfs.go
Outdated
@@ -224,24 +235,60 @@ func (d *Dataset) Mount(overlay bool, options []string) (*Dataset, error) { | |||
// ReceiveSnapshot receives a ZFS stream from the input io.Reader, creates a | |||
// new snapshot with the specified name, and streams the input data into the | |||
// newly-created snapshot. | |||
func ReceiveSnapshot(input io.Reader, name string) (*Dataset, error) { | |||
// It includes the option "-F" like boolean value. | |||
func ReceiveSnapshot(input io.Reader, name string, overwrite bool) (*Dataset, 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.
Changing API is a no go, with the current scheme of things you're going to have to create a new function probably something like ReceiveSnapshotOptioned
(bettername++) that takes a map[string]interface{}
which we can check for overwrite
existence and do the right thing.
zfs.go
Outdated
} | ||
|
||
// SendSnapshot sends a ZFS stream of a snapshot to the input io.Writer. | ||
// An error will be returned if the input dataset is not of snapshot type. | ||
func (d *Dataset) SendSnapshot(output io.Writer) error { | ||
// It includes the option "-R". | ||
func (d *Dataset) SendSnapshot(output io.Writer, flags SendFlag) 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.
ditto as ^. side note: man I really wish we had a more expandable api.
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.
I suppose it's not a super improvement. Really, I have done this changes to adapt it to my necessities. I can do more progress but more later. If you want to add more functionalities, go! Because I'm rookie in golang and I take a lot of time^^
I modified the functions ReceiveSnapshot and SendSnapshot to include the options "-F" and "-R". As weel as I add a new function called SendSnapshotIncremental that includes the optiones "-i" and "-I" to send incremental streams of snapshots.
The option -F is a boolean value in ReceiveSnapshot function.
The options for sending snapshots are called:
-i = IncrementalStream
-I = IncrementalPackage
-R = ReplicationStream