synchronization

package
v0.11.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 20, 2020 License: MIT Imports: 26 Imported by: 4

Documentation

Overview

Package session provides session management facilities, including the core synchronization loop logic. It is the highest-level package in Mutagen, tying together all synchronization, transport, and coordination logic.

Index

Constants

This section is empty.

Variables

View Source
var ProtocolHandlers = map[urlpkg.Protocol]ProtocolHandler{}

ProtocolHandlers is a map of registered protocol handlers. It should only be modified during init() operations.

View Source
var ScanMode_name = map[int32]string{
	0: "ScanModeDefault",
	1: "ScanModeFull",
	2: "ScanModeAccelerated",
}
View Source
var ScanMode_value = map[string]int32{
	"ScanModeDefault":     0,
	"ScanModeFull":        1,
	"ScanModeAccelerated": 2,
}
View Source
var StageMode_name = map[int32]string{
	0: "StageModeDefault",
	1: "StageModeMutagen",
	2: "StageModeNeighboring",
}
View Source
var StageMode_value = map[string]int32{
	"StageModeDefault":     0,
	"StageModeMutagen":     1,
	"StageModeNeighboring": 2,
}
View Source
var Status_name = map[int32]string{
	0:  "Disconnected",
	1:  "HaltedOnRootEmptied",
	2:  "HaltedOnRootDeletion",
	3:  "HaltedOnRootTypeChange",
	4:  "ConnectingAlpha",
	5:  "ConnectingBeta",
	6:  "Watching",
	7:  "Scanning",
	8:  "WaitingForRescan",
	9:  "Reconciling",
	10: "StagingAlpha",
	11: "StagingBeta",
	12: "Transitioning",
	13: "Saving",
}
View Source
var Status_value = map[string]int32{
	"Disconnected":           0,
	"HaltedOnRootEmptied":    1,
	"HaltedOnRootDeletion":   2,
	"HaltedOnRootTypeChange": 3,
	"ConnectingAlpha":        4,
	"ConnectingBeta":         5,
	"Watching":               6,
	"Scanning":               7,
	"WaitingForRescan":       8,
	"Reconciling":            9,
	"StagingAlpha":           10,
	"StagingBeta":            11,
	"Transitioning":          12,
	"Saving":                 13,
}
View Source
var Version_name = map[int32]string{
	0: "Invalid",
	1: "Version1",
}
View Source
var Version_value = map[string]int32{
	"Invalid":  0,
	"Version1": 1,
}
View Source
var WatchMode_name = map[int32]string{
	0: "WatchModeDefault",
	1: "WatchModePortable",
	2: "WatchModeForcePoll",
	3: "WatchModeNoWatch",
}
View Source
var WatchMode_value = map[string]int32{
	"WatchModeDefault":   0,
	"WatchModePortable":  1,
	"WatchModeForcePoll": 2,
	"WatchModeNoWatch":   3,
}

Functions

This section is empty.

Types

type Configuration

type Configuration struct {
	// SynchronizationMode specifies the synchronization mode that should be
	// used in synchronization.
	SynchronizationMode core.SynchronizationMode `protobuf:"varint,11,opt,name=synchronizationMode,proto3,enum=core.SynchronizationMode" json:"synchronizationMode,omitempty"`
	// MaximumEntryCount specifies the maximum number of filesystem entries that
	// endpoints will tolerate managing. A zero value indicates no limit.
	MaximumEntryCount uint64 `protobuf:"varint,12,opt,name=maximumEntryCount,proto3" json:"maximumEntryCount,omitempty"`
	// MaximumStagingFileSize is the maximum (individual) file size that
	// endpoints will stage. A zero value indicates no limit.
	MaximumStagingFileSize uint64 `protobuf:"varint,13,opt,name=maximumStagingFileSize,proto3" json:"maximumStagingFileSize,omitempty"`
	// ProbeMode specifies the filesystem probing mode.
	ProbeMode behavior.ProbeMode `protobuf:"varint,14,opt,name=probeMode,proto3,enum=behavior.ProbeMode" json:"probeMode,omitempty"`
	// ScanMode specifies the synchronization root scanning mode.
	ScanMode ScanMode `protobuf:"varint,15,opt,name=scanMode,proto3,enum=synchronization.ScanMode" json:"scanMode,omitempty"`
	// StageMode specifies the file staging mode.
	StageMode StageMode `protobuf:"varint,16,opt,name=stageMode,proto3,enum=synchronization.StageMode" json:"stageMode,omitempty"`
	// SymlinkMode specifies the symlink mode that should be used in
	// synchronization.
	SymlinkMode core.SymlinkMode `protobuf:"varint,1,opt,name=symlinkMode,proto3,enum=core.SymlinkMode" json:"symlinkMode,omitempty"`
	// WatchMode specifies the filesystem watching mode.
	WatchMode WatchMode `protobuf:"varint,21,opt,name=watchMode,proto3,enum=synchronization.WatchMode" json:"watchMode,omitempty"`
	// WatchPollingInterval specifies the interval (in seconds) for poll-based
	// file monitoring. A value of 0 specifies that the default interval should
	// be used.
	WatchPollingInterval uint32 `protobuf:"varint,22,opt,name=watchPollingInterval,proto3" json:"watchPollingInterval,omitempty"`
	// DefaultIgnores specifies the ignore patterns brought in from the global
	// configuration.
	// DEPRECATED: This field is no longer used when loading from global
	// configuration. Instead, ignores provided by global configuration are
	// simply merged into the ignore list of the main configuration. However,
	// older sessions still use this field.
	DefaultIgnores []string `protobuf:"bytes,31,rep,name=defaultIgnores,proto3" json:"defaultIgnores,omitempty"`
	// Ignores specifies the ignore patterns brought in from the create request.
	Ignores []string `protobuf:"bytes,32,rep,name=ignores,proto3" json:"ignores,omitempty"`
	// IgnoreVCSMode specifies the VCS ignore mode that should be used in
	// synchronization.
	IgnoreVCSMode core.IgnoreVCSMode `protobuf:"varint,33,opt,name=ignoreVCSMode,proto3,enum=core.IgnoreVCSMode" json:"ignoreVCSMode,omitempty"`
	// DefaultFileMode specifies the default permission mode to use for new
	// files in "portable" permission propagation mode.
	DefaultFileMode uint32 `protobuf:"varint,63,opt,name=defaultFileMode,proto3" json:"defaultFileMode,omitempty"`
	// DefaultDirectoryMode specifies the default permission mode to use for new
	// files in "portable" permission propagation mode.
	DefaultDirectoryMode uint32 `protobuf:"varint,64,opt,name=defaultDirectoryMode,proto3" json:"defaultDirectoryMode,omitempty"`
	// DefaultOwner specifies the default owner identifier to use when setting
	// ownership of new files and directories in "portable" permission
	// propagation mode.
	DefaultOwner string `protobuf:"bytes,65,opt,name=defaultOwner,proto3" json:"defaultOwner,omitempty"`
	// DefaultGroup specifies the default group identifier to use when setting
	// ownership of new files and directories in "portable" permission
	// propagation mode.
	DefaultGroup         string   `protobuf:"bytes,66,opt,name=defaultGroup,proto3" json:"defaultGroup,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

Configuration encodes session configuration parameters. It is used for create commands to specify configuration options, for loading global configuration options, and for storing a merged configuration inside sessions.

func MergeConfigurations

func MergeConfigurations(lower, higher *Configuration) *Configuration

MergeConfigurations merges two configurations of differing priorities. Both configurations must be non-nil.

func (*Configuration) Descriptor

func (*Configuration) Descriptor() ([]byte, []int)

func (*Configuration) EnsureValid

func (c *Configuration) EnsureValid(endpointSpecific bool) error

EnsureValid ensures that Configuration's invariants are respected. The validation of the configuration depends on whether or not it is endpoint-specific.

func (*Configuration) GetDefaultDirectoryMode

func (m *Configuration) GetDefaultDirectoryMode() uint32

func (*Configuration) GetDefaultFileMode

func (m *Configuration) GetDefaultFileMode() uint32

func (*Configuration) GetDefaultGroup

func (m *Configuration) GetDefaultGroup() string

func (*Configuration) GetDefaultIgnores

func (m *Configuration) GetDefaultIgnores() []string

func (*Configuration) GetDefaultOwner

func (m *Configuration) GetDefaultOwner() string

func (*Configuration) GetIgnoreVCSMode

func (m *Configuration) GetIgnoreVCSMode() core.IgnoreVCSMode

func (*Configuration) GetIgnores

func (m *Configuration) GetIgnores() []string

func (*Configuration) GetMaximumEntryCount

func (m *Configuration) GetMaximumEntryCount() uint64

func (*Configuration) GetMaximumStagingFileSize

func (m *Configuration) GetMaximumStagingFileSize() uint64

func (*Configuration) GetProbeMode

func (m *Configuration) GetProbeMode() behavior.ProbeMode

func (*Configuration) GetScanMode

func (m *Configuration) GetScanMode() ScanMode

func (*Configuration) GetStageMode

func (m *Configuration) GetStageMode() StageMode

func (*Configuration) GetSymlinkMode

func (m *Configuration) GetSymlinkMode() core.SymlinkMode

func (*Configuration) GetSynchronizationMode

func (m *Configuration) GetSynchronizationMode() core.SynchronizationMode

func (*Configuration) GetWatchMode

func (m *Configuration) GetWatchMode() WatchMode

func (*Configuration) GetWatchPollingInterval

func (m *Configuration) GetWatchPollingInterval() uint32

func (*Configuration) ProtoMessage

func (*Configuration) ProtoMessage()

func (*Configuration) Reset

func (m *Configuration) Reset()

func (*Configuration) String

func (m *Configuration) String() string

func (*Configuration) XXX_DiscardUnknown

func (m *Configuration) XXX_DiscardUnknown()

func (*Configuration) XXX_Marshal

func (m *Configuration) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Configuration) XXX_Merge

func (m *Configuration) XXX_Merge(src proto.Message)

func (*Configuration) XXX_Size

func (m *Configuration) XXX_Size() int

func (*Configuration) XXX_Unmarshal

func (m *Configuration) XXX_Unmarshal(b []byte) error

type Endpoint

type Endpoint interface {
	// Poll performs a one-shot poll for filesystem modifications in the
	// endpoint's root. It blocks until an event occurs, the provided context is
	// cancelled, or an error occurs. In the first two cases it returns nil. The
	// provided context is guaranteed to be cancelled eventually.
	Poll(ctx context.Context) error

	// Scan performs a scan of the endpoint's synchronization root. It allows
	// the ancestor to be passed in for optimized snapshot transfers if the
	// endpoint is remote. The ancestor may be nil, in which transfers from
	// remote endpoints may be less than optimal. The full parameter forces the
	// function to perform a full (warm) scan, avoiding any acceleration that
	// might be available on the endpoint. The function returns the scan result,
	// a boolean indicating whether or not the synchronization root preserves
	// POSIX executability bits, any error that occurred while trying to create
	// the scan, and a boolean indicating whether or not to re-try the scan (in
	// the event of an error).
	Scan(ctx context.Context, ancestor *core.Entry, full bool) (*core.Entry, bool, error, bool)

	// Stage performs staging on the endpoint. It accepts a list of file paths
	// and a separate list of desired digests corresponding to those paths. For
	// performance reasons, the paths should be passed in depth-first traversal
	// order. This method will filter the list based on what it already has
	// staged from previously interrupted stagings and what can be staged from
	// local contents (e.g. in cases of renames and copies), and then return a
	// list of paths, their signatures, and a receiver to receive them. The
	// returned path list must maintain relative ordering for its filtered
	// paths, again for performance reasons. If the list of paths is empty, then
	// all paths were either already staged or able to be staged from local
	// data, and the receiver will be nil. Otherwise, the receiver will be
	// non-nil and must be finalized (i.e. transmitted to) before subsequent
	// methods can be invoked on the endpoint. This method is allowed to modify
	// the argument slices. If the receiver fails, the endpoint should be
	// considered contaminated and not used (though shutdown can and should
	// still be invoked).
	Stage(paths []string, digests [][]byte) ([]string, []*rsync.Signature, rsync.Receiver, error)

	// Supply transmits files in a streaming fashion using the rsync algorithm
	// to the specified receiver.
	Supply(paths []string, signatures []*rsync.Signature, receiver rsync.Receiver) error

	// Transition performs the specified transitions on the endpoint. It returns
	// a list of successfully applied changes and a list of problems that
	// occurred while applying transitions.
	// TODO: Should we consider pre-emptability for transition? It could
	// probably be done by just checking for cancellation during each transition
	// path and reporting "cancelled" for problems arising after that, but
	// usually the long-blocking transitions are going to be the ones where
	// we're creating the root with a huge number of files and wouldn't catch
	// cancellation until they're all done anyway.
	Transition(ctx context.Context, transitions []*core.Change) ([]*core.Entry, []*core.Problem, bool, error)

	// Shutdown terminates any resources associated with the endpoint. For local
	// endpoints, Shutdown will not preempt calls, but for remote endpoints it
	// will because it closes the underlying connection to the endpoint
	// (actually, it terminates that connection). Shutdown can safely be called
	// concurrently with other methods, though it's only recommended when you
	// don't want the possibility of preempting the method (e.g. in Transition)
	// or you know that the operation can continue and terminate on its own
	// (e.g. in Scan). Shutdown should only be invoked once.
	Shutdown() error
}

Endpoint defines the interface to which synchronization endpoints must adhere for a single session. It provides all primitives necessary to support synchronization. None of its methods should be considered safe for concurrent invocation except Shutdown. If any method returns an error, the endpoint should be considered failed and no more of its methods (other than Shutdown) should be invoked.

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager provides synchronization session management facilities. Its methods are safe for concurrent usage, so it can be easily exported via an RPC interface.

func NewManager

func NewManager(logger *logging.Logger) (*Manager, error)

NewManager creates a new Manager instance.

func (*Manager) Create

func (m *Manager) Create(
	ctx context.Context,
	alpha, beta *url.URL,
	configuration, configurationAlpha, configurationBeta *Configuration,
	name string,
	labels map[string]string,
	paused bool,
	prompter string,
) (string, error)

Create tells the manager to create a new session.

func (*Manager) Flush

func (m *Manager) Flush(ctx context.Context, selection *selection.Selection, prompter string, skipWait bool) error

Flush tells the manager to flush sessions matching the given specifications.

func (*Manager) List

func (m *Manager) List(_ context.Context, selection *selection.Selection, previousStateIndex uint64) (uint64, []*State, error)

List requests a state snapshot for the specified sessions.

func (*Manager) Pause

func (m *Manager) Pause(ctx context.Context, selection *selection.Selection, prompter string) error

Pause tells the manager to pause sessions matching the given specifications.

func (*Manager) Reset added in v0.10.2

func (m *Manager) Reset(ctx context.Context, selection *selection.Selection, prompter string) error

Reset tells the manager to reset session histories for sessions matching the given specifications.

func (*Manager) Resume

func (m *Manager) Resume(ctx context.Context, selection *selection.Selection, prompter string) error

Resume tells the manager to resume sessions matching the given specifications.

func (*Manager) Shutdown

func (m *Manager) Shutdown()

Shutdown tells the manager to gracefully halt sessions.

func (*Manager) Terminate

func (m *Manager) Terminate(ctx context.Context, selection *selection.Selection, prompter string) error

Terminate tells the manager to terminate sessions matching the given specifications.

type ProtocolHandler

type ProtocolHandler interface {
	// Connect connects to an endpoint using the connection parameters in the
	// provided URL and the specified prompter (if any). It then initializes the
	// endpoint using the specified parameters.
	Connect(
		ctx context.Context,
		logger *logging.Logger,
		url *urlpkg.URL,
		prompter string,
		session string,
		version Version,
		configuration *Configuration,
		alpha bool,
	) (Endpoint, error)
}

ProtocolHandler defines the interface that protocol handlers must support in order to connect to endpoints.

type ScanMode

type ScanMode int32

ScanMode specifies the mode for synchronization root scanning.

const (
	// ScanMode_ScanModeDefault represents an unspecified scan mode. It should
	// be converted to one of the following values based on the desired default
	// behavior.
	ScanMode_ScanModeDefault ScanMode = 0
	// ScanMode_ScanModeFull specifies that full scans should be performed on
	// each synchronization cycle.
	ScanMode_ScanModeFull ScanMode = 1
	// ScanMode_ScanModeAccelerated specifies that scans should attempt to use
	// watch-based acceleration.
	ScanMode_ScanModeAccelerated ScanMode = 2
)

func (ScanMode) Description

func (m ScanMode) Description() string

Description returns a human-readable description of a scan mode.

func (ScanMode) EnumDescriptor

func (ScanMode) EnumDescriptor() ([]byte, []int)

func (ScanMode) IsDefault

func (m ScanMode) IsDefault() bool

IsDefault indicates whether or not the scan mode is ScanMode_ScanModeDefault.

func (ScanMode) String

func (x ScanMode) String() string

func (ScanMode) Supported

func (m ScanMode) Supported() bool

Supported indicates whether or not a particular scan mode is a valid, non-default value.

func (*ScanMode) UnmarshalText

func (m *ScanMode) UnmarshalText(textBytes []byte) error

UnmarshalText implements the text unmarshalling interface used when loading from TOML files.

type Session

type Session struct {
	// Identifier is the (unique) session identifier. It is static. It cannot be
	// empty.
	Identifier string `protobuf:"bytes,1,opt,name=identifier,proto3" json:"identifier,omitempty"`
	// Version is the session version. It is static.
	Version Version `protobuf:"varint,2,opt,name=version,proto3,enum=synchronization.Version" json:"version,omitempty"`
	// CreationTime is the creation time of the session. It is static. It cannot
	// be nil.
	CreationTime *timestamp.Timestamp `protobuf:"bytes,3,opt,name=creationTime,proto3" json:"creationTime,omitempty"`
	// CreatingVersionMajor is the major version component of the version of
	// Mutagen which created the session. It is static.
	CreatingVersionMajor uint32 `protobuf:"varint,4,opt,name=creatingVersionMajor,proto3" json:"creatingVersionMajor,omitempty"`
	// CreatingVersionMinor is the minor version component of the version of
	// Mutagen which created the session. It is static.
	CreatingVersionMinor uint32 `protobuf:"varint,5,opt,name=creatingVersionMinor,proto3" json:"creatingVersionMinor,omitempty"`
	// CreatingVersionPatch is the patch version component of the version of
	// Mutagen which created the session. It is static.
	CreatingVersionPatch uint32 `protobuf:"varint,6,opt,name=creatingVersionPatch,proto3" json:"creatingVersionPatch,omitempty"`
	// Alpha is the alpha endpoint URL. It is static. It cannot be nil.
	Alpha *url.URL `protobuf:"bytes,7,opt,name=alpha,proto3" json:"alpha,omitempty"`
	// Beta is the beta endpoint URL. It is static. It cannot be nil.
	Beta *url.URL `protobuf:"bytes,8,opt,name=beta,proto3" json:"beta,omitempty"`
	// Configuration is the flattened session configuration. It is static. It
	// cannot be nil.
	Configuration *Configuration `protobuf:"bytes,9,opt,name=configuration,proto3" json:"configuration,omitempty"`
	// ConfigurationAlpha are the alpha-specific session configuration
	// overrides. It is static. It may be nil for existing sessions loaded from
	// disk, but it is not considered valid unless non-nil, so it should be
	// replaced with an empty default value in-memory if a nil on-disk value is
	// detected.
	ConfigurationAlpha *Configuration `protobuf:"bytes,11,opt,name=configurationAlpha,proto3" json:"configurationAlpha,omitempty"`
	// ConfigurationBeta are the beta-specific session configuration overrides.
	// It is static. It may be nil for existing sessions loaded from disk, but
	// it is not considered valid unless non-nil, so it should be replaced with
	// an empty default value in-memory if a nil on-disk value is detected.
	ConfigurationBeta *Configuration `protobuf:"bytes,12,opt,name=configurationBeta,proto3" json:"configurationBeta,omitempty"`
	// Name is a user-friendly name for the session. It may be empty and is not
	// guaranteed to be unique across all sessions. It is only used as a simpler
	// handle for specifying sessions. It is static.
	Name string `protobuf:"bytes,14,opt,name=name,proto3" json:"name,omitempty"`
	// Labels are the session labels. They are static.
	Labels map[string]string `` /* 154-byte string literal not displayed */
	// Paused indicates whether or not the session is marked as paused.
	Paused               bool     `protobuf:"varint,10,opt,name=paused,proto3" json:"paused,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Session) Descriptor

func (*Session) Descriptor() ([]byte, []int)

func (*Session) EnsureValid

func (s *Session) EnsureValid() error

EnsureValid ensures that Session's invariants are respected.

func (*Session) GetAlpha

func (m *Session) GetAlpha() *url.URL

func (*Session) GetBeta

func (m *Session) GetBeta() *url.URL

func (*Session) GetConfiguration

func (m *Session) GetConfiguration() *Configuration

func (*Session) GetConfigurationAlpha

func (m *Session) GetConfigurationAlpha() *Configuration

func (*Session) GetConfigurationBeta

func (m *Session) GetConfigurationBeta() *Configuration

func (*Session) GetCreatingVersionMajor

func (m *Session) GetCreatingVersionMajor() uint32

func (*Session) GetCreatingVersionMinor

func (m *Session) GetCreatingVersionMinor() uint32

func (*Session) GetCreatingVersionPatch

func (m *Session) GetCreatingVersionPatch() uint32

func (*Session) GetCreationTime

func (m *Session) GetCreationTime() *timestamp.Timestamp

func (*Session) GetIdentifier

func (m *Session) GetIdentifier() string

func (*Session) GetLabels

func (m *Session) GetLabels() map[string]string

func (*Session) GetName

func (m *Session) GetName() string

func (*Session) GetPaused

func (m *Session) GetPaused() bool

func (*Session) GetVersion

func (m *Session) GetVersion() Version

func (*Session) ProtoMessage

func (*Session) ProtoMessage()

func (*Session) Reset

func (m *Session) Reset()

func (*Session) String

func (m *Session) String() string

func (*Session) XXX_DiscardUnknown

func (m *Session) XXX_DiscardUnknown()

func (*Session) XXX_Marshal

func (m *Session) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Session) XXX_Merge

func (m *Session) XXX_Merge(src proto.Message)

func (*Session) XXX_Size

func (m *Session) XXX_Size() int

func (*Session) XXX_Unmarshal

func (m *Session) XXX_Unmarshal(b []byte) error

type StageMode

type StageMode int32

StageMode specifies the mode for file staging.

const (
	// StageMode_StageModeDefault represents an unspecified staging mode. It
	// should be converted to one of the following values based on the desired
	// default behavior.
	StageMode_StageModeDefault StageMode = 0
	// StageMode_StageModeMutagen specifies that files should be staged in the
	// Mutagen data directory.
	StageMode_StageModeMutagen StageMode = 1
	// StageMode_StageModeNeighboring specifies that files should be staged in a
	// directory which neighbors the synchronization root.
	StageMode_StageModeNeighboring StageMode = 2
)

func (StageMode) Description

func (m StageMode) Description() string

Description returns a human-readable description of a staging mode.

func (StageMode) EnumDescriptor

func (StageMode) EnumDescriptor() ([]byte, []int)

func (StageMode) IsDefault

func (m StageMode) IsDefault() bool

IsDefault indicates whether or not the staging mode is StageMode_StageModeDefault.

func (StageMode) String

func (x StageMode) String() string

func (StageMode) Supported

func (m StageMode) Supported() bool

Supported indicates whether or not a particular staging mode is a valid, non-default value.

func (*StageMode) UnmarshalText

func (m *StageMode) UnmarshalText(textBytes []byte) error

UnmarshalText implements the text unmarshalling interface used when loading from TOML files.

type State

type State struct {
	Session                         *Session              `protobuf:"bytes,1,opt,name=session,proto3" json:"session,omitempty"`
	Status                          Status                `protobuf:"varint,2,opt,name=status,proto3,enum=synchronization.Status" json:"status,omitempty"`
	AlphaConnected                  bool                  `protobuf:"varint,3,opt,name=alphaConnected,proto3" json:"alphaConnected,omitempty"`
	BetaConnected                   bool                  `protobuf:"varint,4,opt,name=betaConnected,proto3" json:"betaConnected,omitempty"`
	LastError                       string                `protobuf:"bytes,5,opt,name=lastError,proto3" json:"lastError,omitempty"`
	SuccessfulSynchronizationCycles uint64                `protobuf:"varint,6,opt,name=successfulSynchronizationCycles,proto3" json:"successfulSynchronizationCycles,omitempty"`
	StagingStatus                   *rsync.ReceiverStatus `protobuf:"bytes,7,opt,name=stagingStatus,proto3" json:"stagingStatus,omitempty"`
	Conflicts                       []*core.Conflict      `protobuf:"bytes,8,rep,name=conflicts,proto3" json:"conflicts,omitempty"`
	AlphaProblems                   []*core.Problem       `protobuf:"bytes,9,rep,name=alphaProblems,proto3" json:"alphaProblems,omitempty"`
	BetaProblems                    []*core.Problem       `protobuf:"bytes,10,rep,name=betaProblems,proto3" json:"betaProblems,omitempty"`
	XXX_NoUnkeyedLiteral            struct{}              `json:"-"`
	XXX_unrecognized                []byte                `json:"-"`
	XXX_sizecache                   int32                 `json:"-"`
}

func (*State) Copy

func (s *State) Copy() *State

Copy creates a copy of the session state, deep-copying those members which are mutable.

func (*State) Descriptor

func (*State) Descriptor() ([]byte, []int)

func (*State) EnsureValid

func (s *State) EnsureValid() error

EnsureValid ensures that State's invariants are respected.

func (*State) GetAlphaConnected

func (m *State) GetAlphaConnected() bool

func (*State) GetAlphaProblems

func (m *State) GetAlphaProblems() []*core.Problem

func (*State) GetBetaConnected

func (m *State) GetBetaConnected() bool

func (*State) GetBetaProblems

func (m *State) GetBetaProblems() []*core.Problem

func (*State) GetConflicts

func (m *State) GetConflicts() []*core.Conflict

func (*State) GetLastError

func (m *State) GetLastError() string

func (*State) GetSession

func (m *State) GetSession() *Session

func (*State) GetStagingStatus

func (m *State) GetStagingStatus() *rsync.ReceiverStatus

func (*State) GetStatus

func (m *State) GetStatus() Status

func (*State) GetSuccessfulSynchronizationCycles

func (m *State) GetSuccessfulSynchronizationCycles() uint64

func (*State) ProtoMessage

func (*State) ProtoMessage()

func (*State) Reset

func (m *State) Reset()

func (*State) String

func (m *State) String() string

func (*State) XXX_DiscardUnknown

func (m *State) XXX_DiscardUnknown()

func (*State) XXX_Marshal

func (m *State) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*State) XXX_Merge

func (m *State) XXX_Merge(src proto.Message)

func (*State) XXX_Size

func (m *State) XXX_Size() int

func (*State) XXX_Unmarshal

func (m *State) XXX_Unmarshal(b []byte) error

type Status

type Status int32
const (
	Status_Disconnected           Status = 0
	Status_HaltedOnRootEmptied    Status = 1
	Status_HaltedOnRootDeletion   Status = 2
	Status_HaltedOnRootTypeChange Status = 3
	Status_ConnectingAlpha        Status = 4
	Status_ConnectingBeta         Status = 5
	Status_Watching               Status = 6
	Status_Scanning               Status = 7
	Status_WaitingForRescan       Status = 8
	Status_Reconciling            Status = 9
	Status_StagingAlpha           Status = 10
	Status_StagingBeta            Status = 11
	Status_Transitioning          Status = 12
	Status_Saving                 Status = 13
)

func (Status) Description

func (s Status) Description() string

Description returns a human-readable description of the session status.

func (Status) EnumDescriptor

func (Status) EnumDescriptor() ([]byte, []int)

func (Status) String

func (x Status) String() string

type Version

type Version int32

Version specifies a session version, providing default behavior that can vary without affecting existing sessions.

const (
	// Invalid is the default session version and represents an unspecfied and
	// invalid version. It is used as a sanity check to ensure that version is
	// set for a session.
	Version_Invalid Version = 0
	// Version1 represents session version 1.
	Version_Version1 Version = 1
)

func (Version) DefaultDirectoryMode

func (v Version) DefaultDirectoryMode() filesystem.Mode

DefaultDirectoryMode returns the default directory permission mode for the session version.

func (Version) DefaultFileMode

func (v Version) DefaultFileMode() filesystem.Mode

DefaultFileMode returns the default file permission mode for the session version.

func (Version) DefaultGroupSpecification

func (v Version) DefaultGroupSpecification() string

DefaultGroupSpecification returns the default owner group specification for the session version.

func (Version) DefaultIgnoreVCSMode

func (v Version) DefaultIgnoreVCSMode() core.IgnoreVCSMode

DefaultIgnoreVCSMode returns the default VCS ignore mode for the session version.

func (Version) DefaultMaximumEntryCount

func (v Version) DefaultMaximumEntryCount() uint64

DefaultMaximumEntryCount returns the default maximum entry count for the session version.

func (Version) DefaultMaximumStagingFileSize

func (v Version) DefaultMaximumStagingFileSize() uint64

DefaultMaximumStagingFileSize returns the default maximum staging file size for the session version.

func (Version) DefaultOwnerSpecification

func (v Version) DefaultOwnerSpecification() string

DefaultOwnerSpecification returns the default owner specification for the session version.

func (Version) DefaultProbeMode

func (v Version) DefaultProbeMode() behavior.ProbeMode

DefaultProbeMode returns the default probe mode for the session version.

func (Version) DefaultScanMode

func (v Version) DefaultScanMode() ScanMode

DefaultScanMode returns the default scan mode for the session version.

func (Version) DefaultStageMode

func (v Version) DefaultStageMode() StageMode

DefaultStageMode returns the default staging mode for the session version.

func (Version) DefaultSymlinkMode

func (v Version) DefaultSymlinkMode() core.SymlinkMode

DefaultSymlinkMode returns the default symlink mode for the session version.

func (Version) DefaultSynchronizationMode

func (v Version) DefaultSynchronizationMode() core.SynchronizationMode

DefaultSynchronizationMode returns the default synchronization mode for the session version.

func (Version) DefaultWatchMode

func (v Version) DefaultWatchMode() WatchMode

DefaultWatchMode returns the default watch mode for the session version.

func (Version) DefaultWatchPollingInterval

func (v Version) DefaultWatchPollingInterval() uint32

DefaultWatchPollingInterval returns the default watch polling interval for the session version.

func (Version) EnumDescriptor

func (Version) EnumDescriptor() ([]byte, []int)

func (Version) Hasher

func (v Version) Hasher() hash.Hash

Hasher creates an appropriate hash function for the session version.

func (Version) String

func (x Version) String() string

func (Version) Supported

func (v Version) Supported() bool

Supported indicates whether or not the session version is supported.

type WatchMode

type WatchMode int32

WatchMode specifies the mode for filesystem watching.

const (
	// WatchMode_WatchModeDefault represents an unspecified watch mode. It
	// should be converted to one of the following values based on the desired
	// default behavior.
	WatchMode_WatchModeDefault WatchMode = 0
	// WatchMode_WatchModePortable specifies that native recursive watching
	// should be used to monitor paths on systems that support it if those paths
	// fall under the home directory. In these cases, a watch on the entire home
	// directory is established and filtered for events pertaining to the
	// specified path. On all other systems and for all other paths, poll-based
	// watching is used.
	WatchMode_WatchModePortable WatchMode = 1
	// WatchMode_WatchModeForcePoll specifies that only poll-based watching
	// should be used.
	WatchMode_WatchModeForcePoll WatchMode = 2
	// WatchMode_WatchModeNoWatch specifies that no watching should be used
	// (i.e. no events should be generated).
	WatchMode_WatchModeNoWatch WatchMode = 3
)

func (WatchMode) Description

func (m WatchMode) Description() string

Description returns a human-readable description of a watch mode.

func (WatchMode) EnumDescriptor

func (WatchMode) EnumDescriptor() ([]byte, []int)

func (WatchMode) IsDefault

func (m WatchMode) IsDefault() bool

IsDefault indicates whether or not the watch mode is WatchMode_WatchModeDefault.

func (WatchMode) String

func (x WatchMode) String() string

func (WatchMode) Supported

func (m WatchMode) Supported() bool

Supported indicates whether or not a particular watch mode is a valid, non-default value.

func (*WatchMode) UnmarshalText

func (m *WatchMode) UnmarshalText(textBytes []byte) error

UnmarshalText implements the text unmarshalling interface used when loading from TOML files.

Directories

Path Synopsis
Package sync provides the core data structures and algorithms used by Mutagen.
Package sync provides the core data structures and algorithms used by Mutagen.
Package endpoint provides synchronization endpoint implementations.
Package endpoint provides synchronization endpoint implementations.
local
Package local provides a local synchronization endpoint implementation.
Package local provides a local synchronization endpoint implementation.
remote
Package remote provides a client/server architecture for connecting to and hosting a remote synchronization endpoint.
Package remote provides a client/server architecture for connecting to and hosting a remote synchronization endpoint.
Package protocols provides synchronization session protocol handler implementations.
Package protocols provides synchronization session protocol handler implementations.
docker
Package docker provides the Docker synchronization session protocol implementation.
Package docker provides the Docker synchronization session protocol implementation.
local
Package local provides the local synchronization session protocol implementation.
Package local provides the local synchronization session protocol implementation.
ssh
Package ssh provides the SSH synchronization session protocol implementation.
Package ssh provides the SSH synchronization session protocol implementation.
tunnel
Package tunnel provides a tunnel-based synchronization protocol implementation.
Package tunnel provides a tunnel-based synchronization protocol implementation.
Package rsync provides an implementation of the rsync algorithm as described in Andrew Tridgell's thesis (https://www.samba.org/~tridge/phd_thesis.pdf) and the rsync technical report (https://rsync.samba.org/tech_report).
Package rsync provides an implementation of the rsync algorithm as described in Andrew Tridgell's thesis (https://www.samba.org/~tridge/phd_thesis.pdf) and the rsync technical report (https://rsync.samba.org/tech_report).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL