Skip to content

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
)

// 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
// 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.

// 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.

2 participants