local

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: 19 Imported by: 0

Documentation

Overview

Package local provides a local synchronization endpoint implementation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewEndpoint

func NewEndpoint(
	logger *logging.Logger,
	root string,
	sessionIdentifier string,
	version synchronization.Version,
	configuration *synchronization.Configuration,
	alpha bool,
	options ...EndpointOption,
) (synchronization.Endpoint, error)

NewEndpoint creates a new local endpoint instance using the specified session metadata and options.

Types

type EndpointOption

type EndpointOption interface {
	// contains filtered or unexported methods
}

EndpointOption is the interface for specifying endpoint options. It cannot be constructed or implemented directly, only by one of option constructors provided by this package.

func WithCachePathCallback

func WithCachePathCallback(callback func(string, bool) (string, error)) EndpointOption

WithCachePathCallback overrides the function that the endpoint uses to compute cache storage paths. The specified callback will be provided with two arguments: the session identifier (a UUID) and a boolean indicating whether or not this is the alpha endpoint (if false, it's the beta endpoint). The function should return a path that is consistent but unique in terms of these two arguments.

func WithStagingRootCallback

func WithStagingRootCallback(callback func(string, bool) (string, bool, error)) EndpointOption

WithStagingRootCallback overrides the function that the endpoint uses to compute staging root paths. The specified callback will be provided with two arguments: the session identifier (a UUID) and a boolean indicating whether or not this is the alpha endpoint (if false, it's the beta endpoint). The function should return a path that is consistent but unique in terms of these two arguments, as well as whether or not the generated staging root should be marked as hidden when re-created. The path may exist, but if it does must be a directory, and it will be regularly deleted/re-created.

Jump to

Keyboard shortcuts

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