github.com/mutagen-io/mutagen@v0.18.0-rc1/pkg/api/models/synchronization/change.go (about)

     1  package synchronization
     2  
     3  import (
     4  	"github.com/mutagen-io/mutagen/pkg/synchronization/core"
     5  )
     6  
     7  // Change represents a filesystem content change.
     8  type Change struct {
     9  	// Path is the path of the root of the change, relative to the
    10  	// synchronization root.
    11  	Path string `json:"path"`
    12  	// Old represents the old filesystem hierarchy at the change path. It may be
    13  	// nil if no content previously existed.
    14  	Old *Entry `json:"old"`
    15  	// New represents the new filesystem hierarchy at the change path. It may be
    16  	// nil if content has been deleted.
    17  	New *Entry `json:"new"`
    18  }
    19  
    20  // loadFromInternal sets a change to match an internal Protocol Buffers
    21  // representation. The change must be valid.
    22  func (c *Change) loadFromInternal(change *core.Change) {
    23  	c.Path = change.Path
    24  	c.Old = newEntryFromInternalEntry(change.Old)
    25  	c.New = newEntryFromInternalEntry(change.New)
    26  }