Documentation ¶
Index ¶
- Variables
- func ConvertRFC3339ToTime(timeToConvert string) (time.Time, error)
- func ConvertTimeToEpochMilliseconds(timeToConvert time.Time) string
- func ConvertTimeToRFC3339(timeToConvert time.Time) string
- func GetRepositoryTransferDir(repoKey string) (string, error)
- func GetRunningTime() (runningTime string, isRunning bool, err error)
- func UpdateChunkInState(stateManager *TransferStateManager, chunk *api.ChunkStatus) (chunkTotalSizeInBytes int64, err error)
- type ActionOnStateFunc
- type ActionOnStatusFunc
- type AlreadyLockedError
- type DiffDetails
- type PhaseDetails
- type ProgressState
- type ProgressStateUnits
- type Repository
- type TimeEstimationManager
- type TransferRunStatus
- type TransferState
- type TransferStateManager
- func (ts *TransferStateManager) AddNewDiffToState(startTime time.Time) error
- func (ts *TransferStateManager) ChangeTransferFailureCountBy(count uint, increase bool) error
- func (ts *TransferStateManager) GetDiffHandlingRange() (start, end time.Time, err error)
- func (ts *TransferStateManager) GetReposTransferredSizeBytes(repoKeys ...string) (transferredSizeBytes int64, err error)
- func (ts *TransferStateManager) GetStorageAndFilesRepoPointers(phase int) (totalFailedStorage, totalUploadedFailedStorage, totalFailedFiles, ... *int64, ...)
- func (ts *TransferStateManager) GetTransferredSizeBytes() (transferredSizeBytes int64, err error)
- func (ts *TransferStateManager) GetWorkingThreads() (workingThreads int, err error)
- func (ts *TransferStateManager) IncRepositoriesTransferred() error
- func (ts *TransferStateManager) IncTotalSizeAndFilesPhase2(filesNumber, totalSize int64) error
- func (ts *TransferStateManager) IncTransferredSizeAndFiles(chunkTotalFiles, chunkTotalSizeInBytes int64) error
- func (ts *TransferStateManager) IncTransferredSizeAndFilesPhase2(chunkTotalFiles, chunkTotalSizeInBytes int64) error
- func (ts *TransferStateManager) IncTransferredSizeAndFilesPhase3(chunkTotalFiles, chunkTotalSizeInBytes int64) error
- func (ts *TransferStateManager) IsRepoTransferred() (isTransferred bool, err error)
- func (ts *TransferStateManager) SaveState() error
- func (ts *TransferStateManager) SetFilesDiffHandlingCompleted() error
- func (ts *TransferStateManager) SetRepoFullTransferCompleted() error
- func (ts *TransferStateManager) SetRepoFullTransferStarted(startTime time.Time) error
- func (ts *TransferStateManager) SetRepoPhase(phaseId int) error
- func (ts *TransferStateManager) SetRepoState(repoKey string, totalSizeBytes, totalFiles int64, buildInfoRepo, reset bool) error
- func (ts *TransferStateManager) SetTotalSizeAndFilesPhase3(filesNumber, totalSize int64) error
- func (ts *TransferStateManager) SetWorkingThreads(workingThreads int) error
- func (ts *TransferStateManager) TryLockTransferStateManager() error
- func (ts *TransferStateManager) UnlockTransferStateManager() error
Constants ¶
This section is empty.
Variables ¶
var SaveIntervalSecs = saveIntervalSecsDefault
Functions ¶
func ConvertTimeToRFC3339 ¶
func GetRepositoryTransferDir ¶ added in v2.25.0
func GetRunningTime ¶ added in v2.24.0
func UpdateChunkInState ¶ added in v2.24.0
func UpdateChunkInState(stateManager *TransferStateManager, chunk *api.ChunkStatus) (chunkTotalSizeInBytes int64, err 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 ProgressState ¶
type ProgressState struct { TotalSizeBytes int64 `json:"total_size_bytes,omitempty"` TransferredSizeBytes int64 `json:"transferred_size_bytes,omitempty"` ProgressStateUnits }
type ProgressStateUnits ¶ added in v2.24.0
type Repository ¶
type Repository struct { Phase1Info ProgressState `json:"phase1_info,omitempty"` Phase2Info ProgressState `json:"phase2_info,omitempty"` Phase3Info ProgressState `json:"phase3_info,omitempty"` Name string `json:"name,omitempty"` FullTransfer PhaseDetails `json:"full_transfer,omitempty"` Diffs []DiffDetails `json:"diffs,omitempty"` }
type TimeEstimationManager ¶ added in v2.24.0
type TimeEstimationManager struct { // Speeds of the last done chunks, in bytes/ms LastSpeeds []float64 `json:"last_speeds,omitempty"` // Sum of the speeds in LastSpeeds. The speeds are in bytes/ms. LastSpeedsSum float64 `json:"last_speeds_sum,omitempty"` // The last calculated sum of speeds, in bytes/ms SpeedsAverage float64 `json:"speeds_average,omitempty"` // Data estimated remaining time is saved so that it can be used when handling a build-info repository and speed cannot be calculated. DataEstimatedRemainingTime int64 `json:"data_estimated_remaining_time,omitempty"` // contains filtered or unexported fields }
func (*TimeEstimationManager) AddChunkStatus ¶ added in v2.24.0
func (tem *TimeEstimationManager) AddChunkStatus(chunkStatus api.ChunkStatus, durationMillis int64)
func (*TimeEstimationManager) GetEstimatedRemainingTimeString ¶ added in v2.24.0
func (tem *TimeEstimationManager) GetEstimatedRemainingTimeString() string
GetEstimatedRemainingTimeString gets the estimated remaining time in an easy-to-read string.
func (*TimeEstimationManager) GetSpeedString ¶ added in v2.24.0
func (tem *TimeEstimationManager) GetSpeedString() string
GetSpeedString gets the transfer speed in an easy-to-read string.
type TransferRunStatus ¶
type TransferRunStatus struct { // This variable holds the total/transferred number of repositories (not their files). OverallTransfer ProgressState `json:"overall_transfer,omitempty"` TotalRepositories ProgressStateUnits `json:"total_repositories,omitempty"` OverallBiFiles ProgressStateUnits `json:"overall_bi_files,omitempty"` // Version of the TransferRunStatus file. Version int `json:"version,omitempty"` CurrentRepoKey string `json:"current_repo,omitempty"` // True if currently transferring a build info repository. BuildInfoRepo bool `json:"build_info_repo,omitempty"` CurrentRepoPhase int `json:"current_repo_phase,omitempty"` WorkingThreads int `json:"working_threads,omitempty"` TransferFailures uint `json:"transfer_failures,omitempty"` TimeEstimationManager `json:"time_estimation,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 transfer-files --status' command. It is also used for the time estimation and more.
type TransferState ¶
type TransferState struct { // The Version of the state.json file of a repository. Version int `json:"state_version,omitempty"` CurrentRepo Repository `json:"repository,omitempty"` // contains filtered or unexported fields }
This struct holds the state of the current repository being transferred from the source Artifactory instance. It is saved to a file located in a directory named with the sha of the repository, under the transfer directory. The transfer-files command uses this state to determine which phases should be executed for the repository, as well as other decisions related to the process execution.
func LoadTransferState ¶ added in v2.25.0
func LoadTransferState(repoKey string) (transferState TransferState, exists bool, err error)
type TransferStateManager ¶
type TransferStateManager struct { TransferState TransferRunStatus // contains filtered or unexported fields }
func InitStateTest ¶ added in v2.24.0
func InitStateTest(t *testing.T) (stateManager *TransferStateManager, cleanUp func())
func NewTransferStateManager ¶
func NewTransferStateManager(loadRunStatus bool) (*TransferStateManager, error)
func (*TransferStateManager) AddNewDiffToState ¶
func (ts *TransferStateManager) AddNewDiffToState(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() (start, end time.Time, err error)
func (*TransferStateManager) GetReposTransferredSizeBytes ¶
func (ts *TransferStateManager) GetReposTransferredSizeBytes(repoKeys ...string) (transferredSizeBytes int64, err error)
func (*TransferStateManager) GetStorageAndFilesRepoPointers ¶ added in v2.25.0
func (ts *TransferStateManager) GetStorageAndFilesRepoPointers(phase int) (totalFailedStorage, totalUploadedFailedStorage, totalFailedFiles, totalUploadedFailedFiles *int64, err error)
Returns pointers to TotalStorage, TotalFiles, TransferredFiles and TransferredStorage from progressState of a specific Repository.
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) IncTotalSizeAndFilesPhase2 ¶ added in v2.25.0
func (ts *TransferStateManager) IncTotalSizeAndFilesPhase2(filesNumber, totalSize int64) error
func (*TransferStateManager) IncTransferredSizeAndFiles ¶
func (ts *TransferStateManager) IncTransferredSizeAndFiles(chunkTotalFiles, chunkTotalSizeInBytes int64) error
Increasing Transferred Diff files (modified files) and SizeByBytes value in suitable repository progress state
func (*TransferStateManager) IncTransferredSizeAndFilesPhase2 ¶ added in v2.25.0
func (ts *TransferStateManager) IncTransferredSizeAndFilesPhase2(chunkTotalFiles, chunkTotalSizeInBytes int64) error
func (*TransferStateManager) IncTransferredSizeAndFilesPhase3 ¶ added in v2.25.0
func (ts *TransferStateManager) IncTransferredSizeAndFilesPhase3(chunkTotalFiles, chunkTotalSizeInBytes int64) error
Increase transferred storage and files in phase 3
func (*TransferStateManager) IsRepoTransferred ¶
func (ts *TransferStateManager) IsRepoTransferred() (isTransferred bool, err error)
func (*TransferStateManager) SaveState ¶
func (ts *TransferStateManager) SaveState() error
func (*TransferStateManager) SetFilesDiffHandlingCompleted ¶
func (ts *TransferStateManager) SetFilesDiffHandlingCompleted() error
func (*TransferStateManager) SetRepoFullTransferCompleted ¶
func (ts *TransferStateManager) SetRepoFullTransferCompleted() error
func (*TransferStateManager) SetRepoFullTransferStarted ¶
func (ts *TransferStateManager) SetRepoFullTransferStarted(startTime time.Time) error
func (*TransferStateManager) SetRepoPhase ¶
func (ts *TransferStateManager) SetRepoPhase(phaseId int) error
func (*TransferStateManager) SetRepoState ¶
func (ts *TransferStateManager) SetRepoState(repoKey string, totalSizeBytes, totalFiles int64, buildInfoRepo, 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) SetTotalSizeAndFilesPhase3 ¶ added in v2.25.0
func (ts *TransferStateManager) SetTotalSizeAndFilesPhase3(filesNumber, totalSize int64) error
Set relevant information of files and storage we need to transfer in phase3
func (*TransferStateManager) SetWorkingThreads ¶
func (ts *TransferStateManager) SetWorkingThreads(workingThreads int) error
func (*TransferStateManager) TryLockTransferStateManager ¶
func (ts *TransferStateManager) TryLockTransferStateManager() error
Try to lock the transfer state manager. If file-transfer is already running, return "Already locked" error.
func (*TransferStateManager) UnlockTransferStateManager ¶
func (ts *TransferStateManager) UnlockTransferStateManager() error