state

package
v2.23.2 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertRFC3339ToTime

func ConvertRFC3339ToTime(timeToConvert string) (time.Time, error)

func ConvertTimeToEpochMilliseconds

func ConvertTimeToEpochMilliseconds(timeToConvert time.Time) string

func ConvertTimeToRFC3339

func ConvertTimeToRFC3339(timeToConvert time.Time) string

func GetStartTimestamp

func GetStartTimestamp() (int64, error)

Types

type ActionOnStateFunc

type ActionOnStateFunc func(state *TransferState) error

type ActionOnStatusFunc

type ActionOnStatusFunc func(transferRunStatus *TransferRunStatus) error

type AlreadyLockedError

type AlreadyLockedError struct{}

func (*AlreadyLockedError) Error

func (m *AlreadyLockedError) Error() string

type DiffDetails

type DiffDetails struct {
	// The start and end time of a complete transferring Files Diff phase
	FilesDiffRunTime PhaseDetails `json:"files_diff,omitempty"`
	// The start and end time of the last handled range
	HandledRange PhaseDetails `json:"handled_range,omitempty"`
	// If false, start the Diff phase from the start time of the full transfer
	Completed bool `json:"completed,omitempty"`
}

type PhaseDetails

type PhaseDetails struct {
	Started string `json:"started,omitempty"`
	Ended   string `json:"ended,omitempty"`
}

type ProgressState

type ProgressState struct {
	TotalSizeBytes       int64 `json:"total_size_bytes,omitempty"`
	TransferredSizeBytes int64 `json:"transferred_size_bytes,omitempty"`
	TotalUnits           int   `json:"total_units,omitempty"`
	TransferredUnits     int   `json:"transferred_units,omitempty"`
}

type Repository

type Repository struct {
	ProgressState
	Name         string        `json:"name,omitempty"`
	FullTransfer PhaseDetails  `json:"full_transfer,omitempty"`
	Diffs        []DiffDetails `json:"diffs,omitempty"`
}

type TransferRunStatus

type TransferRunStatus struct {
	ProgressState
	Version          int    `json:"version,omitempty"`
	CurrentRepo      string `json:"current_repo,omitempty"`
	CurrentRepoPhase int    `json:"current_repo_phase,omitempty"`
	WorkingThreads   int    `json:"working_threads,omitempty"`
	TransferFailures uint   `json:"transfer_failures,omitempty"`
	// contains filtered or unexported fields
}

This struct holds the run status of the current transfer. It is saved to a file in JFrog CLI's home, but gets reset every time the transfer begins. This state is used to allow showing the current run status by the 'jf rt tranfer-files --status' command. It is also used for the time estimation and more.

type TransferState

type TransferState struct {
	Repositories []Repository `json:"repositories,omitempty"`
	// contains filtered or unexported fields
}

This struct holds the current state of the whole transfer of the source Artifactory instance. It is saved to a file in JFrog CLI's home. The transfer-files command uses this state to determine which phases need to be executed for each a repository, as well as other decisions related to the process execution.

func NewTransferState

func NewTransferState() *TransferState

type TransferStateManager

type TransferStateManager struct {
	TransferState
	TransferRunStatus
	// contains filtered or unexported fields
}

func NewTransferStateManager

func NewTransferStateManager(loadRunStatus bool) (*TransferStateManager, error)

func (*TransferStateManager) AddNewDiffToState

func (ts *TransferStateManager) AddNewDiffToState(repoKey string, startTime time.Time) error

Adds new diff details to the repo's diff array in state. Marks files handling as started, and sets the handling range.

func (*TransferStateManager) ChangeTransferFailureCountBy added in v2.23.2

func (ts *TransferStateManager) ChangeTransferFailureCountBy(count uint, increase bool) error

func (*TransferStateManager) GetDiffHandlingRange

func (ts *TransferStateManager) GetDiffHandlingRange(repoKey string) (start, end time.Time, err error)

func (*TransferStateManager) GetReposTransferredSizeBytes

func (ts *TransferStateManager) GetReposTransferredSizeBytes(repoKeys ...string) (transferredSizeBytes int64, err error)

func (*TransferStateManager) GetTransferredSizeBytes

func (ts *TransferStateManager) GetTransferredSizeBytes() (transferredSizeBytes int64, err error)

func (*TransferStateManager) GetWorkingThreads

func (ts *TransferStateManager) GetWorkingThreads() (workingThreads int, err error)

func (*TransferStateManager) IncRepositoriesTransferred

func (ts *TransferStateManager) IncRepositoriesTransferred() error

func (*TransferStateManager) IncTransferredSizeAndFiles

func (ts *TransferStateManager) IncTransferredSizeAndFiles(repoKey string, totalFiles int, totalSizeInBytes int64) error

func (*TransferStateManager) IsRepoTransferred

func (ts *TransferStateManager) IsRepoTransferred(repoKey string) (isTransferred bool, err error)

func (*TransferStateManager) SaveState

func (ts *TransferStateManager) SaveState() error

func (*TransferStateManager) SetFilesDiffHandlingCompleted

func (ts *TransferStateManager) SetFilesDiffHandlingCompleted(repoKey string) error

func (*TransferStateManager) SetRepoFullTransferCompleted

func (ts *TransferStateManager) SetRepoFullTransferCompleted(repoKey string) error

func (*TransferStateManager) SetRepoFullTransferStarted

func (ts *TransferStateManager) SetRepoFullTransferStarted(repoKey string, startTime time.Time) error

func (*TransferStateManager) SetRepoPhase

func (ts *TransferStateManager) SetRepoPhase(phaseId int) error

func (*TransferStateManager) SetRepoState

func (ts *TransferStateManager) SetRepoState(repoKey string, totalSizeBytes int64, totalFiles int, reset bool) error

Set the repository state. repoKey - Repository key totalSizeBytes - Repository size in bytes totalFiles - Total files in the repository reset - Delete the transferred info

func (*TransferStateManager) SetWorkingThreads

func (ts *TransferStateManager) SetWorkingThreads(workingThreads int) error

func (*TransferStateManager) TryLockTransferStateManager

func (ts *TransferStateManager) TryLockTransferStateManager() error

Try to lock the tranfer state manager. If file-transfer is already running, return "Already locked" error.

func (*TransferStateManager) UnlockTransferStateManager

func (ts *TransferStateManager) UnlockTransferStateManager() error

Jump to

Keyboard shortcuts

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