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

SendSnapshot incremental stream #59

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

icarbajovallejo
Copy link

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

Copy link
Member

@mmlb mmlb left a 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
Copy link
Member

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) {
Copy link
Member

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 {
Copy link
Member

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.

Copy link
Author

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^^

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.

None yet

2 participants