Documentation ¶
Index ¶
- func ConvertRFC3339ToTime(timeToConvert string) (time.Time, error)
- func ConvertTimeToEpochMilliseconds(timeToConvert time.Time) string
- func ConvertTimeToRFC3339(timeToConvert time.Time) string
- func GetJfrogTransferRepoSnapshotDir(repoKey string) (string, error)
- func GetJfrogTransferRepoSubDir(repoKey, subDirName string) (string, error)
- func GetOldTransferDirectoryStructureError() error
- func GetRepoSnapshotFilePath(repoKey string) (string, error)
- func GetRepoStateFilepath(repoKey string, snapshot bool) (string, error)
- func GetRepositoryTransferDir(repoKey string) (string, error)
- func GetRunningTime() (runningTime string, isRunning bool, err error)
- func SecondsToLiteralTime(secondsToConvert int64, prefix string) string
- func SetAutoSaveState() (cleanUp func())
- func UpdateChunkInState(stateManager *TransferStateManager, chunk *api.ChunkStatus) (err error)
- func VerifyTransferRunStatusVersion() error
- type ActionOnStateFunc
- type ActionOnStatusFunc
- type AlreadyLockedError
- type DiffDetails
- type PhaseDetails
- type ProgressState
- type ProgressStateUnits
- type RepoTransferSnapshot
- type Repository
- type SnapshotActionFunc
- type StaleChunk
- type StaleChunks
- 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) DisableRepoTransferSnapshot()
- func (ts *TransferStateManager) GetDiffHandlingRange() (start, end time.Time, err error)
- func (ts *TransferStateManager) GetDirectorySnapshotNodeWithLru(relativePath string) (node *reposnapshot.Node, err error)
- func (ts *TransferStateManager) GetReposTransferredSizeBytes(repoKeys ...string) (transferredSizeBytes int64, err error)
- func (ts *TransferStateManager) GetStaleChunks() (staleChunks []StaleChunks, 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) IncTransferredSizeAndFilesPhase1(chunkTotalFiles, chunkTotalSizeInBytes int64) error
- func (ts *TransferStateManager) IncTransferredSizeAndFilesPhase2(chunkTotalFiles, chunkTotalSizeInBytes int64) error
- func (ts *TransferStateManager) IncTransferredSizeAndFilesPhase3(chunkTotalFiles, chunkTotalSizeInBytes int64) error
- func (ts *TransferStateManager) IsRepoTransferSnapshotEnabled() bool
- func (ts *TransferStateManager) LookUpNode(relativePath string) (requestedNode *reposnapshot.Node, err error)
- func (ts *TransferStateManager) SaveStateAndSnapshots() 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) SetStaleChunks(staleChunks []StaleChunks) 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
- func (ts *TransferStateManager) WasSnapshotLoaded() (wasLoaded bool, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertTimeToRFC3339 ¶
func GetJfrogTransferRepoSnapshotDir ¶ added in v2.27.0
func GetJfrogTransferRepoSubDir ¶ added in v2.27.0
func GetOldTransferDirectoryStructureError ¶ added in v2.31.0
func GetOldTransferDirectoryStructureError() error
func GetRepoSnapshotFilePath ¶ added in v2.27.0
func GetRepoStateFilepath ¶ added in v2.27.0
func GetRepositoryTransferDir ¶ added in v2.25.0
func GetRunningTime ¶ added in v2.24.0
func SecondsToLiteralTime ¶ added in v2.36.1
SecondsToLiteralTime converts a number of seconds to an easy-to-read string. Prefix is not taken into account if the time is less than a minute.
func SetAutoSaveState ¶ added in v2.27.0
func SetAutoSaveState() (cleanUp func())
Set the state's save-interval to 0 so every action will be persisted and data can be asserted.
func UpdateChunkInState ¶ added in v2.24.0
func UpdateChunkInState(stateManager *TransferStateManager, chunk *api.ChunkStatus) (err error)
func VerifyTransferRunStatusVersion ¶ added in v2.31.0
func VerifyTransferRunStatusVersion() 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 RepoTransferSnapshot ¶ added in v2.27.0
type RepoTransferSnapshot struct {
// contains filtered or unexported fields
}
RepoTransferSnapshot handles saving and loading the repository's transfer snapshot. A repository transfer snapshot stores the progress of transferring a repository, as explained in RepoSnapshotManager. In case a transfer is interrupted, the transfer can continue from it's saved snapshot instead of starting from scratch.
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 SnapshotActionFunc ¶ added in v2.27.0
type SnapshotActionFunc func(rts *RepoTransferSnapshot) error
type StaleChunk ¶ added in v2.36.1
type StaleChunks ¶ added in v2.36.1
type StaleChunks struct { NodeID string `json:"node_id,omitempty"` Chunks []StaleChunk `json:"stale_node_chunks,omitempty"` }
This structure contains a collection of chunks that have been undergoing processing for over 30 minutes
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"` StaleChunks []StaleChunks `json:"stale_chunks,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, snapshot bool) (transferState TransferState, exists bool, err error)
func (*TransferState) Action ¶ added in v2.29.8
func (ts *TransferState) Action(action ActionOnStateFunc) error
func (*TransferState) IsRepoTransferred ¶ added in v2.27.0
func (ts *TransferState) IsRepoTransferred() (isTransferred 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) DisableRepoTransferSnapshot ¶ added in v2.27.0
func (ts *TransferStateManager) DisableRepoTransferSnapshot()
func (*TransferStateManager) GetDiffHandlingRange ¶
func (ts *TransferStateManager) GetDiffHandlingRange() (start, end time.Time, err error)
func (*TransferStateManager) GetDirectorySnapshotNodeWithLru ¶ added in v2.27.0
func (ts *TransferStateManager) GetDirectorySnapshotNodeWithLru(relativePath string) (node *reposnapshot.Node, err error)
func (*TransferStateManager) GetReposTransferredSizeBytes ¶
func (ts *TransferStateManager) GetReposTransferredSizeBytes(repoKeys ...string) (transferredSizeBytes int64, err error)
func (*TransferStateManager) GetStaleChunks ¶ added in v2.36.1
func (ts *TransferStateManager) GetStaleChunks() (staleChunks []StaleChunks, 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) IncTransferredSizeAndFilesPhase1 ¶ added in v2.28.0
func (ts *TransferStateManager) IncTransferredSizeAndFilesPhase1(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) IsRepoTransferSnapshotEnabled ¶ added in v2.27.0
func (ts *TransferStateManager) IsRepoTransferSnapshotEnabled() bool
func (*TransferStateManager) LookUpNode ¶ added in v2.27.0
func (ts *TransferStateManager) LookUpNode(relativePath string) (requestedNode *reposnapshot.Node, err error)
func (*TransferStateManager) SaveStateAndSnapshots ¶ added in v2.27.0
func (ts *TransferStateManager) SaveStateAndSnapshots() 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 buildInfoRepo - True if build info repository reset - Delete the repository's previous transfer info
func (*TransferStateManager) SetStaleChunks ¶ added in v2.36.1
func (ts *TransferStateManager) SetStaleChunks(staleChunks []StaleChunks) error
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
func (*TransferStateManager) WasSnapshotLoaded ¶ added in v2.27.0
func (ts *TransferStateManager) WasSnapshotLoaded() (wasLoaded bool, err error)