remote

package
v0.12.0-beta6 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2021 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package remote provides a client/server architecture for connecting to and hosting a remote synchronization endpoint.

Index

Constants

This section is empty.

Variables

View Source
var File_synchronization_endpoint_remote_protocol_proto protoreflect.FileDescriptor

Functions

func NewEndpoint added in v0.11.2

func NewEndpoint(
	stream io.ReadWriteCloser,
	root string,
	session string,
	version synchronization.Version,
	configuration *synchronization.Configuration,
	alpha bool,
) (synchronization.Endpoint, error)

NewEndpoint creates a new remote synchronization.Endpoint operating over the specified stream with the specified metadata. If this function fails, then the provided stream will be closed. Once the endpoint has been established, the underlying stream is owned by the endpoint and will be closed when the endpoint is shut down. The provided stream must unblock read and write operations when closed.

func ServeEndpoint

func ServeEndpoint(logger *logging.Logger, stream io.ReadWriteCloser) error

ServeEndpoint creates and serves a endpoint server on the specified stream. It enforces that the provided stream is closed by the time this function returns, regardless of failure. The provided stream must unblock read and write operations when closed.

Types

type EndpointRequest

type EndpointRequest struct {

	// Poll represents a poll request.
	Poll *PollRequest `protobuf:"bytes,1,opt,name=poll,proto3" json:"poll,omitempty"`
	// Scan represents a scan request.
	Scan *ScanRequest `protobuf:"bytes,2,opt,name=scan,proto3" json:"scan,omitempty"`
	// Stage represents a stage request.
	Stage *StageRequest `protobuf:"bytes,3,opt,name=stage,proto3" json:"stage,omitempty"`
	// Supply represents a supply request.
	Supply *SupplyRequest `protobuf:"bytes,4,opt,name=supply,proto3" json:"supply,omitempty"`
	// Transition represents a transition request.
	Transition *TransitionRequest `protobuf:"bytes,5,opt,name=transition,proto3" json:"transition,omitempty"`
	// contains filtered or unexported fields
}

EndpointRequest is a sum type that can transmit any type of endpoint request. Only the sent request will be non-nil. We intentionally avoid using Protocol Buffers' oneof feature because it generates really ugly code and an unwieldy API, at least in Go. Manually checking for exclusivity is not difficult.

func (*EndpointRequest) Descriptor deprecated

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

Deprecated: Use EndpointRequest.ProtoReflect.Descriptor instead.

func (*EndpointRequest) GetPoll

func (x *EndpointRequest) GetPoll() *PollRequest

func (*EndpointRequest) GetScan

func (x *EndpointRequest) GetScan() *ScanRequest

func (*EndpointRequest) GetStage

func (x *EndpointRequest) GetStage() *StageRequest

func (*EndpointRequest) GetSupply

func (x *EndpointRequest) GetSupply() *SupplyRequest

func (*EndpointRequest) GetTransition

func (x *EndpointRequest) GetTransition() *TransitionRequest

func (*EndpointRequest) ProtoMessage

func (*EndpointRequest) ProtoMessage()

func (*EndpointRequest) ProtoReflect added in v0.12.0

func (x *EndpointRequest) ProtoReflect() protoreflect.Message

func (*EndpointRequest) Reset

func (x *EndpointRequest) Reset()

func (*EndpointRequest) String

func (x *EndpointRequest) String() string

type InitializeSynchronizationRequest

type InitializeSynchronizationRequest struct {

	// Session is the session identifier.
	Session string `protobuf:"bytes,1,opt,name=session,proto3" json:"session,omitempty"`
	// Version is the session version.
	Version synchronization.Version `protobuf:"varint,2,opt,name=version,proto3,enum=synchronization.Version" json:"version,omitempty"`
	// Configuration is the session configuration.
	Configuration *synchronization.Configuration `protobuf:"bytes,3,opt,name=configuration,proto3" json:"configuration,omitempty"`
	// Root is the synchronization root path.
	Root string `protobuf:"bytes,4,opt,name=root,proto3" json:"root,omitempty"`
	// Alpha indicates whether or not the endpoint should behave as alpha (as
	// opposed to beta).
	Alpha bool `protobuf:"varint,5,opt,name=alpha,proto3" json:"alpha,omitempty"`
	// contains filtered or unexported fields
}

InitializeSynchronizationRequest encodes a request for endpoint initialization.

func (*InitializeSynchronizationRequest) Descriptor deprecated

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

Deprecated: Use InitializeSynchronizationRequest.ProtoReflect.Descriptor instead.

func (*InitializeSynchronizationRequest) GetAlpha

func (x *InitializeSynchronizationRequest) GetAlpha() bool

func (*InitializeSynchronizationRequest) GetConfiguration

func (*InitializeSynchronizationRequest) GetRoot

func (*InitializeSynchronizationRequest) GetSession

func (x *InitializeSynchronizationRequest) GetSession() string

func (*InitializeSynchronizationRequest) GetVersion

func (*InitializeSynchronizationRequest) ProtoMessage

func (*InitializeSynchronizationRequest) ProtoMessage()

func (*InitializeSynchronizationRequest) ProtoReflect added in v0.12.0

func (*InitializeSynchronizationRequest) Reset

func (*InitializeSynchronizationRequest) String

type InitializeSynchronizationResponse

type InitializeSynchronizationResponse struct {

	// Error is the error message (if any) resulting from initialization.
	Error string `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"`
	// contains filtered or unexported fields
}

InitializeSynchronizationResponse encodes initialization results.

func (*InitializeSynchronizationResponse) Descriptor deprecated

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

Deprecated: Use InitializeSynchronizationResponse.ProtoReflect.Descriptor instead.

func (*InitializeSynchronizationResponse) GetError

func (*InitializeSynchronizationResponse) ProtoMessage

func (*InitializeSynchronizationResponse) ProtoMessage()

func (*InitializeSynchronizationResponse) ProtoReflect added in v0.12.0

func (*InitializeSynchronizationResponse) Reset

func (*InitializeSynchronizationResponse) String

type PollCompletionRequest

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

PollCompletionRequest is paired with PollRequest and indicates a request for early polling completion or an acknowledgement of completion.

func (*PollCompletionRequest) Descriptor deprecated

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

Deprecated: Use PollCompletionRequest.ProtoReflect.Descriptor instead.

func (*PollCompletionRequest) ProtoMessage

func (*PollCompletionRequest) ProtoMessage()

func (*PollCompletionRequest) ProtoReflect added in v0.12.0

func (x *PollCompletionRequest) ProtoReflect() protoreflect.Message

func (*PollCompletionRequest) Reset

func (x *PollCompletionRequest) Reset()

func (*PollCompletionRequest) String

func (x *PollCompletionRequest) String() string

type PollRequest

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

PollRequest encodes a request for one-shot polling.

func (*PollRequest) Descriptor deprecated

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

Deprecated: Use PollRequest.ProtoReflect.Descriptor instead.

func (*PollRequest) ProtoMessage

func (*PollRequest) ProtoMessage()

func (*PollRequest) ProtoReflect added in v0.12.0

func (x *PollRequest) ProtoReflect() protoreflect.Message

func (*PollRequest) Reset

func (x *PollRequest) Reset()

func (*PollRequest) String

func (x *PollRequest) String() string

type PollResponse

type PollResponse struct {

	// Error is the error message (if any) resulting from polling.
	Error string `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"`
	// contains filtered or unexported fields
}

PollResponse indicates polling completion.

func (*PollResponse) Descriptor deprecated

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

Deprecated: Use PollResponse.ProtoReflect.Descriptor instead.

func (*PollResponse) GetError

func (x *PollResponse) GetError() string

func (*PollResponse) ProtoMessage

func (*PollResponse) ProtoMessage()

func (*PollResponse) ProtoReflect added in v0.12.0

func (x *PollResponse) ProtoReflect() protoreflect.Message

func (*PollResponse) Reset

func (x *PollResponse) Reset()

func (*PollResponse) String

func (x *PollResponse) String() string

type ScanCompletionRequest added in v0.11.0

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

ScanCompletionRequest is paired with a ScanRequest and indicates a request for scan cancellation or an acknowledgement of completion.

func (*ScanCompletionRequest) Descriptor deprecated added in v0.11.0

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

Deprecated: Use ScanCompletionRequest.ProtoReflect.Descriptor instead.

func (*ScanCompletionRequest) ProtoMessage added in v0.11.0

func (*ScanCompletionRequest) ProtoMessage()

func (*ScanCompletionRequest) ProtoReflect added in v0.12.0

func (x *ScanCompletionRequest) ProtoReflect() protoreflect.Message

func (*ScanCompletionRequest) Reset added in v0.11.0

func (x *ScanCompletionRequest) Reset()

func (*ScanCompletionRequest) String added in v0.11.0

func (x *ScanCompletionRequest) String() string

type ScanRequest

type ScanRequest struct {

	// BaseSnapshotSignature is the rsync signature to use as the base for
	// differentially transmitting snapshots.
	BaseSnapshotSignature *rsync.Signature `protobuf:"bytes,1,opt,name=baseSnapshotSignature,proto3" json:"baseSnapshotSignature,omitempty"`
	// Full indicates whether or not to force a full (warm) scan, temporarily
	// avoiding any acceleration that might be available on the endpoint.
	Full bool `protobuf:"varint,2,opt,name=full,proto3" json:"full,omitempty"`
	// contains filtered or unexported fields
}

ScanRequest encodes a request for a scan.

func (*ScanRequest) Descriptor deprecated

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

Deprecated: Use ScanRequest.ProtoReflect.Descriptor instead.

func (*ScanRequest) GetBaseSnapshotSignature

func (x *ScanRequest) GetBaseSnapshotSignature() *rsync.Signature

func (*ScanRequest) GetFull

func (x *ScanRequest) GetFull() bool

func (*ScanRequest) ProtoMessage

func (*ScanRequest) ProtoMessage()

func (*ScanRequest) ProtoReflect added in v0.12.0

func (x *ScanRequest) ProtoReflect() protoreflect.Message

func (*ScanRequest) Reset

func (x *ScanRequest) Reset()

func (*ScanRequest) String

func (x *ScanRequest) String() string

type ScanResponse

type ScanResponse struct {

	// SnapshotDelta are the operations need to reconstruct the snapshot against
	// the specified base.
	SnapshotDelta []*rsync.Operation `protobuf:"bytes,1,rep,name=snapshotDelta,proto3" json:"snapshotDelta,omitempty"`
	// PreservesExecutability indicates whether or not the scan root preserves
	// POSIX executability bits.
	PreservesExecutability bool `protobuf:"varint,2,opt,name=preservesExecutability,proto3" json:"preservesExecutability,omitempty"`
	// Error is the error message (if any) resulting from scanning.
	Error string `protobuf:"bytes,3,opt,name=error,proto3" json:"error,omitempty"`
	// TryAgain indicates whether or not the error is ephermeral.
	TryAgain bool `protobuf:"varint,4,opt,name=tryAgain,proto3" json:"tryAgain,omitempty"`
	// contains filtered or unexported fields
}

ScanResponse encodes the results of a scan.

func (*ScanResponse) Descriptor deprecated

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

Deprecated: Use ScanResponse.ProtoReflect.Descriptor instead.

func (*ScanResponse) GetError

func (x *ScanResponse) GetError() string

func (*ScanResponse) GetPreservesExecutability

func (x *ScanResponse) GetPreservesExecutability() bool

func (*ScanResponse) GetSnapshotDelta

func (x *ScanResponse) GetSnapshotDelta() []*rsync.Operation

func (*ScanResponse) GetTryAgain

func (x *ScanResponse) GetTryAgain() bool

func (*ScanResponse) ProtoMessage

func (*ScanResponse) ProtoMessage()

func (*ScanResponse) ProtoReflect added in v0.12.0

func (x *ScanResponse) ProtoReflect() protoreflect.Message

func (*ScanResponse) Reset

func (x *ScanResponse) Reset()

func (*ScanResponse) String

func (x *ScanResponse) String() string

type StageRequest

type StageRequest struct {

	// Paths lists the paths that need to be staged.
	Paths []string `protobuf:"bytes,1,rep,name=paths,proto3" json:"paths,omitempty"`
	// Digests lists the digests for the paths that need to be staged. Its
	// length and contents correspond to that of Paths.
	Digests [][]byte `protobuf:"bytes,2,rep,name=digests,proto3" json:"digests,omitempty"`
	// contains filtered or unexported fields
}

StageRequest encodes a request for staging.

func (*StageRequest) Descriptor deprecated

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

Deprecated: Use StageRequest.ProtoReflect.Descriptor instead.

func (*StageRequest) GetDigests

func (x *StageRequest) GetDigests() [][]byte

func (*StageRequest) GetPaths

func (x *StageRequest) GetPaths() []string

func (*StageRequest) ProtoMessage

func (*StageRequest) ProtoMessage()

func (*StageRequest) ProtoReflect added in v0.12.0

func (x *StageRequest) ProtoReflect() protoreflect.Message

func (*StageRequest) Reset

func (x *StageRequest) Reset()

func (*StageRequest) String

func (x *StageRequest) String() string

type StageResponse

type StageResponse struct {

	// Paths are the paths that need to be staged (relative to the
	// synchronization root).
	Paths []string `protobuf:"bytes,1,rep,name=paths,proto3" json:"paths,omitempty"`
	// Signatures are the rsync signatures of the paths needing to be staged.
	Signatures []*rsync.Signature `protobuf:"bytes,2,rep,name=signatures,proto3" json:"signatures,omitempty"`
	// Error is the error message (if any) resulting from staging
	// initialization.
	Error string `protobuf:"bytes,3,opt,name=error,proto3" json:"error,omitempty"`
	// contains filtered or unexported fields
}

StageResponse encodes the results of staging initialization.

func (*StageResponse) Descriptor deprecated

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

Deprecated: Use StageResponse.ProtoReflect.Descriptor instead.

func (*StageResponse) GetError

func (x *StageResponse) GetError() string

func (*StageResponse) GetPaths

func (x *StageResponse) GetPaths() []string

func (*StageResponse) GetSignatures

func (x *StageResponse) GetSignatures() []*rsync.Signature

func (*StageResponse) ProtoMessage

func (*StageResponse) ProtoMessage()

func (*StageResponse) ProtoReflect added in v0.12.0

func (x *StageResponse) ProtoReflect() protoreflect.Message

func (*StageResponse) Reset

func (x *StageResponse) Reset()

func (*StageResponse) String

func (x *StageResponse) String() string

type SupplyRequest

type SupplyRequest struct {

	// Paths are the paths to provide (relative to the synchronization root).
	Paths []string `protobuf:"bytes,1,rep,name=paths,proto3" json:"paths,omitempty"`
	// Signatures are the rsync signatures of the paths needing to be staged.
	Signatures []*rsync.Signature `protobuf:"bytes,2,rep,name=signatures,proto3" json:"signatures,omitempty"`
	// contains filtered or unexported fields
}

SupplyRequest indicates a request for supplying files.

func (*SupplyRequest) Descriptor deprecated

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

Deprecated: Use SupplyRequest.ProtoReflect.Descriptor instead.

func (*SupplyRequest) GetPaths

func (x *SupplyRequest) GetPaths() []string

func (*SupplyRequest) GetSignatures

func (x *SupplyRequest) GetSignatures() []*rsync.Signature

func (*SupplyRequest) ProtoMessage

func (*SupplyRequest) ProtoMessage()

func (*SupplyRequest) ProtoReflect added in v0.12.0

func (x *SupplyRequest) ProtoReflect() protoreflect.Message

func (*SupplyRequest) Reset

func (x *SupplyRequest) Reset()

func (*SupplyRequest) String

func (x *SupplyRequest) String() string

type TransitionCompletionRequest added in v0.11.0

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

TransitionCompletionRequest is paired with a TransitionRequest and indicates a request for transition cancellation or an acknowledgement of completion.

func (*TransitionCompletionRequest) Descriptor deprecated added in v0.11.0

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

Deprecated: Use TransitionCompletionRequest.ProtoReflect.Descriptor instead.

func (*TransitionCompletionRequest) ProtoMessage added in v0.11.0

func (*TransitionCompletionRequest) ProtoMessage()

func (*TransitionCompletionRequest) ProtoReflect added in v0.12.0

func (*TransitionCompletionRequest) Reset added in v0.11.0

func (x *TransitionCompletionRequest) Reset()

func (*TransitionCompletionRequest) String added in v0.11.0

func (x *TransitionCompletionRequest) String() string

type TransitionRequest

type TransitionRequest struct {

	// Transitions are the transitions that need to be applied.
	Transitions []*core.Change `protobuf:"bytes,1,rep,name=transitions,proto3" json:"transitions,omitempty"`
	// contains filtered or unexported fields
}

TransitionRequest encodes a request for transition application.

func (*TransitionRequest) Descriptor deprecated

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

Deprecated: Use TransitionRequest.ProtoReflect.Descriptor instead.

func (*TransitionRequest) GetTransitions

func (x *TransitionRequest) GetTransitions() []*core.Change

func (*TransitionRequest) ProtoMessage

func (*TransitionRequest) ProtoMessage()

func (*TransitionRequest) ProtoReflect added in v0.12.0

func (x *TransitionRequest) ProtoReflect() protoreflect.Message

func (*TransitionRequest) Reset

func (x *TransitionRequest) Reset()

func (*TransitionRequest) String

func (x *TransitionRequest) String() string

type TransitionResponse

type TransitionResponse struct {

	// Results are the resulting contents post-transition.
	// HACK: We have to use Archive to wrap our Entry results here because
	// Protocol Buffers won't encode a nil pointer in a repeated element in
	// certain cases, and the results of transitions may very well be nil. gob
	// also exhibits this problem.
	Results []*core.Archive `protobuf:"bytes,1,rep,name=results,proto3" json:"results,omitempty"`
	// Problems are any problems encountered during the transition operation.
	Problems []*core.Problem `protobuf:"bytes,2,rep,name=problems,proto3" json:"problems,omitempty"`
	// StagerMissingFiles indicates whether or not the endpoint's stager
	// indicated missing files during transitioning.
	StagerMissingFiles bool `protobuf:"varint,3,opt,name=stagerMissingFiles,proto3" json:"stagerMissingFiles,omitempty"`
	// Error is the error message (if any) resulting from the remote transition
	// method. This will always be an empty string since transition doesn't
	// return errors from local endpoints, but to match the endpoint interface
	// (which allows for transition errors due to network failures with remote
	// endpoints), we include this field.
	// TODO: Should we just remove this field? Doing so would rely on knowledge
	// of localEndpoint's transition behavior.
	Error string `protobuf:"bytes,4,opt,name=error,proto3" json:"error,omitempty"`
	// contains filtered or unexported fields
}

TransitionResponse encodes the results of transitioning.

func (*TransitionResponse) Descriptor deprecated

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

Deprecated: Use TransitionResponse.ProtoReflect.Descriptor instead.

func (*TransitionResponse) GetError

func (x *TransitionResponse) GetError() string

func (*TransitionResponse) GetProblems

func (x *TransitionResponse) GetProblems() []*core.Problem

func (*TransitionResponse) GetResults

func (x *TransitionResponse) GetResults() []*core.Archive

func (*TransitionResponse) GetStagerMissingFiles

func (x *TransitionResponse) GetStagerMissingFiles() bool

func (*TransitionResponse) ProtoMessage

func (*TransitionResponse) ProtoMessage()

func (*TransitionResponse) ProtoReflect added in v0.12.0

func (x *TransitionResponse) ProtoReflect() protoreflect.Message

func (*TransitionResponse) Reset

func (x *TransitionResponse) Reset()

func (*TransitionResponse) String

func (x *TransitionResponse) String() string

Jump to

Keyboard shortcuts

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