Help us shape the future of Go! Take the 2026 Go Developer Survey

cloning

package
v3.0.4 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2025 License: AGPL-3.0 Imports: 23 Imported by: 0

Documentation

Overview

Package cloning provides a cloning service.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base

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

Base provides cloning service.

func NewBase

func NewBase(cfg *Config, provision *provision.Provisioner, tm *telemetry.Agent, observingCh chan string) *Base

NewBase instances a new Base service.

func (*Base) ConnectToClone

func (c *Base) ConnectToClone(ctx context.Context, cloneID string) (pgxtype.Querier, error)

ConnectToClone connects to clone by cloneID.

func (*Base) CreateClone

func (c *Base) CreateClone(cloneRequest *types.CloneCreateRequest) (*models.Clone, error)

CreateClone creates a new clone.

func (*Base) DestroyClone

func (c *Base) DestroyClone(cloneID string) error

DestroyClone destroys clone.

func (*Base) GetClone

func (c *Base) GetClone(id string) (*models.Clone, error)

GetClone returns clone by ID.

func (*Base) GetClones

func (c *Base) GetClones() []*models.Clone

GetClones returns the list of clones descend ordered by creation time.

func (*Base) GetCloningState

func (c *Base) GetCloningState() models.Cloning

GetCloningState returns the current state of instance.

func (*Base) GetSnapshots

func (c *Base) GetSnapshots() ([]models.Snapshot, error)

GetSnapshots returns all available snapshots.

func (*Base) Reload

func (c *Base) Reload(cfg Config)

Reload reloads base cloning configuration.

func (*Base) ResetClone

func (c *Base) ResetClone(cloneID string, resetOptions types.ResetCloneRequest) error

ResetClone resets clone to chosen snapshot.

func (*Base) RestoreClonesState

func (c *Base) RestoreClonesState() error

RestoreClonesState restores clones data from disk.

func (*Base) Run

func (c *Base) Run(ctx context.Context) error

Run initializes and runs cloning component.

func (*Base) SaveClonesState

func (c *Base) SaveClonesState()

SaveClonesState writes clones state to disk.

func (*Base) UpdateClone

func (c *Base) UpdateClone(id string, patch types.CloneUpdateRequest) (*models.Clone, error)

UpdateClone updates clone.

func (*Base) UpdateCloneStatus

func (c *Base) UpdateCloneStatus(cloneID string, status models.Status) error

UpdateCloneStatus updates the clone status.

type CloneWrapper

type CloneWrapper struct {
	Clone   *models.Clone      `json:"clone"`
	Session *resources.Session `json:"session"`

	TimeCreatedAt time.Time `json:"time_created_at"`
	TimeStartedAt time.Time `json:"time_started_at"`
}

CloneWrapper represents a cloning service wrapper.

func NewCloneWrapper

func NewCloneWrapper(clone *models.Clone, createdAt time.Time) *CloneWrapper

NewCloneWrapper constructs a new CloneWrapper.

func (CloneWrapper) IsProtected

func (cw CloneWrapper) IsProtected() bool

IsProtected checks if clone is protected.

type Config

type Config struct {
	MaxIdleMinutes uint   `yaml:"maxIdleMinutes"`
	AccessHost     string `yaml:"accessHost"`
}

Config contains a cloning configuration.

type SnapshotBox

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

SnapshotBox contains instance snapshots.

Jump to

Keyboard shortcuts

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