syncthing

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: AGPL-3.0 Imports: 33 Imported by: 0

Documentation

Overview

Copyright 2022 The VolSync authors.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

Copyright 2022 The VolSync authors.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

Index

Constants

View Source
const (
	OrganizationName = "Backube"
	OrganizationUnit = "VolSync"
)

Variables

This section is empty.

Functions

func GenerateRandomBytes

func GenerateRandomBytes(length int) ([]byte, error)

GenerateRandomBytes Generates random bytes of the given length using the OS's RNG.

func GenerateRandomString

func GenerateRandomString(length int) (string, error)

GenerateRandomString Generates a random string of ASCII characters excluding control characters 0-31, 32 (space), and 127. the given length using the OS's RNG.

func Register

func Register() error

Register Creates a builder for the Syncthing mover package and registers it as an available mover for VolSync to use.

Types

type Builder

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

func (*Builder) FromDestination

FromDestination Doesn't implement Syncthing, so nil is returned in both cases.

func (*Builder) FromSource

func (rb *Builder) FromSource(client client.Client, logger logr.Logger,
	eventRecorder events.EventRecorder,
	source *volsyncv1alpha1.ReplicationSource, privileged bool) (mover.Mover, error)

FromSource Builds a Syncthing mover object from a given ReplicationSource object.

func (*Builder) VersionInfo

func (rb *Builder) VersionInfo() string

VersionInfo Returns the Syncthing container image version being used by this Builder.

type Mover

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

Mover is the reconciliation logic for the Restic-based data mover.

func (*Mover) Cleanup

func (m *Mover) Cleanup(ctx context.Context) (mover.Result, error)

Cleanup will remove any resources that were created by the mover. This is currently a no-op since Syncthing is always-on.

func (*Mover) GetDataServiceAddress

func (m *Mover) GetDataServiceAddress(service *corev1.Service) (string, error)

GetDataServiceAddress Will return a string representing the address of the data service, prefixed with TCP.

func (*Mover) Name

func (m *Mover) Name() string

Name Returns the name of the mover.

func (*Mover) Synchronize

func (m *Mover) Synchronize(ctx context.Context) (mover.Result, error)

Synchronize Runs through a synchronization cycle between the VolSync operator and the Syncthing data mover.

Synchronize ensures that the necessary resources required by the Syncthing Deployment are available, including:

  • a PVC containing the data to be synced
  • PVC for storing configuration data
  • Secret containing the API key, TLS Certificates, and the username/password used to lock down the GUI.
  • Deployment for the Syncthing data mover
  • Service exposing Syncthing's API
  • Service exposing Syncthing's data port

Once the resources are all provided, Synchronize will then poll the Syncthing API and make necessary configurations based on the data provided to the Syncthing ReplicationSource spec.

Synchronize also updates the ReplicationSource's status with information about our local Syncthing instance, as well as any connections that have been made to the Syncthing instance.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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