github.com/mutagen-io/mutagen@v0.18.0-rc1/pkg/synchronization/endpoint/local/staging.go (about) 1 package local 2 3 import ( 4 "github.com/mutagen-io/mutagen/pkg/synchronization/core" 5 "github.com/mutagen-io/mutagen/pkg/synchronization/rsync" 6 ) 7 8 // stager is the interface implemented by file staging implementations. Its 9 // Contains, Sink, and Provide methods must be safe for concurrent invocation, 10 // as well as for concurrent usage with the io.WriteCloser instances returned by 11 // Sink. However, its Initialize and Finalize methods need not be safe for 12 // concurrent invocation. 13 type stager interface { 14 // Initialize informs the stager that staging and transitioning are about to 15 // commence. This method will always be called before any calls to Contains, 16 // Sink, or Provide, even after a previously failed staging session for 17 // which Finalize was not invoked. 18 Initialize() error 19 // Contains returns whether or not the stager contains the specified 20 // content. 21 Contains(path string, digest []byte) (bool, error) 22 // Sinker is the interface that the stager must implement to receive files 23 // over an rsync transmission stream. 24 rsync.Sinker 25 // Provider is the interface that the stager must implement to provide files 26 // for transition operations after staging is complete. 27 core.Provider 28 // Finalize informs the stager that staging has completed and that no 29 // further Contains, Sink, or Provide calls will be made until after the 30 // next call to Initialize. Implementations should use this method to clean 31 // up any on-disk resources and may use this method to free any in-memory 32 // resources. 33 Finalize() error 34 }