syncthing

package
v1.30.0 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2025 License: MPL-2.0 Imports: 36 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultConfig added in v1.2.2

func DefaultConfig(path string, myID protocol.DeviceID, evLogger events.Logger, noDefaultFolder, skipPortProbing bool) (config.Wrapper, error)

func EnsureDir added in v1.18.5

func EnsureDir(dir string, mode fs.FileMode) error

func GenerateCertificate added in v1.18.5

func GenerateCertificate(certFile, keyFile string) (tls.Certificate, error)

func LoadConfigAtStartup added in v1.2.2

func LoadConfigAtStartup(path string, cert tls.Certificate, evLogger events.Logger, allowNewerConfig, noDefaultFolder, skipPortProbing bool) (config.Wrapper, error)

LoadConfigAtStartup loads an existing config. If it doesn't yet exist, it creates a default one, without the default folder if noDefaultFolder is true. Otherwise it checks the version, and archives and upgrades the config if necessary or returns an error, if the version isn't compatible.

func LoadOrGenerateCertificate added in v1.2.2

func LoadOrGenerateCertificate(certFile, keyFile string) (tls.Certificate, error)

func OpenDBBackend added in v1.3.4

func OpenDBBackend(path string, tuning config.Tuning) (backend.Backend, error)

Types

type App

type App struct {

	// Access to internals for direct users of this package. Note that the interface in Internals is unstable!
	Internals *Internals
	// contains filtered or unexported fields
}

func New

func New(cfg config.Wrapper, dbBackend backend.Backend, evLogger events.Logger, cert tls.Certificate, opts Options) (*App, error)

func (*App) Error

func (a *App) Error() error

Error returns an error if one occurred while running the app. It does not wait for the app to stop before returning.

func (*App) Start

func (a *App) Start() error

Start executes the app and returns once all the startup operations are done, e.g. the API is ready for use. Must be called once only.

func (*App) Stop

func (a *App) Stop(stopReason svcutil.ExitStatus) svcutil.ExitStatus

Stop stops the app and sets its exit status to given reason, unless the app was already stopped before. In any case it returns the effective exit status.

func (*App) Wait

func (a *App) Wait() svcutil.ExitStatus

Wait blocks until the app stops running. Also returns if the app hasn't been started yet.

type Internals added in v1.27.11

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

Internals allows access to a subset of functionality in model.Model. While intended for use from applications that import the package, it is not intended as a stable API at this time. It does however provide a boundary between the more volatile Model interface and upstream users (one of which is an iOS app).

func (*Internals) BlockAvailability added in v1.27.11

func (m *Internals) BlockAvailability(folderID string, file protocol.FileInfo, block protocol.BlockInfo) ([]model.Availability, error)

func (*Internals) Completion added in v1.27.11

func (m *Internals) Completion(deviceID protocol.DeviceID, folderID string) (model.FolderCompletion, error)

func (*Internals) DBSnapshot added in v1.27.11

func (m *Internals) DBSnapshot(folderID string) (*db.Snapshot, error)

func (*Internals) DeviceStatistics added in v1.27.11

func (m *Internals) DeviceStatistics() (map[protocol.DeviceID]stats.DeviceStatistics, error)

func (*Internals) DownloadBlock added in v1.27.11

func (m *Internals) DownloadBlock(ctx context.Context, deviceID protocol.DeviceID, folderID string, path string, blockNumber int, blockInfo protocol.BlockInfo, allowFromTemporary bool) ([]byte, error)

func (*Internals) FolderProgressBytesCompleted added in v1.29.6

func (m *Internals) FolderProgressBytesCompleted(folder string) int64

func (*Internals) FolderState added in v1.27.11

func (m *Internals) FolderState(folderID string) (string, time.Time, error)

func (*Internals) GlobalFileInfo added in v1.27.11

func (m *Internals) GlobalFileInfo(folderID, path string) (protocol.FileInfo, bool, error)

func (*Internals) GlobalTree added in v1.27.11

func (m *Internals) GlobalTree(folderID string, prefix string, levels int, returnOnlyDirectories bool) ([]*model.TreeEntry, error)

func (*Internals) Ignores added in v1.27.11

func (m *Internals) Ignores(folderID string) ([]string, []string, error)

func (*Internals) IsConnectedTo added in v1.27.11

func (m *Internals) IsConnectedTo(deviceID protocol.DeviceID) bool

func (*Internals) LocalChangedFolderFiles added in v1.29.6

func (m *Internals) LocalChangedFolderFiles(folder string, page, perpage int) ([]protocol.FileInfo, error)

func (*Internals) NeedFolderFiles added in v1.29.6

func (m *Internals) NeedFolderFiles(folder string, page, perpage int) ([]protocol.FileInfo, []protocol.FileInfo, []protocol.FileInfo, error)

NeedFolderFiles returns paginated list of currently needed files in progress, queued, and to be queued on next puller iteration.

func (*Internals) PendingFolders added in v1.27.11

func (m *Internals) PendingFolders(deviceID protocol.DeviceID) (map[string]db.PendingFolder, error)

func (*Internals) RemoteNeedFolderFiles added in v1.29.6

func (m *Internals) RemoteNeedFolderFiles(folder string, device protocol.DeviceID, page, perpage int) ([]protocol.FileInfo, error)

func (*Internals) ScanFolderSubdirs added in v1.27.11

func (m *Internals) ScanFolderSubdirs(folderID string, paths []string) error

func (*Internals) ScanFolders added in v1.27.11

func (m *Internals) ScanFolders() map[string]error

func (*Internals) SetIgnores added in v1.27.11

func (m *Internals) SetIgnores(folderID string, content []string) error

type Options

type Options struct {
	AuditWriter    io.Writer
	NoUpgrade      bool
	ProfilerAddr   string
	ResetDeltaIdxs bool
	Verbose        bool
	// null duration means use default value
	DBRecheckInterval    time.Duration
	DBIndirectGCInterval time.Duration
}

Jump to

Keyboard shortcuts

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