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 ¶
- Variables
- func HousekeepCaches()
- func HousekeepStaging()
- func ServeEndpoint(connection net.Conn) error
- type Configuration
- func (*Configuration) Descriptor() ([]byte, []int)
- func (c *Configuration) EnsureValid(source ConfigurationSource) error
- func (m *Configuration) GetDefaultIgnores() []string
- func (m *Configuration) GetIgnoreVCSMode() sync.IgnoreVCSMode
- func (m *Configuration) GetIgnores() []string
- func (m *Configuration) GetSymlinkMode() sync.SymlinkMode
- func (m *Configuration) GetWatchMode() filesystem.WatchMode
- func (m *Configuration) GetWatchPollingInterval() uint32
- func (*Configuration) ProtoMessage()
- func (m *Configuration) Reset()
- func (m *Configuration) String() string
- func (m *Configuration) XXX_DiscardUnknown()
- func (m *Configuration) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *Configuration) XXX_Merge(src proto.Message)
- func (m *Configuration) XXX_Size() int
- func (m *Configuration) XXX_Unmarshal(b []byte) error
- type ConfigurationSource
- type Manager
- func (m *Manager) Create(alpha, beta *url.URL, configuration *Configuration, prompter string) (string, error)
- func (m *Manager) List(previousStateIndex uint64, specifications []string) (uint64, []*State, error)
- func (m *Manager) Pause(specifications []string, prompter string) error
- func (m *Manager) Resume(specifications []string, prompter string) error
- func (m *Manager) Shutdown()
- func (m *Manager) Terminate(specifications []string, prompter string) error
- type Session
- func (*Session) Descriptor() ([]byte, []int)
- func (s *Session) EnsureValid() error
- func (m *Session) GetAlpha() *url.URL
- func (m *Session) GetBeta() *url.URL
- func (m *Session) GetConfiguration() *Configuration
- func (m *Session) GetCreatingVersionMajor() uint32
- func (m *Session) GetCreatingVersionMinor() uint32
- func (m *Session) GetCreatingVersionPatch() uint32
- func (m *Session) GetCreationTime() *timestamp.Timestamp
- func (m *Session) GetIdentifier() string
- func (m *Session) GetPaused() bool
- func (m *Session) GetVersion() Version
- func (*Session) ProtoMessage()
- func (m *Session) Reset()
- func (m *Session) String() string
- func (m *Session) XXX_DiscardUnknown()
- func (m *Session) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *Session) XXX_Merge(src proto.Message)
- func (m *Session) XXX_Size() int
- func (m *Session) XXX_Unmarshal(b []byte) error
- type State
- func (s *State) Copy() *State
- func (*State) Descriptor() ([]byte, []int)
- func (s *State) EnsureValid() error
- func (m *State) GetAlphaConnected() bool
- func (m *State) GetAlphaProblems() []*sync.Problem
- func (m *State) GetBetaConnected() bool
- func (m *State) GetBetaProblems() []*sync.Problem
- func (m *State) GetConflicts() []*sync.Conflict
- func (m *State) GetLastError() string
- func (m *State) GetSession() *Session
- func (m *State) GetStagingStatus() *rsync.ReceiverStatus
- func (m *State) GetStatus() Status
- func (m *State) GetSuccessfulSynchronizationCycles() uint64
- func (*State) ProtoMessage()
- func (m *State) Reset()
- func (m *State) String() string
- func (m *State) XXX_DiscardUnknown()
- func (m *State) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *State) XXX_Merge(src proto.Message)
- func (m *State) XXX_Size() int
- func (m *State) XXX_Unmarshal(b []byte) error
- type Status
- type Version
Constants ¶
This section is empty.
Variables ¶
var Status_name = map[int32]string{
0: "Disconnected",
1: "HaltedOnRootDeletion",
2: "HaltedOnRootTypeChange",
3: "ConnectingAlpha",
4: "ConnectingBeta",
5: "Watching",
6: "Scanning",
7: "WaitingForRescan",
8: "Reconciling",
9: "StagingAlpha",
10: "StagingBeta",
11: "Transitioning",
12: "Saving",
}
var Status_value = map[string]int32{
"Disconnected": 0,
"HaltedOnRootDeletion": 1,
"HaltedOnRootTypeChange": 2,
"ConnectingAlpha": 3,
"ConnectingBeta": 4,
"Watching": 5,
"Scanning": 6,
"WaitingForRescan": 7,
"Reconciling": 8,
"StagingAlpha": 9,
"StagingBeta": 10,
"Transitioning": 11,
"Saving": 12,
}
var Version_name = map[int32]string{
0: "Invalid",
1: "Version1",
}
var Version_value = map[string]int32{
"Invalid": 0,
"Version1": 1,
}
Functions ¶
func HousekeepStaging ¶
func HousekeepStaging()
HousekeepStaging performs housekeeping of staging roots.
func ServeEndpoint ¶
ServeEndpoint creates and serves a remote endpoint server on the specified connection.
Types ¶
type Configuration ¶
type Configuration struct { // SymlinkMode specifies the symlink mode that should be used in // synchronization. SymlinkMode sync.SymlinkMode `protobuf:"varint,1,opt,name=symlinkMode,proto3,enum=sync.SymlinkMode" json:"symlinkMode,omitempty"` // WatchMode specifies the filesystem watching mode. WatchMode filesystem.WatchMode `protobuf:"varint,21,opt,name=watchMode,proto3,enum=filesystem.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. 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 sync.IgnoreVCSMode `protobuf:"varint,33,opt,name=ignoreVCSMode,proto3,enum=sync.IgnoreVCSMode" json:"ignoreVCSMode,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(session, global *Configuration) *Configuration
MergeConfigurations merges a per-session and global configuration, allowing the per-session configuration to merge with or override the global configuration.
func (*Configuration) Descriptor ¶
func (*Configuration) Descriptor() ([]byte, []int)
func (*Configuration) EnsureValid ¶
func (c *Configuration) EnsureValid(source ConfigurationSource) error
EnsureValid ensures that Configuration's invariants are respected.
func (*Configuration) GetDefaultIgnores ¶
func (m *Configuration) GetDefaultIgnores() []string
func (*Configuration) GetIgnoreVCSMode ¶
func (m *Configuration) GetIgnoreVCSMode() sync.IgnoreVCSMode
func (*Configuration) GetIgnores ¶
func (m *Configuration) GetIgnores() []string
func (*Configuration) GetSymlinkMode ¶
func (m *Configuration) GetSymlinkMode() sync.SymlinkMode
func (*Configuration) GetWatchMode ¶
func (m *Configuration) GetWatchMode() filesystem.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 (dst *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 ConfigurationSource ¶
type ConfigurationSource uint8
ConfigurationSource represents the source of a configuration object.
const ( // ConfigurationSourceSession specifies that a configuration object came // from a session object stored on disk. ConfigurationSourceSession ConfigurationSource = iota // ConfigurationSourceGlobal specifies that a configuration object was // loaded from the global configuration file. ConfigurationSourceGlobal // ConfigurationSourceCreate specifies that a configuration object came from // a create RPC request. ConfigurationSourceCreate )
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager provides session management facilities for the daemon. Its methods are safe for concurrent usage, so it can be easily exported via an RPC interface.
func (*Manager) Create ¶
func (m *Manager) Create(alpha, beta *url.URL, configuration *Configuration, prompter string) (string, error)
Create tells the manager to create a new session.
func (*Manager) List ¶
func (m *Manager) List(previousStateIndex uint64, specifications []string) (uint64, []*State, error)
List requests a state snapshot for the specified sessions.
func (*Manager) Pause ¶
Pause tells the manager to pause sessions matching the given specifications.
func (*Manager) Resume ¶
Resume tells the manager to resume sessions matching the given specifications.
type Session ¶
type Session struct { Identifier string `protobuf:"bytes,1,opt,name=identifier,proto3" json:"identifier,omitempty"` Version Version `protobuf:"varint,2,opt,name=version,proto3,enum=session.Version" json:"version,omitempty"` CreationTime *timestamp.Timestamp `protobuf:"bytes,3,opt,name=creationTime,proto3" json:"creationTime,omitempty"` CreatingVersionMajor uint32 `protobuf:"varint,4,opt,name=creatingVersionMajor,proto3" json:"creatingVersionMajor,omitempty"` CreatingVersionMinor uint32 `protobuf:"varint,5,opt,name=creatingVersionMinor,proto3" json:"creatingVersionMinor,omitempty"` CreatingVersionPatch uint32 `protobuf:"varint,6,opt,name=creatingVersionPatch,proto3" json:"creatingVersionPatch,omitempty"` Alpha *url.URL `protobuf:"bytes,7,opt,name=alpha,proto3" json:"alpha,omitempty"` Beta *url.URL `protobuf:"bytes,8,opt,name=beta,proto3" json:"beta,omitempty"` Configuration *Configuration `protobuf:"bytes,9,opt,name=configuration,proto3" json:"configuration,omitempty"` 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) EnsureValid ¶
EnsureValid ensures that Session's invariants are respected.
func (*Session) GetConfiguration ¶
func (m *Session) GetConfiguration() *Configuration
func (*Session) GetCreatingVersionMajor ¶
func (*Session) GetCreatingVersionMinor ¶
func (*Session) GetCreatingVersionPatch ¶
func (*Session) GetCreationTime ¶
func (*Session) GetIdentifier ¶
func (*Session) GetVersion ¶
func (*Session) ProtoMessage ¶
func (*Session) ProtoMessage()
func (*Session) XXX_DiscardUnknown ¶
func (m *Session) XXX_DiscardUnknown()
func (*Session) XXX_Marshal ¶
func (*Session) XXX_Unmarshal ¶
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=session.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 []*sync.Conflict `protobuf:"bytes,8,rep,name=conflicts,proto3" json:"conflicts,omitempty"` AlphaProblems []*sync.Problem `protobuf:"bytes,9,rep,name=alphaProblems,proto3" json:"alphaProblems,omitempty"` BetaProblems []*sync.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 ¶
Copy creates a copy of the state, deep-copying those members which are mutable.
func (*State) Descriptor ¶
func (*State) EnsureValid ¶
EnsureValid ensures that State's invariants are respected.
func (*State) GetAlphaConnected ¶
func (*State) GetAlphaProblems ¶
func (*State) GetBetaConnected ¶
func (*State) GetBetaProblems ¶
func (*State) GetConflicts ¶
func (*State) GetLastError ¶
func (*State) GetSession ¶
func (*State) GetStagingStatus ¶
func (m *State) GetStagingStatus() *rsync.ReceiverStatus
func (*State) GetSuccessfulSynchronizationCycles ¶
func (*State) ProtoMessage ¶
func (*State) ProtoMessage()
func (*State) XXX_DiscardUnknown ¶
func (m *State) XXX_DiscardUnknown()
func (*State) XXX_Marshal ¶
func (*State) XXX_Unmarshal ¶
type Status ¶
type Status int32
const ( Status_Disconnected Status = 0 Status_HaltedOnRootDeletion Status = 1 Status_HaltedOnRootTypeChange Status = 2 Status_ConnectingAlpha Status = 3 Status_ConnectingBeta Status = 4 Status_Watching Status = 5 Status_Scanning Status = 6 Status_WaitingForRescan Status = 7 Status_Reconciling Status = 8 Status_StagingAlpha Status = 9 Status_StagingBeta Status = 10 Status_Transitioning Status = 11 Status_Saving Status = 12 )
func (Status) Description ¶
Description returns a human-readable description of the session status.
func (Status) EnumDescriptor ¶
type Version ¶
type Version int32
Version specifies a session version, providing default behavior that can vary without affecting existing sessions.
func (Version) DefaultIgnoreVCSMode ¶
func (v Version) DefaultIgnoreVCSMode() sync.IgnoreVCSMode
DefaultIgnoreVCSMode returns the default VCS ignore mode for the session version.
func (Version) DefaultSymlinkMode ¶
func (v Version) DefaultSymlinkMode() sync.SymlinkMode
DefaultSymlinkMode returns the default symlink mode for the session version.
func (Version) DefaultWatchMode ¶
func (v Version) DefaultWatchMode() filesystem.WatchMode
DefaultWatchMode returns the default watch mode for the session version.