session

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2018 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Status_name = map[int32]string{
	0:  "Disconnected",
	1:  "HaltedOnRootDeletion",
	2:  "HaltedOnRootTypeChange",
	3:  "ConnectingAlpha",
	4:  "ConnectingBeta",
	5:  "Watching",
	6:  "ScanningAlpha",
	7:  "ScanningBeta",
	8:  "WaitingForRescan",
	9:  "Reconciling",
	10: "StagingAlpha",
	11: "StagingBeta",
	12: "TransitioningAlpha",
	13: "TransitioningBeta",
	14: "Saving",
}
View Source
var Status_value = map[string]int32{
	"Disconnected":           0,
	"HaltedOnRootDeletion":   1,
	"HaltedOnRootTypeChange": 2,
	"ConnectingAlpha":        3,
	"ConnectingBeta":         4,
	"Watching":               5,
	"ScanningAlpha":          6,
	"ScanningBeta":           7,
	"WaitingForRescan":       8,
	"Reconciling":            9,
	"StagingAlpha":           10,
	"StagingBeta":            11,
	"TransitioningAlpha":     12,
	"TransitioningBeta":      13,
	"Saving":                 14,
}
View Source
var Version_name = map[int32]string{
	0: "Invalid",
	1: "Version1",
}
View Source
var Version_value = map[string]int32{
	"Invalid":  0,
	"Version1": 1,
}

Functions

func HousekeepCaches

func HousekeepCaches()

func HousekeepStaging

func HousekeepStaging()

func ServeEndpoint

func ServeEndpoint(connection net.Conn) error

TODO: Document that the provided streams should be closed (in a manner that unblocks them) when the function returns in order to ensure that all Goroutines have exited (they could be blocked in encodes/decodes - we only exit after the first fails). We could try to pass in a io.Closer here, but in the agent it would have to be closing standard input/output/error, and OS pipes can (depending on the platform) block on close if you try to close while in a read or write, so it's better that the caller just ensures the streams are closed, in this case by exiting the process.

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,enum=sync.SymlinkMode" json:"symlinkMode,omitempty"`
	// WatchMode specifies the filesystem watching mode.
	WatchMode filesystem.WatchMode `protobuf:"varint,21,opt,name=watchMode,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" json:"watchPollingInterval,omitempty"`
	// DefaultIgnores specifies the ignore patterns brought in from the global
	// configuration.
	DefaultIgnores []string `protobuf:"bytes,31,rep,name=defaultIgnores" json:"defaultIgnores,omitempty"`
	// Ignores specifies the ignore patterns brought in from the create request.
	Ignores []string `protobuf:"bytes,32,rep,name=ignores" json:"ignores,omitempty"`
	// IgnoreVCSMode specifies the VCS ignore mode that should be used in
	// synchronization.
	IgnoreVCSMode        sync.IgnoreVCSMode `protobuf:"varint,33,opt,name=ignoreVCSMode,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

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 NewManager

func NewManager() (*Manager, error)

func (*Manager) Create

func (m *Manager) Create(alpha, beta *url.URL, configuration *Configuration, prompter string) (string, error)

func (*Manager) List

func (m *Manager) List(previousStateIndex uint64, specifications []string) (uint64, []*State, error)

func (*Manager) Pause

func (m *Manager) Pause(specifications []string) error

func (*Manager) Resume

func (m *Manager) Resume(specifications []string, prompter string) error

func (*Manager) Shutdown

func (m *Manager) Shutdown()

func (*Manager) Terminate

func (m *Manager) Terminate(specifications []string) error

type Session

type Session struct {
	Identifier           string               `protobuf:"bytes,1,opt,name=identifier" json:"identifier,omitempty"`
	Version              Version              `protobuf:"varint,2,opt,name=version,enum=session.Version" json:"version,omitempty"`
	CreationTime         *timestamp.Timestamp `protobuf:"bytes,3,opt,name=creationTime" json:"creationTime,omitempty"`
	CreatingVersionMajor uint32               `protobuf:"varint,4,opt,name=creatingVersionMajor" json:"creatingVersionMajor,omitempty"`
	CreatingVersionMinor uint32               `protobuf:"varint,5,opt,name=creatingVersionMinor" json:"creatingVersionMinor,omitempty"`
	CreatingVersionPatch uint32               `protobuf:"varint,6,opt,name=creatingVersionPatch" json:"creatingVersionPatch,omitempty"`
	Alpha                *url.URL             `protobuf:"bytes,7,opt,name=alpha" json:"alpha,omitempty"`
	Beta                 *url.URL             `protobuf:"bytes,8,opt,name=beta" json:"beta,omitempty"`
	Configuration        *Configuration       `protobuf:"bytes,9,opt,name=configuration" json:"configuration,omitempty"`
	Paused               bool                 `protobuf:"varint,10,opt,name=paused" 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

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) 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) 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 (dst *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 State

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

func (*State) Copy

func (s *State) Copy() *State

func (*State) Descriptor

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

func (*State) EnsureValid

func (s *State) EnsureValid() error

func (*State) GetAlphaConnected

func (m *State) GetAlphaConnected() bool

func (*State) GetAlphaProblems

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

func (*State) GetBetaConnected

func (m *State) GetBetaConnected() bool

func (*State) GetBetaProblems

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

func (*State) GetConflicts

func (m *State) GetConflicts() []*sync.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 (dst *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_HaltedOnRootDeletion   Status = 1
	Status_HaltedOnRootTypeChange Status = 2
	Status_ConnectingAlpha        Status = 3
	Status_ConnectingBeta         Status = 4
	Status_Watching               Status = 5
	Status_ScanningAlpha          Status = 6
	Status_ScanningBeta           Status = 7
	Status_WaitingForRescan       Status = 8
	Status_Reconciling            Status = 9
	Status_StagingAlpha           Status = 10
	Status_StagingBeta            Status = 11
	Status_TransitioningAlpha     Status = 12
	Status_TransitioningBeta      Status = 13
	Status_Saving                 Status = 14
)

func (Status) Description

func (s Status) Description() string

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) DefaultIgnoreVCSMode

func (v Version) DefaultIgnoreVCSMode() sync.IgnoreVCSMode

func (Version) DefaultSymlinkMode

func (v Version) DefaultSymlinkMode() sync.SymlinkMode

func (Version) DefaultWatchMode

func (v Version) DefaultWatchMode() filesystem.WatchMode

func (Version) EnumDescriptor

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

func (Version) String

func (x Version) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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